17
17
# Pass the following variables to cmake to control the build:
18
18
# (See INSTALL.txt for more information)
19
19
#
20
- # -DWITH_INTERNAL_GRAPHVIZ =[true|false]
20
+ # -DKDSME_INTERNAL_GRAPHVIZ =[true|false]
21
21
# Allow to build with an external Graphviz install.
22
22
# We build with our internal graphviz sub-module but someone might want to
23
23
# build against distro package, which is not recommended and probably broken.
24
24
# Default=true
25
25
#
26
- # -WITH_STATIC_GRAPHVIZ =[true|false]
26
+ # -KDSME_STATIC_GRAPHVIZ =[true|false]
27
27
# Allow the internal Graphviz build to be statically.
28
28
# Currently shared graphviz builds on Windows have link issues.
29
29
# Default=true
30
30
#
31
- # -DBUILD_QT6 =[true|false]
31
+ # -DKDSME_QT6 =[true|false]
32
32
# Build against Qt6 rather than Qt5
33
33
# Default=false (Qt5 will be used even if Qt6 is available)
34
34
#
35
- # -DBUILD_DOCS =[true|false]
35
+ # -DKDSME_DOCS =[true|false]
36
36
# Build the documentation. Documentation is never built when cross-compiling.
37
37
# Default=true
38
38
#
39
- # -DBUILD_EXAMPLES =[true|false]
39
+ # -DKDSME_EXAMPLES =[true|false]
40
40
# Build the examples. Examples are never built when cross-compiling.
41
41
# Default=true
42
42
#
43
- # -DBUILD_TESTS =[true|false]
43
+ # -DBUILD_TESTING =[true|false]
44
44
# Build the test harness. Tests are never built when cross-compiling.
45
45
# Note: disabling tests also disables building the kdstatemachineeditor test application.
46
46
# Default=True
47
47
#
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
51
51
52
52
cmake_minimum_required (VERSION 3.16)
53
53
@@ -69,23 +69,38 @@ endif()
69
69
70
70
include (FeatureSummary)
71
71
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
+
72
87
if (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 )
76
91
else ()
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 )
80
95
endif ()
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)
83
99
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 )
89
104
90
105
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake" )
91
106
list (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)
106
121
set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" )
107
122
endif ()
108
123
109
- if (BUILD_QT6 )
124
+ if (KDSME_QT6 )
110
125
set (QT_VERSION_MAJOR 6)
111
126
set (QT_MIN_VERSION "6.1.0" )
112
127
find_package (
@@ -146,7 +161,7 @@ set_package_properties(
146
161
)
147
162
148
163
# QtXmlPatterns is removed since Qt6
149
- if (NOT BUILD_QT6 )
164
+ if (NOT KDSME_QT6 )
150
165
find_package (Qt5XmlPatterns ${QT_MIN_VERSION} CONFIG QUIET )
151
166
set_package_properties(
152
167
Qt5XmlPatterns PROPERTIES
@@ -199,7 +214,7 @@ set(LIB_INSTALL_DIR
199
214
${CMAKE_INSTALL_LIBDIR}
200
215
CACHE STRING "Library install destination."
201
216
)
202
- if (BUILD_QT6 )
217
+ if (KDSME_QT6 )
203
218
set (INCLUDE_INSTALL_ROOT ${CMAKE_INSTALL_INCLUDEDIR} /${CMAKE_PROJECT_NAME}${KDSME_LIBRARY_QTID} )
204
219
else ()
205
220
set (INCLUDE_INSTALL_ROOT ${CMAKE_INSTALL_INCLUDEDIR} /)
@@ -227,13 +242,16 @@ set(INSTALL_TARGETS_DEFAULT_ARGS
227
242
"/Applications/Qt${QT_VERSION_MAJOR} "
228
243
)
229
244
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" )
232
248
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)
235
252
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"
237
255
)
238
256
set (GRAPHVIZ_FOUND ON )
239
257
@@ -296,7 +314,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
296
314
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wextra -Woverloaded-virtual -Winit-self" )
297
315
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-include-dirs -Wunused -Wno-div-by-zero -Wundef" )
298
316
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 )
300
318
if (HAVE_GXX_GNUXX11) # QNX needs gnu++0x rather than c++0x for compiling QML V4 private headers
301
319
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x" )
302
320
elseif (HAVE_GXX_CXX11)
@@ -336,24 +354,24 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
336
354
else ()
337
355
#Always disable tests, examples, docs when used as a submodule
338
356
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 )
342
360
endif ()
343
361
344
- if (BUILD_TESTS AND NOT CMAKE_CROSSCOMPILING )
362
+ if (BUILD_TESTING AND NOT CMAKE_CROSSCOMPILING )
345
363
enable_testing ()
346
364
endif ()
347
365
348
366
set (TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR} /data)
349
367
350
368
add_subdirectory (src)
351
369
352
- if (BUILD_EXAMPLES )
370
+ if (KDSME_EXAMPLES )
353
371
add_subdirectory (examples)
354
372
endif ()
355
373
356
- if (BUILD_DOCS )
374
+ if (KDSME_DOCS )
357
375
add_subdirectory (docs)
358
376
endif ()
359
377
0 commit comments