-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
86 lines (73 loc) · 1.91 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
84
85
86
# project options
cmake_minimum_required(VERSION 3.14)
project(wifi-telemetry CXX)
# c++ standard options
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# allow setting target_link_libraries() from any dir
cmake_policy(SET CMP0079 NEW)
# define option for use of Microsoft tracelogging
option(
ENABLE_MS_LTTNG_EXTENSIONS
"Enable use of Microsoft tracelogging extensions for LTTNG"
OFF
)
# define option to build hostap dev dependency in-tree
option(
BUILD_HOSTAP_EXTERNAL
"Build wpa_supplicant/hostapd from built-in external source"
ON
)
# define option to build sdbus-c++ dev dependency in-tree
option(
BUILD_SDBUS_CPP_EXTERNAL
"Build sdbus-c++ from built-in external source"
ON
)
include(ExternalProject)
include(GNUInstallDirs)
include(CheckPIESupported)
include(cmake/find_wpa_client.cmake)
include(cmake/find_systemd.cmake)
include(cmake/FindLTTngUST.cmake)
include(cmake/find_pthreads.cmake)
include(cmake/find_sdbus-cpp.cmake)
if (ENABLE_MS_LTTNG_EXTENSIONS)
include(cmake/find_tracelogging.cmake)
endif()
check_pie_supported()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# compilation options
add_compile_options(
-Wall
-Wshadow
-Wformat-security
-Werror
-Wextra
-Wpedantic
-Wconversion
)
if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options(
-fstack-protector
-fvisibility=hidden
)
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
add_compile_options(
-fstack-clash-protection
-fstack-protector-all
-fvisibility=hidden
-Wl,-z,noexecstack
-Wl,-z,now
-Wl,-z,relro
)
endif()
if (CMAKE_BUILD_TYPE MATCHES "(Release|RelWithDebInfo|MinSizeRel)")
add_compile_definitions(_FORTIFY_SOURCE=2)
endif()
if (ENABLE_MS_LTTNG_EXTENSIONS)
add_compile_definitions(TRACE_USE_TRACELOGGING)
endif()
include_directories(include)
add_subdirectory(src)