-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
74 lines (58 loc) · 1.57 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
67
68
69
70
71
72
73
74
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
# Disable in-source builds
include("cmake/PreventInSourceBuilds.cmake")
# === Include cmake modules === #
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(GenerateExportHeader)
include(CMakeDependentOption)
include(CheckCXXCompilerFlag)
include(Colors)
include(Utils)
# === Get configs === #
get_config("${CMAKE_CURRENT_SOURCE_DIR}/config.txt")
# === Set the name of project === #
project(
${P_NAME}
VERSION ${VERSION_NO}
DESCRIPTION ${P_DESCRIPTION}
HOMEPAGE_URL ${P_HOMEPAGE}
LANGUAGES CXX
)
print_config()
# === Include compiler flags === #
include(CompilerFlags)
include(InterproceduralOptimization)
# === Include checking tools === #
include(Memcheck)
include(ClangTidy)
include(CppCheck)
include(Sanitizers)
# === Check dependencies === #
include(Dependencies)
# === Include header files globally === #
include_directories(include header-only)
# === Build project === #
if(project_type STREQUAL "HEADER_ONLY")
# nothing to do here
elseif(project_type STREQUAL "LIBRARY")
add_subdirectory(src)
elseif(project_type STREQUAL "EXECUTABLE")
add_subdirectory(src)
add_subdirectory(app)
endif()
# === Tests === #
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/testsuite")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/testsuite)
endif()
# === Include other modules === #
include(Doxygen)
include(Graphviz)
include(CodeFormatting)
include(Installation)
include(Packing)
include(CTest)
# === Use this to debug cmake variables === #
#[=[
include(CmakeDebug)
write_all_variables("${CMAKE_BINARY_DIR}/var.txt")
]=]