Failed to find required Qt component "WebEngineWidgets". Expected Config file at "D:/QT/6.6.0/mingw_64/lib/cmake/Qt6WebEngineWidgets/Qt6WebEngineWidgetsConfig.cmake" does NOT exist
Unsolved
QtWebEngine
-
Hello !
I'm trying to create a basic QtWebEngine app. But my CMake doesn't work.
Here is the CMake:cmake_minimum_required(VERSION 3.5) project(webengine VERSION 0.1 LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS WebEngineWidgets) set(PROJECT_SOURCES main.cpp mainwindow.cpp mainwindow.h ) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(webengine MANUAL_FINALIZATION ${PROJECT_SOURCES} ) # Define target properties for Android with Qt 6 as: # set_property(TARGET main 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(webengine 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(webengine ${PROJECT_SOURCES} ) endif() endif() target_link_libraries(webengine PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) target_link_libraries(webengine PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::WebEngineWidgets) target_link_libraries(webengine PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network) set_target_properties(webengine 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 ) install(TARGETS webengine BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) if(QT_VERSION_MAJOR EQUAL 6) qt_finalize_executable(webengine) endif()
And here is the complete error:
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) -- Could NOT find Qt6WebEngineWidgets (missing: Qt6WebEngineWidgets_DIR) CMake Error at CMakeLists.txt:17 (find_package): Found package configuration file: D:/QT/6.6.0/mingw_64/lib/cmake/Qt6/Qt6Config.cmake but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT FOUND. Reason given by package: Failed to find required Qt component "WebEngineWidgets". Expected Config file at "D:/QT/6.6.0/mingw_64/lib/cmake/Qt6WebEngineWidgets/Qt6WebEngineWidgetsConfig.cmake" does NOT exist
I already search on other topics, but I didn't find anything to fix my error.
Thank you in advance,
Futuray -
WebEngine does not support MinGW. So either switch to MSVC or don't use it.
-
Ok, thank !
But, does it exit an other way to run a HTML/js code using Qt ? -
@Futuray-Programming That's what WebEngine is made for.