-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
66 lines (51 loc) · 1.81 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
66
cmake_minimum_required(VERSION 3.5)
set(CMAKE_VERBOSE_MAKEFILE ON)
project(cppte VERSION 1.0.0 LANGUAGES CXX)
file(WRITE package.txt ${PROJECT_NAME})
file(WRITE version.txt ${PROJECT_VERSION})
include(cmake/GitInfo.cmake)
include(cmake/StandardProjectSettings.cmake)
include(cmake/PreventInSourceBuilds.cmake)
# variable controlling whether the build is a shared or static library
if (WIN32)
set(LIBRARY_TYPE STATIC CACHE STRING "type of library")
else()
set(LIBRARY_TYPE STATIC CACHE STRING "type of library")
endif()
# Link this 'library' to set the c++ standard / compile-time options requested
add_library(project_options INTERFACE)
target_compile_features(project_options INTERFACE cxx_std_20)
set_target_properties(project_options PROPERTIES
POSITION_INDEPENDENT_CODE ON
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON)
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
option(ENABLE_BUILD_WITH_TIME_TRACE "Enable -ftime-trace to generate time tracing .json files on clang" OFF)
if(ENABLE_BUILD_WITH_TIME_TRACE)
target_compile_options(project_options INTERFACE -ftime-trace)
endif()
endif()
# Link this 'library' to use the warnings specified in CompilerWarnings.cmake
add_library(project_warnings INTERFACE)
# enable cache system
include(cmake/Cache.cmake)
# Add linker configuration
include(cmake/Linker.cmake)
configure_linker(project_options)
# standard compiler warnings
include(cmake/CompilerWarnings.cmake)
set_project_warnings(project_warnings)
# sanitizer options if supported by compiler
include(cmake/Sanitizers.cmake)
enable_sanitizers(project_options)
# enable doxygen
include(cmake/Doxygen.cmake)
enable_doxygen()
# allow for static analysis options
include(cmake/StaticAnalyzers.cmake)
add_subdirectory(src)
#add_subdirectory(demo)
if(ENABLE_TESTING)
enable_testing()
add_subdirectory(tests)
endif()