-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
48 lines (38 loc) · 982 Bytes
/
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
cmake_minimum_required(VERSION 2.8.12.2)
project(clib C CXX)
option(USE_ASAN "Build application with clang Address Sanitizer" OFF)
find_package(GTest REQUIRED)
find_package(Threads REQUIRED)
add_compile_options(
"-Wall"
"-pedantic"
"-std=c++1z"
)
if (USE_ASAN)
message("Address Sanitizer is enabled.")
add_compile_options(
"-fsanitize=address"
"-fno-omit-frame-pointer"
)
endif()
include_directories(
${GTEST_INCLUDE_DIRS}
)
function(clib_add_executable executable)
add_executable(${executable} ${ARGN})
if (USE_ASAN)
target_link_libraries(${executable} "-fsanitize=address")
endif()
endfunction()
function(clib_add_unittest executable)
clib_add_executable(${executable} ${ARGN})
target_link_libraries(${executable}
${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
endfunction()
function(clib_add_library library)
add_library(${library} STATIC ${ARGN})
endfunction()
add_subdirectory(algo)
add_subdirectory(benchmarks)