-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (47 loc) · 1.68 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
cmake_minimum_required(VERSION 3.10)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
include(Config)
project(${PROJ_NAME} VERSION ${VER} LANGUAGES C CXX)
string(COMPARE EQUAL ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} PROJECT_IS_IN_ROOT)
set(CMAKE_EXPORT_COMPILE_COMMANDS ${PROJECT_IS_IN_ROOT})
if(PROJECT_IS_IN_ROOT)
set(CMAKE_CXX_STANDARD ${CPP_STD})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message(STATUS "Project ${PROJECT_NAME}:${VER} is in root.")
endif(PROJECT_IS_IN_ROOT)
option(HAS_TESTS "Build and perform tests" ${PROJECT_IS_IN_ROOT})
option(HAS_BENCHES "Build and perform benches" ${PROJECT_IS_IN_ROOT})
option(HAS_EXAMPLES "Build and perform examples" ${PROJECT_IS_IN_ROOT})
option(HAS_CLANG_TOOLS "Build and use Clang tools" ${PROJECT_IS_IN_ROOT})
option(HAS_MSAN "Build and use Memory Sanitizer" ${PROJECT_IS_IN_ROOT})
# Includes
set(SRC_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/src/include)
include_directories(${SRC_INCLUDE_DIR})
add_subdirectory(${PROJECT_SOURCE_DIR}/src)
if(HAS_BENCHES)
include(3rdParty)
include_googletest()
include_benchmark()
message(STATUS "Building benches")
add_subdirectory(benches)
endif(HAS_BENCHES)
if(HAS_MSAN)
include(Sanitizers)
message(STATUS "Building Sanitizers")
define_sanitizer()
endif(HAS_MSAN)
if(HAS_TESTS)
include(3rdParty)
include_googletest()
message(STATUS "Building tests")
add_subdirectory(tests)
endif(HAS_TESTS)
if(HAS_EXAMPLES)
message(STATUS "Building examples")
add_subdirectory(examples)
endif(HAS_EXAMPLES)
if(HAS_CLANG_TOOLS)
include(ClangTools)
define_clang_tidy_targets()
define_clang_format_targets()
endif(HAS_CLANG_TOOLS)