-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
66 lines (50 loc) · 1.94 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
59
60
61
62
63
64
65
cmake_minimum_required(VERSION 3.12)
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif (CCACHE_FOUND)
set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_SOURCE_DIR}/cmake/toolchain/cxx17.cmake"
CACHE FILEPATH "Default toolchain"
)
include("cmake/3rdparty_utils.cmake")
cmake_policy(SET CMP0048 NEW)
project(soralog VERSION 0.0.7 LANGUAGES CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(TESTING "Build tests" ON)
option(EXAMPLES "Build examples" ON)
option(CLANG_FORMAT "Enable clang-format target" OFF)
option(CLANG_TIDY "Enable clang-tidy checks during compilation" OFF)
option(COVERAGE "Enable generation of coverage info" OFF)
# Sanitizers enables only for this project, and will be disabled for dependencies
option(ASAN "Enable address sanitizer" OFF)
option(LSAN "Enable leak sanitizer" OFF)
option(MSAN "Enable memory sanitizer" OFF)
option(TSAN "Enable thread sanitizer" OFF)
option(UBSAN "Enable UB sanitizer" OFF)
# the property is out of "if TESTING" scope due to addtest func is out too
set_property(GLOBAL PROPERTY TEST_TARGETS)
include(cmake/functions.cmake)
include(cmake/toolchain/compiler.cmake)
include(cmake/toolchain/cxx17.cmake)
include(cmake/dependencies.cmake)
include(cmake/sanitizers.cmake)
if(CLANG_TIDY)
# Must be included before creating any target
include(cmake/clang-tidy.cmake)
endif()
if(CLANG_FORMAT)
include(cmake/clang-format.cmake)
endif()
add_subdirectory(src)
if(TESTING OR COVERAGE)
enable_testing()
add_subdirectory(test)
endif()
if(EXAMPLES)
add_subdirectory(example)
endif()
if (COVERAGE)
include(cmake/coverage.cmake)
endif ()