1717# Pass the following variables to cmake to control the build:
1818# (See INSTALL.txt for more information)
1919#
20- # -DWITH_INTERNAL_GRAPHVIZ =[true|false]
20+ # -DKDSME_INTERNAL_GRAPHVIZ =[true|false]
2121# Allow to build with an external Graphviz install.
2222# We build with our internal graphviz sub-module but someone might want to
2323# build against distro package, which is not recommended and probably broken.
2424# Default=true
2525#
26- # -WITH_STATIC_GRAPHVIZ =[true|false]
26+ # -KDSME_STATIC_GRAPHVIZ =[true|false]
2727# Allow the internal Graphviz build to be statically.
2828# Currently shared graphviz builds on Windows have link issues.
2929# Default=true
3030#
31- # -DBUILD_QT6 =[true|false]
31+ # -DKDSME_QT6 =[true|false]
3232# Build against Qt6 rather than Qt5
3333# Default=false (Qt5 will be used even if Qt6 is available)
3434#
35- # -DBUILD_DOCS =[true|false]
35+ # -DKDSME_DOCS =[true|false]
3636# Build the documentation. Documentation is never built when cross-compiling.
3737# Default=true
3838#
39- # -DBUILD_EXAMPLES =[true|false]
39+ # -DKDSME_EXAMPLES =[true|false]
4040# Build the examples. Examples are never built when cross-compiling.
4141# Default=true
4242#
43- # -DBUILD_TESTS =[true|false]
43+ # -DBUILD_TESTING =[true|false]
4444# Build the test harness. Tests are never built when cross-compiling.
4545# Note: disabling tests also disables building the kdstatemachineeditor test application.
4646# Default=True
4747#
48- # -DBUILD_STATIC =[true|false]
49- # Build static libraries
50- # Default=false
48+ # -DBUILD_SHARED_LIBS =[true|false]
49+ # Build shared libraries
50+ # Default=true
5151
5252cmake_minimum_required (VERSION 3.16)
5353
@@ -69,23 +69,38 @@ endif()
6969
7070include (FeatureSummary)
7171
72+ # Declare an option as renamed, and eventually update the old cache entry
73+ function (renamed_option _old _new)
74+ get_property (
75+ _old_set
76+ CACHE ${_old}
77+ PROPERTY VALUE
78+ SET
79+ )
80+ if (_old_set)
81+ message (DEPRECATION "\" ${_old} \" was renamed \" ${_new} \" . Cache entry will be updated." )
82+ set_property (CACHE ${_new} PROPERTY VALUE ${${_old} })
83+ unset (${_old} CACHE )
84+ endif ()
85+ endfunction ()
86+
7287if (CMAKE_CROSSCOMPILING )
73- set (BUILD_DOCS OFF )
74- set (BUILD_EXAMPLES OFF )
75- set (BUILD_TESTS OFF )
88+ set (KDSME_DOCS OFF )
89+ set (KDSME_EXAMPLES OFF )
90+ set (BUILD_TESTING OFF )
7691else ()
77- option (BUILD_DOCS "Build KDStateMachineEditor documentation" ON )
78- option (BUILD_EXAMPLES "Build examples directory" ON )
79- option (BUILD_TESTS "Build the test harness" ON )
92+ option (KDSME_DOCS "Build KDStateMachineEditor documentation" ON )
93+ option (KDSME_EXAMPLES "Build examples directory" ON )
94+ option (BUILD_TESTING "Build the test harness" ON )
8095endif ()
81- option (BUILD_QT6 "Build against Qt 6" OFF )
82- option (BUILD_STATIC "Build statically" OFF )
96+ renamed_option(BUILD_DOCS KDSME_DOCS)
97+ renamed_option(BUILD_EXAMPLES KDSME_EXAMPLES)
98+ renamed_option(BUILD_TESTS BUILD_TESTING)
8399
84- if (BUILD_STATIC)
85- set (BUILD_LIBRARY_MODE "STATIC" )
86- else ()
87- set (BUILD_LIBRARY_MODE "SHARED" )
88- endif ()
100+ option (KDSME_QT6 "Build against Qt 6" OFF )
101+ renamed_option(BUILD_QT6 KDSME_QT6)
102+
103+ option (BUILD_SHARED_LIBS "Build shared libraries" ON )
89104
90105list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake" )
91106list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake/ECM/modules" )
@@ -106,7 +121,7 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
106121 set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" )
107122endif ()
108123
109- if (BUILD_QT6 )
124+ if (KDSME_QT6 )
110125 set (QT_VERSION_MAJOR 6)
111126 set (QT_MIN_VERSION "6.1.0" )
112127 find_package (
@@ -146,7 +161,7 @@ set_package_properties(
146161)
147162
148163# QtXmlPatterns is removed since Qt6
149- if (NOT BUILD_QT6 )
164+ if (NOT KDSME_QT6 )
150165 find_package (Qt5XmlPatterns ${QT_MIN_VERSION} CONFIG QUIET )
151166 set_package_properties(
152167 Qt5XmlPatterns PROPERTIES
@@ -199,7 +214,7 @@ set(LIB_INSTALL_DIR
199214 ${CMAKE_INSTALL_LIBDIR}
200215 CACHE STRING "Library install destination."
201216)
202- if (BUILD_QT6 )
217+ if (KDSME_QT6 )
203218 set (INCLUDE_INSTALL_ROOT ${CMAKE_INSTALL_INCLUDEDIR} /${CMAKE_PROJECT_NAME}${KDSME_LIBRARY_QTID} )
204219else ()
205220 set (INCLUDE_INSTALL_ROOT ${CMAKE_INSTALL_INCLUDEDIR} /)
@@ -227,13 +242,16 @@ set(INSTALL_TARGETS_DEFAULT_ARGS
227242 "/Applications/Qt${QT_VERSION_MAJOR} "
228243)
229244
230- option (WITH_INTERNAL_GRAPHVIZ "Enable internal build of external project Graphviz" ON )
231- add_feature_info("Internal build of Graphviz" WITH_INTERNAL_GRAPHVIZ "disable with WITH_INTERNAL_GRAPHVIZ=OFF" )
245+ option (KDSME_INTERNAL_GRAPHVIZ "Enable internal build of external project Graphviz" ON )
246+ renamed_option(WITH_INTERNAL_GRAPHVIZ KDSME_INTERNAL_GRAPHVIZ)
247+ add_feature_info("Internal build of Graphviz" KDSME_INTERNAL_GRAPHVIZ "disable with KDSME_INTERNAL_GRAPHVIZ=OFF" )
232248
233- if (WITH_INTERNAL_GRAPHVIZ)
234- option (WITH_STATIC_GRAPHVIZ "Enable static build of Graphviz when internally building" ON )
249+ if (KDSME_INTERNAL_GRAPHVIZ)
250+ option (KDSME_STATIC_GRAPHVIZ "Enable static build of Graphviz when internally building" ON )
251+ renamed_option(WITH_STATIC_GRAPHVIZ KDSME_STATIC_GRAPHVIZ)
235252 add_feature_info(
236- "Statically build Graphviz for internal builds" WITH_INTERNAL_GRAPHVIZ "disable with WITH_STATIC_GRAPHVIZ=OFF"
253+ "Statically build Graphviz for internal builds" KDSME_INTERNAL_GRAPHVIZ
254+ "disable with KDSME_STATIC_GRAPHVIZ=OFF"
237255 )
238256 set (GRAPHVIZ_FOUND ON )
239257
@@ -296,7 +314,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
296314 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wextra -Woverloaded-virtual -Winit-self" )
297315 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-include-dirs -Wunused -Wno-div-by-zero -Wundef" )
298316 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wmissing-noreturn -Werror=return-type -Wswitch" )
299- if (NOT BUILD_QT6 )
317+ if (NOT KDSME_QT6 )
300318 if (HAVE_GXX_GNUXX11) # QNX needs gnu++0x rather than c++0x for compiling QML V4 private headers
301319 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x" )
302320 elseif (HAVE_GXX_CXX11)
@@ -336,24 +354,24 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
336354else ()
337355 #Always disable tests, examples, docs when used as a submodule
338356 set (${PROJECT_NAME} _IS_ROOT_PROJECT FALSE )
339- set (BUILD_TESTS FALSE )
340- set (BUILD_EXAMPLES FALSE )
341- set (BUILD_DOCS FALSE )
357+ set (BUILD_TESTING FALSE )
358+ set (KDSME_EXAMPLES FALSE )
359+ set (KDSME_DOCS FALSE )
342360endif ()
343361
344- if (BUILD_TESTS AND NOT CMAKE_CROSSCOMPILING )
362+ if (BUILD_TESTING AND NOT CMAKE_CROSSCOMPILING )
345363 enable_testing ()
346364endif ()
347365
348366set (TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR} /data)
349367
350368add_subdirectory (src)
351369
352- if (BUILD_EXAMPLES )
370+ if (KDSME_EXAMPLES )
353371 add_subdirectory (examples)
354372endif ()
355373
356- if (BUILD_DOCS )
374+ if (KDSME_DOCS )
357375 add_subdirectory (docs)
358376endif ()
359377
0 commit comments