Fix Qt 6.7.1 cmake configure error

Qt 6.7.1 Web Assembly does not have support for designer package
So we disable building the designer plugin when building for Web Assembly
This commit is contained in:
2024-05-30 18:00:20 +02:00
parent 3fc4239a37
commit 4093216db1

View File

@@ -1,31 +1,34 @@
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core Widgets UiPlugin Gui Designer) if(EMSCRIPTEN)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets UiPlugin Gui Designer) # WebAssembly specific code
else()
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core Widgets UiPlugin Gui Designer)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets UiPlugin Gui Designer)
qt_add_plugin(qwt_designer) qt_add_plugin(qwt_designer)
target_include_directories(qwt_designer target_include_directories(qwt_designer
PRIVATE PRIVATE
../src/ ../src/
${CMAKE_CURRENT_LIST_DIR}/ ${CMAKE_CURRENT_LIST_DIR}/
# ${PROJECT_BINARY_DIR}/ # ${PROJECT_BINARY_DIR}/
) )
target_compile_definitions(qwt_designer target_compile_definitions(qwt_designer
PRIVATE PRIVATE
"QWT_MOC_INCLUDE" "QWT_MOC_INCLUDE"
) )
add_definitions(-DQT_PLUGIN) add_definitions(-DQT_PLUGIN)
add_definitions(-DQT_NO_DEBUG) add_definitions(-DQT_NO_DEBUG)
add_definitions(-DQT_SHARED) add_definitions(-DQT_SHARED)
add_definitions(-DQDESIGNER_EXPORT_WIDGETS) add_definitions(-DQDESIGNER_EXPORT_WIDGETS)
target_sources(qwt_designer target_sources(qwt_designer
PRIVATE PRIVATE
qwt_designer_plugin.cpp qwt_designer_plugin.cpp
qwt_designer_plugin.qrc qwt_designer_plugin.qrc
) )
target_link_libraries(qwt_designer target_link_libraries(qwt_designer
PRIVATE PRIVATE
Qt6::Core Qt6::Core
Qt6::Gui Qt6::Gui
@@ -33,4 +36,6 @@ target_link_libraries(qwt_designer
Qt6::Widgets Qt6::Widgets
Qt6::Designer Qt6::Designer
qwt qwt
) )
endif()