Important: Please read the Qt Code of Conduct -

CMake and QT WebKit Compile

  • When I include QT += webkit in a project file and use qmake, a QWebView example works great and as expected. When attempting to add "set(QT_USE_QTWEBKIT TRUE)" to my CMakeList.txt, I get the issue:

    "Qt QTXMLPATTERNS library not found."

    I have tried adding set(QT_USE_QTXMLPATTERNS TRUE) to address this, but no change. A post on another site suggested there is an un-neccessary dependency for WebKit to have on XmlPatterns.

    Since the qmake version works and the cmake version does not, the module must be available to be loaded.

    Any hint on the solution or troubleshooting steps to fix this? A CMake example?

  • A work-around does exist...but does not explain the issue. It appears that the CMake solution does have an un-necessary dependency on XML Patterns, an illustrated in the work-around.
    (Work Around)
    Two changes from working examples:

    1. Find the webkit on your system. i.e. instead of #include <QWebView>, mine was #include <QtWebKit/QWebView>.
    2. Specify on the link line "-l QtWebKit" or in a target_link_libraries() operation, add "QtWebKit", do not add "set(QT_USE_QTWEBKIT TRUE)"

Log in to reply