-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
83 lines (66 loc) · 2.72 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
cmake_minimum_required(VERSION 3.18)
project(cpp_statemachine_generator)
include(ExternalProject)
include(GNUInstallDirs REQUIRED)
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
add_executable(${CMAKE_PROJECT_NAME}
"test/XmiFsm.cxx"
"test/XmiFsmImpl.cxx"
"test/ScXmlFsm.cxx"
"test/ScXmlFsmImpl.cxx"
"test/main.cxx"
)
ExternalProject_Add(cpp_event_framework
GIT_REPOSITORY https://github.com/dziegel/cpp_event_framework.git
GIT_TAG main
STEP_TARGETS build
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}
)
add_dependencies(${CMAKE_PROJECT_NAME}
cpp_event_framework
)
target_link_options(${CMAKE_PROJECT_NAME}
PRIVATE
-Xlinker -Map=map.txt
)
target_include_directories(${CMAKE_PROJECT_NAME}
PUBLIC
${CMAKE_BINARY_DIR}/include
)
target_compile_options(${CMAKE_PROJECT_NAME}
PRIVATE
-std=c++20
-Werror
-pedantic
-Wall
-Wextra
-Wcast-qual
-Wwrite-strings
-Wtrampolines
-Wvla
-Wshadow
-Wmissing-include-dirs
-Wfloat-equal
-Wundef
-Wcast-align
# Gnu specific warnings
# for all versions of GCC
$<$<CXX_COMPILER_ID:GNU>:-Wlogical-op>
$<$<CXX_COMPILER_ID:GNU>:-Wduplicated-cond>
# for GCC version >= 7
$<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,7>>:-Walloc-zero>
$<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,7>>:-Wduplicated-branches>
# for GCC version >= 8
$<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,8>>:-Wcast-align=strict>
# for GCC version >= 10
$<$<AND:$<COMPILE_LANG_AND_ID:CXX,GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,10>>:-Wextra-semi>
$<$<AND:$<COMPILE_LANG_AND_ID:CXX,GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,10>>:-Wcatch-value>
$<$<AND:$<COMPILE_LANG_AND_ID:CXX,GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,10>>:-Wzero-as-null-pointer-constant>
$<$<AND:$<COMPILE_LANG_AND_ID:CXX,GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,10>>:-Wstrict-null-sentinel>
$<$<AND:$<COMPILE_LANG_AND_ID:CXX,GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,10>>:-Wvirtual-inheritance>
$<$<AND:$<COMPILE_LANG_AND_ID:CXX,GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,10>>:-Wmismatched-tags>
$<$<AND:$<COMPILE_LANG_AND_ID:CXX,GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,10>>:-Wctor-dtor-privacy>
$<$<AND:$<COMPILE_LANG_AND_ID:CXX,GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,10>>:-Wsuggest-override>
$<$<AND:$<COMPILE_LANG_AND_ID:CXX,GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,10>>:-Wold-style-cast>
$<$<AND:$<COMPILE_LANG_AND_ID:CXX,GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,10>>:-Wmultiple-inheritance>
)