diff --git a/CMakeLists.txt b/CMakeLists.txt index 2dde5bf2da..561467bc37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -496,7 +496,7 @@ find_package( NO_MODULE QUIET ) -if(QT_VERSION_MAJOR GREATER_EQUAL 6) +if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) find_package( Qt${QT_VERSION_MAJOR}StateMachine ${Qt${QT_VERSION_MAJOR}_VERSION} @@ -511,7 +511,7 @@ if(GAMMARAY_BUILD_DOCS) find_package(Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS Help LinguistTools) endif() -if(QT_VERSION_MAJOR GREATER_EQUAL 6) +if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -564,7 +564,7 @@ add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050500) if(WARNINGS_ARE_ERRORS) if(NOT MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=deprecated-declarations") - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND QT_VERSION_MAJOR EQUAL 5) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND ${QT_VERSION_MAJOR} EQUAL 5) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=suggest-override") # Q_OBJECT expansion warnings endif() @@ -636,7 +636,7 @@ else() set(GAMMARAY_CORE_ONLY_LAUNCHER TRUE) endif() -if(QT_VERSION_MAJOR EQUAL 5) +if(${QT_VERSION_MAJOR} EQUAL 5) add_feature_info("QtScript debugger" Qt5ScriptTools_FOUND "Requires QtScript and QtScriptTools.") endif() add_feature_info("Widget .ui file export" HAVE_QT_DESIGNER "Requires QtDesigner library.") diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 793c1fc7b5..4c51541042 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -9,9 +9,9 @@ # qdoc toolchain find_package(Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS Help) -if(QT_VERSION_MAJOR EQUAL 5) +if(${QT_VERSION_MAJOR} EQUAL 5) find_package(Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS AttributionsScannerTools) -elseif(QT_VERSION_MAJOR GREATER_EQUAL 6) +elseif(${QT_VERSION_MAJOR} GREATER_EQUAL 6) find_package(Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS ToolsTools) endif() diff --git a/docs/collection/CMakeLists.txt b/docs/collection/CMakeLists.txt index 2127779653..d391c6d17c 100644 --- a/docs/collection/CMakeLists.txt +++ b/docs/collection/CMakeLists.txt @@ -8,7 +8,7 @@ # find_package(Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS Help) -if(QT_VERSION_MAJOR GREATER_EQUAL 6) +if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) find_package(Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS ToolsTools) endif() if(NOT TARGET Qt::qhelpgenerator) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 4981ef1d05..0e2028f860 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -10,7 +10,7 @@ add_subdirectory(quick-batching) add_subdirectory(quick-event-handling) -if((QT_VERSION_MAJOR EQUAL 5) OR (QT_VERSION_MAJOR EQUAL 6 AND TARGET Qt6::StateMachine)) +if((${QT_VERSION_MAJOR} EQUAL 5) OR (${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::StateMachine)) add_subdirectory(state-machine) endif() diff --git a/examples/quick-batching/CMakeLists.txt b/examples/quick-batching/CMakeLists.txt index 645952e1ac..4cb067af2c 100644 --- a/examples/quick-batching/CMakeLists.txt +++ b/examples/quick-batching/CMakeLists.txt @@ -9,6 +9,6 @@ qml_lint(quick-batching.qml) -if(QT_VERSION_MAJOR GREATER_EQUAL 6) +if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qml_lint(Slider.qml) endif() diff --git a/launcher/cli/main.cpp b/launcher/cli/main.cpp index 54960f7793..74e22ce634 100644 --- a/launcher/cli/main.cpp +++ b/launcher/cli/main.cpp @@ -351,8 +351,8 @@ int main(int argc, char **argv) #endif return launcher.exitCode(); } else { - QObject::connect(&launcher, &Launcher::finished, &app, &QApplication::quit); - QObject::connect(&launcher, &Launcher::attached, &app, &QApplication::quit); + QObject::connect(&launcher, &Launcher::finished, &app, &QCoreApplication::quit); + QObject::connect(&launcher, &Launcher::attached, &app, &QCoreApplication::quit); } auto result = app.exec(); return result == 0 ? launcher.exitCode() : result; diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index ae5cef6692..079c3e7886 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -7,10 +7,10 @@ # Contact KDAB at for commercial licensing options. # -if(TARGET Qt5::Core) +if(${QT_VERSION_MAJOR} EQUAL 5 AND TARGET Qt5::Core) add_subdirectory(codecbrowser) endif() -if((QT_VERSION_MAJOR EQUAL 5) OR (QT_VERSION_MAJOR EQUAL 6 AND TARGET Qt6::StateMachine)) +if((${QT_VERSION_MAJOR} EQUAL 5) OR (${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::StateMachine)) add_subdirectory(statemachineviewer) else() message(STATUS "WARNING: Skipping the statemachineviewer plugin since Qt6StateMachine was not found") @@ -35,7 +35,7 @@ if(TARGET Qt::Gui) add_subdirectory(guisupport) add_subdirectory(textdocumentinspector) endif() -if(TARGET Qt5::Gui OR TARGET Qt6::OpenGL) +if((${QT_VERSION_MAJOR} EQUAL 5 AND TARGET Qt5::Gui) OR (${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::OpenGL)) add_subdirectory(openglsupport) endif() diff --git a/plugins/network/CMakeLists.txt b/plugins/network/CMakeLists.txt index 2e0e7690c4..95f9cb6a98 100644 --- a/plugins/network/CMakeLists.txt +++ b/plugins/network/CMakeLists.txt @@ -23,7 +23,10 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD) networksupportinterface.cpp networksupportinterface.h ) - if(TARGET Qt5::Network) + if(${QT_VERSION_MAJOR} EQUAL 5 AND TARGET Qt5::Network) + message("6 ${QT_VERSION_MAJOR}") + message(${QT_VERSION_MAJOR}) + message(QT_VERSION_MAJOR) list(APPEND gammaray_network_srcs networkconfigurationmodel.cpp networkconfigurationmodel.h) endif() gammaray_add_plugin( diff --git a/plugins/openglsupport/CMakeLists.txt b/plugins/openglsupport/CMakeLists.txt index 51225a41d1..0901a2ecc5 100644 --- a/plugins/openglsupport/CMakeLists.txt +++ b/plugins/openglsupport/CMakeLists.txt @@ -18,7 +18,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD) openglsupport.h ) target_link_libraries(gammaray_openglsupport gammaray_core Qt::Gui Qt::CorePrivate) - if(TARGET Qt6::OpenGL) + if(${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::OpenGL) target_link_libraries(gammaray_openglsupport Qt6::OpenGL) endif() endif() diff --git a/plugins/statemachineviewer/CMakeLists.txt b/plugins/statemachineviewer/CMakeLists.txt index 10d13596ac..64542a1f7b 100644 --- a/plugins/statemachineviewer/CMakeLists.txt +++ b/plugins/statemachineviewer/CMakeLists.txt @@ -49,7 +49,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD) if(TARGET Qt::Scxml) target_link_libraries(gammaray_statemachineviewer_plugin Qt::Scxml Qt::ScxmlPrivate) endif() - if(TARGET Qt6::StateMachine) + if(${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::StateMachine) target_link_libraries(gammaray_statemachineviewer_plugin Qt6::StateMachine Qt6::StateMachinePrivate) endif() endif() @@ -83,7 +83,7 @@ if(GAMMARAY_BUILD_UI AND GAMMARAY_WITH_KDSME) gammaray_ui ) - if(TARGET Qt6::StateMachine) + if(${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::StateMachine) target_link_libraries(gammaray_statemachineviewer_ui_plugin Qt6::StateMachine) endif() endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 69f2ee9e3f..ba96bf40fd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -445,7 +445,7 @@ target_link_libraries( fontdatabasemodeltest Qt::Gui ) -if(TARGET Qt5::Core) +if(${QT_VERSION_MAJOR} EQUAL 5 AND TARGET Qt5::Core) gammaray_add_test( codecmodeltest codecmodeltest.cpp ${CMAKE_SOURCE_DIR}/plugins/codecbrowser/codecmodel.cpp $ @@ -518,7 +518,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD) ) # only opengl rhi backend is supported atm - if(TARGET Qt6::Quick) + if(${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::Quick) set_tests_properties( quickinspectortest PROPERTIES ENVIRONMENT "QT_QUICK_BACKEND=rhi;QSG_RHI_BACKEND=opengl" ) @@ -528,7 +528,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD) quickinspectortest2 quickinspectortest2.cpp quickinspectortest.qrc $ ) target_link_libraries(quickinspectortest2 gammaray_core gammaray_quickinspector_shared Qt::Quick) - if(TARGET Qt6::Quick) + if(${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::Quick) set_tests_properties( quickinspectortest2 PROPERTIES ENVIRONMENT "QT_QUICK_BACKEND=rhi;QSG_RHI_BACKEND=opengl" ) @@ -562,7 +562,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD) gammaray_add_quick_test( quickmaterialtest quickmaterialtest.cpp quickinspectortest.qrc $ ) - if(QT_VERSION_MAJOR GREATER_EQUAL 6) + if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) find_package(Qt6ShaderTools) if(Qt6ShaderTools_FOUND) qt6_add_shaders( diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt index d4ddbafd67..928f98aefd 100644 --- a/tests/manual/CMakeLists.txt +++ b/tests/manual/CMakeLists.txt @@ -46,7 +46,7 @@ if(TARGET Qt::Widgets) add_dependencies(translator_test translator_test_qm) endif() -if(Qt5Webkit_FOUND) +if(${QT_VERSION_MAJOR} EQUAL 5 AND Qt5Webkit_FOUND) add_executable(wk1application wk1application.cpp) target_link_libraries( wk1application @@ -58,7 +58,10 @@ if(Qt5Webkit_FOUND) ) endif() -if(Qt5WebKit_FOUND AND TARGET Qt::Quick) +if(${QT_VERSION_MAJOR} EQUAL 5 + AND Qt5WebKit_FOUND + AND TARGET Qt::Quick +) set(wk2application_srcs wk2application.cpp wk2application.qrc) add_executable(wk2application ${wk2application_srcs}) target_link_libraries(wk2application Qt::Quick)