-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
77 lines (58 loc) · 2.19 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
cmake_minimum_required(VERSION 3.14)
# cmake_policy(SET CMP0111 OLD)
# Pilot Management System
project(PMS VERSION 1.0.1)
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
if (NOT DEFINED CMAKE_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
else ()
message(WARNING "Manually specified install rpath: ${CMAKE_INSTALL_RPATH}")
endif ()
# add the automatically determined parts of the RPATH which point to directories outside the build tree to the install
# RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Check for C++ standard and set it to C++20 if not already set
set(CMAKE_CXX_STANDARD 20)
# -------------------------------------------------------------------
# -------------------------- Begin project --------------------------
# -------------------------------------------------------------------
option(ASAN "Enable Address sanitizer" OFF)
option(TSAN "Enable Thread sanitizer" OFF)
option(DEBUG_WEBSOCKETS "Enable debug output for websocketpp" OFF)
option(ENABLE_PMS_TESTS "Enable unit test compilation" OFF)
if (ASAN)
message(STATUS "Enabling Address sanitizer")
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
if (NOT APPLE)
add_compile_options(-fsanitize=leak)
add_link_options(-fsanitize=leak)
endif ()
endif ()
if (TSAN)
message(STATUS "Enabling Thread sanitizer")
add_compile_options(-fsanitize=thread)
add_link_options(-fsanitize=thread)
endif ()
add_compile_options(-Wall -Wextra)
# cmake_policy doesn't work, any call to cmake_minimum_required resets policies
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
include(cmake/FetchDependencies.cmake)
include(cmake/InstallPrecommit.cmake)
# Get git commit sha
execute_process(
COMMAND git log -1 --format=%H
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_subdirectory(src)
if(ENABLE_PMS_TESTS)
include(CTest)
include(Catch)
add_subdirectory(testsuite)
endif()