-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathCMakeLists.txt
51 lines (45 loc) · 1.24 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
cmake_minimum_required(VERSION 3.17.0)
project(libstimage C)
set(STIMAGE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(ASAN_FLAGS -fsanitize=address)
set(LSAN_FLAGS -fsanitize=leak)
if (NOT MSVC)
# Address analyzer
option(ENABLE_ASAN BOOL OFF)
if (ENABLE_ASAN)
message(STATUS "ASAN is enabled")
add_compile_options(${ASAN_FLAGS})
add_link_options(${ASAN_FLAGS})
else()
message(STATUS "ASAN is disabled")
endif()
# Leak detector
option(ENABLE_LSAN BOOL OFF)
if (ENABLE_LSAN)
message(STATUS "LSAN is enabled")
add_compile_options(${LSAN_FLAGS})
add_link_options(${LSAN_FLAGS})
else()
message(STATUS "LSAN is disabled")
endif()
endif()
option(ENABLE_WARNINGS BOOL ON)
if (ENABLE_WARNINGS)
message(STATUS "Compiler warnings enabled")
if (NOT MSVC)
add_compile_options(-Wall -Wextra)
else()
add_compile_options(-W4)
endif()
else()
message(STATUS "Compiler warnings disabled")
endif()
option(ENABLE_TESTING BOOL ON)
if (ENABLE_TESTING)
message(STATUS "Test suite will be compiled")
enable_testing()
add_subdirectory(test_c)
else()
message(STATUS "Test suite will NOT be compiled")
endif()
add_subdirectory(src)