-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
58 lines (51 loc) · 2.09 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
cmake_minimum_required(VERSION 3.25)
project(asyncpp)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(ASYNCPP_BUILD_TESTS "Build tests." ON)
option(ASYNCPP_BUILD_BENCHMARKS "Build benchmarks." ON)
option(ENABLE_LLVM_COV "Enable LLVM source-based code coverage." OFF)
option(ENABLE_LLVM_ADDRESS_SANITIZER "Enable LLVM address sanitizer." OFF)
option(ENABLE_LLVM_MEMORY_SANITIZER "Enable LLVM memory sanitizer." OFF)
option(ENABLE_LLVM_THREAD_SANITIZER "Enable LLVM thread sanitizer." OFF)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if (ENABLE_LLVM_COV)
message("Using source-based coverage")
add_compile_options("-fprofile-instr-generate" "-fcoverage-mapping" "-mllvm" "-enable-name-compression=false")
add_link_options("-fprofile-instr-generate" "-fcoverage-mapping")
endif()
file(REAL_PATH "${CMAKE_SOURCE_DIR}/sanitize_ignorelist.txt" sanitize_ignorelist)
if (ENABLE_LLVM_ADDRESS_SANITIZER)
message("Using address sanitizer")
add_compile_options("-fsanitize=address")
add_compile_options("-fsanitize-ignorelist=${sanitize_ignorelist}")
add_link_options("-fsanitize=address")
endif()
if (ENABLE_LLVM_MEMORY_SANITIZER)
message("Using memory sanitizer")
add_compile_options("-fsanitize=memory")
add_compile_options("-fsanitize-ignorelist=${sanitize_ignorelist}")
add_link_options("-fsanitize=memory")
endif()
if (ENABLE_LLVM_THREAD_SANITIZER)
message("Using thread sanitizer")
add_compile_options("-fsanitize=thread")
add_compile_options("-fsanitize-ignorelist=${sanitize_ignorelist}")
add_link_options("-fsanitize=thread")
endif()
endif()
if (${ASYNCPP_BUILD_TESTS})
add_compile_definitions(ASYNCPP_BUILD_TESTS=1)
endif()
add_subdirectory(include/asyncpp)
add_subdirectory(src)
if (${ASYNCPP_BUILD_TESTS})
add_subdirectory(test)
endif()
if (${ASYNCPP_BUILD_BENCHMARKS})
add_subdirectory(benchmark)
endif()
install(TARGETS asyncpp DESTINATION "lib")
install(DIRECTORY "include/asyncpp" DESTINATION "include")