-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
64 lines (51 loc) · 1.69 KB
/
CMakeLists.txt
File metadata and controls
64 lines (51 loc) · 1.69 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
57
58
59
60
61
62
63
64
cmake_minimum_required(VERSION 3.10)
project(sanitizer-tests C CXX)
# Set the searching location for cmake 'include' locations
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../..;")
include(c++-standards)
include(code-coverage)
include(formatting)
include(sanitizers)
include(tools)
include(dependency-graph)
# Require C++11
cxx_11()
# required by ALL
add_code_coverage_all_targets()
# Tools
file(GLOB_RECURSE FFILES *.[hc] *.[hc]pp)
clang_format(format ${FFILES})
cmake_format(cmake-format ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
CMakeLists.txt)
clang_tidy(-format-style=file -checks=* -header-filter='${CMAKE_SOURCE_DIR}/*')
include_what_you_use(-Xiwyu)
cppcheck(
--enable=warning,performance,portability,missingInclude
--template="[{severity}][{id}] {message} {callstack} \(On {file}:{line}\)"
--suppress=missingIncludeSystem --quiet --verbose --force)
enable_testing()
# Fails with ThreadSanitizer
add_executable(tsanFail ../src/tsan_fail.cpp)
target_code_coverage(tsanFail AUTO ALL)
if(UNIX)
target_link_libraries(tsanFail PUBLIC pthread)
endif()
add_test(tsan tsanFail)
# Fails with LeakSanitizer
add_executable(lsanFail ../src/lsan_fail.c)
target_code_coverage(lsanFail AUTO ALL)
add_test(lsan lsanFail)
# Fails with AddressSanitizer
if(USE_SANITIZER MATCHES "[Aa]ddress")
add_executable(asanFail ../src/asan_fail.cpp)
target_code_coverage(asanFail AUTO ALL)
add_test(asan asanFail)
endif()
# Fails with MemorySanitizer
add_executable(msanFail ../src/msan_fail.cpp)
target_code_coverage(msanFail AUTO ALL)
add_test(msan msanFail)
# Fails with UndefinedBehaviourSanitizer
add_executable(ubsanFail ../src/ubsan_fail.cpp)
target_code_coverage(ubsanFail AUTO ALL)
add_test(ubsan ubsanFail)