-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
54 lines (46 loc) · 1.06 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
cmake_minimum_required(VERSION 3.21)
#
# Set the project name and version
#
project(CoolProject VERSION 1.0)
set(CMAKE_C_STANDARD 23)
set(CMAKE_C_STANDARD_REQUIRED True)
set(CMAKE_C_CLANG_TIDY clang-tidy)
#
# Compiler options
#
add_compile_options(
-Wall
-Wextra
-Wcast-qual
-Wconversion
-Wno-sign-conversion
-g3
-O0
$<$<CONFIG:RELEASE>:-g0> # overwrites -g3
$<$<CONFIG:RELEASE>:-O3> # overwrites -O0
$<$<CONFIG:ASAN>:-fsanitize=address>
$<$<CONFIG:ASAN>:-fno-omit-frame-pointer>
$<$<CONFIG:UBSAN>:-fsanitize=undefined>
$<$<CONFIG:UBSAN>:-fno-omit-frame-pointer>
$<$<CONFIG:TSAN>:-fsanitize=thread>)
add_link_options(
-pthread $<$<CONFIG:ASAN>:-fsanitize=address>
$<$<CONFIG:UBSAN>:-fsanitize=undefined> $<$<CONFIG:TSAN>:-fsanitize=thread>)
#
# Add `DEBUG` symbol when not in release mode
#
add_compile_definitions($<$<NOT:$<CONFIG:RELEASE>>:DEBUG>)
#
# Build Libraries
#
add_subdirectory(src)
#
# Build the Executable
#
add_executable(main apps/main.c)
target_link_libraries(main PUBLIC modern)
#
# Build Tests
#
add_subdirectory(tests)