From 8921c0a9bb31b26b3d5a1a32bdae136765d182a5 Mon Sep 17 00:00:00 2001 From: Allen Winter Date: Sat, 11 Nov 2023 06:31:55 -0500 Subject: [PATCH] buildsystem - improvements for building statemachineviewer plugin add_subdirectory(statemachineviewer) if: * Qt5 or * Qt6 and QtStateMachine --- CMakeLists.txt | 6 +++--- plugins/CMakeLists.txt | 6 +++++- plugins/statemachineviewer/CMakeLists.txt | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3527c7371..b609cc23dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -476,6 +476,9 @@ find_package(Qt${QT_VERSION_MAJOR}IviCore 1.1 NO_MODULE QUIET) # 1.1 is based on find_package(Qt${QT_VERSION_MAJOR}IviVehicleFunctions 1.1 NO_MODULE QUIET) find_package(Qt${QT_VERSION_MAJOR}IviMedia 1.1 NO_MODULE QUIET) find_package(Qt${QT_VERSION_MAJOR}Scxml 5.8 NO_MODULE QUIET) +if(QT_VERSION_MAJOR GREATER_EQUAL 6) + find_package(Qt${QT_VERSION_MAJOR}StateMachine NO_MODULE QUIET) +endif() # if translation/doc host tools are missing, the Qt5 cmake config files throw errors... if(GAMMARAY_BUILD_DOCS) @@ -493,9 +496,6 @@ if(QT_VERSION_MAJOR GREATER_EQUAL 6) # prevent 'file too big' and 'too many sections' errors with Qt6 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj") endif() - find_package(Qt${QT_VERSION_MAJOR}StateMachine NO_MODULE QUIET) -else() - find_package(Qt${QT_VERSION_MAJOR}Scxml 5.8 NO_MODULE QUIET) endif() # these need to included after the last Qt-related find_package() call diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 107300c508..c61735d9ee 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -9,7 +9,11 @@ if(TARGET Qt5::Core) add_subdirectory(codecbrowser) endif() -add_subdirectory(statemachineviewer) +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") +endif() add_subdirectory(eventmonitor) add_subdirectory(fontbrowser) add_subdirectory(kjobtracker) diff --git a/plugins/statemachineviewer/CMakeLists.txt b/plugins/statemachineviewer/CMakeLists.txt index 962a33a78c..b5de53e315 100644 --- a/plugins/statemachineviewer/CMakeLists.txt +++ b/plugins/statemachineviewer/CMakeLists.txt @@ -83,7 +83,7 @@ if(GAMMARAY_BUILD_UI AND ${KDSME_PACKAGE_NAME}_FOUND) gammaray_ui ) - if(QT_VERSION_MAJOR GREATER_EQUAL 6) + if(TARGET Qt6::StateMachine) target_link_libraries(gammaray_statemachineviewer_ui_plugin Qt6::StateMachine) endif() endif()