-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefaults.cmake
More file actions
57 lines (47 loc) · 1.04 KB
/
defaults.cmake
File metadata and controls
57 lines (47 loc) · 1.04 KB
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
set(TARGET tlang-defaults)
add_library(${TARGET} INTERFACE)
target_compile_features(${TARGET}
INTERFACE
c_std_11
)
target_compile_options(${TARGET}
INTERFACE
-Wall
-Wextra
-fstack-protector-strong
-fstrict-overflow
$<$<CONFIG:Debug>:
-Og
-g3
-ggdb
# -fsanitize=address,leak,undefined
>
$<$<CONFIG:Release>:
-O2
-march=native
-flto
-DNDEBUG
>
)
target_link_options(${TARGET}
INTERFACE
$<$<CONFIG:Debug>:
-Og
-g3
-ggdb
# -fsanitize=address,leak,undefined
>
$<$<CONFIG:Release>:
-O2
-march=native
-flto
>
)
# for correct color output
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(${TARGET}
INTERFACE
-fdiagnostics-color=always
)
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # to generate compile_commands.json