Skip to content

Commit

Permalink
buildsystem - improvements for building statemachineviewer plugin
Browse files Browse the repository at this point in the history
add_subdirectory(statemachineviewer) if:
 * Qt5
or
 * Qt6 and QtStateMachine
  • Loading branch information
Allen Winter committed Nov 13, 2023
1 parent 60dc736 commit 8921c0a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion plugins/statemachineviewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 8921c0a

Please sign in to comment.