-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
73 lines (57 loc) · 2.29 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
cmake_minimum_required(VERSION 3.9)
if (DEFINED LF_REACTOR_CPP_SUFFIX)
# the build is triggered from Lingua Franca
set(LIB_TARGET "reactor-cpp-${LF_REACTOR_CPP_SUFFIX}")
else()
set(LIB_TARGET "reactor-cpp")
endif()
project(${LIB_TARGET} LANGUAGES CXX VERSION 0.0.1)
# require C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
# Use thw new CMP0068 policy. This needs to be set explicitly to avoid a warning message
cmake_policy(SET CMP0068 NEW)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
set(BUILD_WITH_INSTALL_NAME_DIR ON)
option(REACTOR_CPP_PRINT_STATISTICS "Print statistics after execution" OFF)
option(REACTOR_CPP_TRACE "Enable tracing" OFF)
option(REACTOR_CPP_VALIDATE "Enable runtime validation" ON)
option(REACTOR_CPP_INSTALL "Install the reactor-cpp target" On)
option(REACTOR_CPP_CLANG_TIDY "Enable building with clang-tidy " On)
if (REACTOR_CPP_CLANG_TIDY AND NOT DEFINED LF_REACTOR_CPP_SUFFIX)
find_program(CLANG_TIDY clang-tidy)
if (CLANG_TIDY)
set(CMAKE_CXX_CLANG_TIDY clang-tidy; -header-filter=reactor-cpp/\(.*\)\\.hh; -warnings-as-errors=*;)
else ()
message(WARNING "Please install clang-tidy!")
endif()
endif()
find_package(Threads)
find_package(Backtrace)
set(REACTOR_CPP_USE_BACKTRACE ${Backtrace_FOUND})
set(DEFAULT_BUILD_TYPE "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
if (NOT DEFINED REACTOR_CPP_LOG_LEVEL)
set(REACTOR_CPP_LOG_LEVEL 3)
endif()
if(REACTOR_CPP_TRACE)
find_package(LTTngUST REQUIRED)
endif()
configure_file(include/reactor-cpp/config.hh.in include/reactor-cpp/config.hh @ONLY)
include(GNUInstallDirs)
add_subdirectory(lib)
if(NOT DEFINED LF_REACTOR_CPP_SUFFIX)
add_subdirectory(examples)
endif()
if (DEFINED LF_REACTOR_CPP_SUFFIX)
install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIB_TARGET}")
else()
install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
endif()