Solved A problem that has been bothering me for 7 months
-
I want to use the QWebEngine module.
Following the document, I added in
CMakeList.txt
:find_package(Qt6 REQUIRED COMPONENTS WebEngineWidgets) target_link_libraries(target PRIVATE Qt::WebEngineWidgets)
Press F7 to compile, I always get these:
[cmake] Not searching for unused variables given on the command line. [cmake] -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) [cmake] -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) [cmake] -- Could NOT find Qt6Positioning (missing: Qt6Positioning_DIR) [cmake] CMake Warning at C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeFindDependencyMacro.cmake:47 (find_package): [cmake] Found package configuration file: [cmake] [cmake] D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WebEngineCore/Qt6WebEngineCoreConfig.cmake [cmake] [cmake] but it set Qt6WebEngineCore_FOUND to FALSE so package "Qt6WebEngineCore" is [cmake] considered to be NOT FOUND. Reason given by package: [cmake] [cmake] Qt6WebEngineCore could not be found because dependency Qt6Positioning could [cmake] not be found. [cmake] [cmake] Call Stack (most recent call first): [cmake] D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:14 (find_dependency) [cmake] D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WebEngineWidgets/Qt6WebEngineWidgetsDependencies.cmake:96 (_qt_internal_find_dependencies) [cmake] D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WebEngineWidgets/Qt6WebEngineWidgetsConfig.cmake:40 (include) [cmake] D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:209 (find_package) [cmake] CMakeLists.txt:54 (find_package) [cmake] [cmake] [cmake] CMake Warning at D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:209 (find_package): [cmake] Found package configuration file: [cmake] [cmake] D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WebEngineWidgets/Qt6WebEngineWidgetsConfig.cmake [cmake] [cmake] but it set Qt6WebEngineWidgets_FOUND to FALSE so package [cmake] "Qt6WebEngineWidgets" is considered to be NOT FOUND. Reason given by [cmake] package: [cmake] [cmake] Qt6WebEngineWidgets could not be found because dependency Qt6WebEngineCore [cmake] could not be found. [cmake] [cmake] Call Stack (most recent call first): [cmake] CMakeLists.txt:54 (find_package) [cmake] [cmake] [cmake] CMake Error at CMakeLists.txt:54 (find_package): [cmake] Found package configuration file: [cmake] [cmake] D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake [cmake] [cmake] but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT [cmake] FOUND. Reason given by package: [cmake] [cmake] Failed to find Qt component "WebEngineWidgets". [cmake] [cmake] Expected Config file at [cmake] "D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WebEngineWidgets/Qt6WebEngineWidgetsConfig.cmake" [cmake] exists [cmake] [cmake] [cmake] [cmake] [cmake] [cmake] -- Configuring incomplete, errors occurred! [cmake] See also "D:/site/fanbook-bot-tools/build/CMakeFiles/CMakeOutput.log". [cmake] See also "D:/site/fanbook-bot-tools/build/CMakeFiles/CMakeError.log". [proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SD:/site/fanbook-bot-tools -Bd:/site/fanbook-bot-tools/build -G "Visual Studio 17 2022" -T host=x64 -A x64 exited with code: 1 [visual-studio] Patch Windows SDK path from C:\Program Files (x86)\Windows Kits\10\bin\x64 to C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64 for C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat
This time, I am sure that I'm using MSVC. And Qt
6.2.4
, CMake3.25.2
. -
Full CMake config:
cmake_minimum_required(VERSION 3.25) project(fanbook_bot_tools VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_BUILD_TYPE "Debug") set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) set(PROJECT_SOURCES ./src/main.cpp ) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(fanbook_bot_tools MANUAL_FINALIZATION ${PROJECT_SOURCES} ) # Define target properties for Android with Qt 6 as: # set_property(TARGET fanbook_bot_tools APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR # ${CMAKE_CURRENT_SOURCE_DIR}/android) # For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation else() if(ANDROID) add_library(fanbook_bot_tools SHARED ${PROJECT_SOURCES} ) # Define properties for Android with Qt 5 after find_package() calls as: # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") else() add_executable(fanbook_bot_tools ${PROJECT_SOURCES} ) endif() endif() target_link_libraries(fanbook_bot_tools PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) set_target_properties(fanbook_bot_tools PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE TRUE WIN32_EXECUTABLE TRUE ) find_package(Qt6 REQUIRED COMPONENTS WebEngineWidgets) target_link_libraries(target PRIVATE Qt::WebEngineWidgets) install(TARGETS fanbook_bot_tools BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) if(QT_VERSION_MAJOR EQUAL 6) qt_finalize_executable(fanbook_bot_tools) endif()
-
@KaiKai said in A problem that has been bothering me for 7 months:
[cmake] Qt6WebEngineCore could not be found because dependency Qt6Positioning could
[cmake] not be found.This was in your error log.
To fix it, install the Qt Positioning module.
-
@JKSH
I will not use the features about location. Could I not import this module? -
@KaiKai said in A problem that has been bothering me for 7 months:
Could I not import this module?
Qt WebEngine uses that module behind-the-scenes, so you must install it.
-
@KaiKai said in A problem that has been bothering me for 7 months:
WrapVulkanHeaders
I would recommend you use higher Qt version for example 6.4. Have a look at the bug report about Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)
https://bugreports.qt.io/browse/QTBUG-95391 -
@JKSH said in A problem that has been bothering me for 7 months:
This was in your error log.
To fix it, install the Qt Positioning module.
Following this, I fix it! Thanks