Important: Please read the Qt Code of Conduct -

'QWebEngineView' file not found by cmake (even though it is at same place as 'QWebKit', which it finds just fine

  • Hello,
    I am presently moving to 5.6, and in the course of it, changing from QWebView to QWebEngineView. It seems straightforward, but I am hung up on the easiest part - getting my build environment to find the files.

    The directory structure is symmetric between QtWebKit and QtWebEngine - except that WebEngine has a WebEngineCore in a way that WebKit doesn't have. That may be part of the problem, but can't tell.

    To make the transition, I put WebEngine in the same way as WebKit. But whereas it finds WebKit, it does not find WebEngine, leading me to believe there is another variable that isn't in CMakeLists.txt but which is defined somewhere else?

    Here's my CMakeLists.txt file:

    cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
    option(WANT_DEBUG ON)
    if (APPLE)
      add_definitions(-Wno-macro-redefined -Wno-inconsistent-missing-override -Wno-potentially-evaluated-expression)
    include_directories(../caplib ../dicomlib)
    find_package(ITK REQUIRED)
    if (ITKVtkGlue_LOADED)
      find_package(VTK REQUIRED)
      find_package(ItkVtkGlue REQUIRED)
      set(Glue ItkVtkGlue)
    #set (CMAKE_PREFIX_PATH /Users/keithmoulton/Qt/5.5/clang_64/lib/cmake/Qt5)
    #set (QT_QTGUI_LIBRARY /Users/keithmoulton/Qt/5.5/clang_64/lib/QtGui.framework)
    # Tell CMake to run moc when necessary.
    # As moc files are generated in the binary dir, tell CMake to always look for includes there.
    # Widgets finds its own dependencies (QtGui and QtCore).
    find_package(Qt5Widgets REQUIRED)
    find_package(Qt5WebKitWidgets REQUIRED)
    find_package(Qt5WebEngineWidgets REQUIRED)
    # The Qt5Widgets_INCLUDES also includes the include directories for dependencies QtCore and QtGui.
    # We need add -DQT_WIDGETS_LIB when using QtWidgets in Qt 5.
    # Executables fail to build with Qt 5 in the default configuration without -fPIE. We add that here.
    find_package(VTK REQUIRED)
    set(CPP cap_main.cpp cap.cpp capTools.cpp processingParameters.cpp workItem.cpp seriesSurvey.cpp targetDefine.cpp patientAnalyze.cpp patientReport.cpp)
    set(MOC )
    set(UI mainwindow.ui aboutPage.ui workItem.ui seriesSurvey.ui targetDefine.ui patientAnalyze.ui patientReport.ui)
    set(RCC cap.qrc)
    qt5_wrap_cpp(MOC_GENERATED ${MOC})
    qt5_wrap_ui(UI_GENERATED ${UI})
    qt5_add_resources(RCC_RESOURCES ${RCC})
    source_group("Form Files" FILES ${UI})
    source_group("Resource Files" FILES ${RCC})
    source_group("Generated Files" FILES ${MOC_GENERATED} ${UI_GENERATED} ${RCC_GENERATED})
    add_subdirectory(../dicomlib dicomlib)
    add_subdirectory(../caplib caplib)
    qt5_add_resources(RESOURCE_ADDED ${RCC})
    set_source_files_properties(${RESOURCE_ADDED} PROPERTIES GENERATED ON)
    set_property(TARGET vascuCAP PROPERTY CXX_STANDARD 11)
    target_link_libraries(vascuCAP caplib dicomlib ${Qt5Widgets_LIBRARIES} ${Qt5WebKitWidgets_LIBRARIES}  ${Qt5WebEngineWidgets_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES})
    if (APPLE)
      install(TARGETS vascuCAP BUNDLE DESTINATION ~/bin/)
      #install(TARGETS lungCAP BUNDLE DESTINATION ~/bin/)
    else (APPLE)
      install(TARGETS vascuCAP DESTINATION /usr/local/bin)
      #install(TARGETS lungCAP DESTINATION /usr/local/bin)

    [edit: Fixed coding tags SGaist]

  • Lifetime Qt Champion


    Might be a silly question, but did you reconfigure from scratch before building with 5.6 ?

  • This actually precedes 5.6, according to my following sequence:

    1. I started a 5.6 build on another system
    2. Then I saw that WebKit isn't in 5.6, it requires a separate pull from git and more complexity... so I determined that I needed to consider a transition path that wouldn't make things more complicated than they already are.
    3. So I did see that WebEngine is already in 5.5, so I determined that I woudl make my WebKit to WebEngine swith on another computer first, that hadn't been moved to 5.6 yet, and push that to my repo so that my 5.6 could avoid the WebKit complexity.

    In other words, I am on parallel paths, this system on 5.5.1 to get rid of WebKit first, then jump to the other system with 5.6, but already having transitioned to WebEngine.

    At least that's my plan.

  • Lifetime Qt Champion

    What exact error are you getting ?

Log in to reply