-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
87 lines (74 loc) · 2.69 KB
/
Copy pathCMakeLists.txt
File metadata and controls
87 lines (74 loc) · 2.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#========================================================
#
# Cross-Platform C/C++ & CMake Project Template
# (Root CMakeLists.txt Script)
#
#========================================================
# Setup CMake project
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
# Declare CMake project
project(
Project_Name_Here
VERSION 0.0.0
LANGUAGES
C CXX
)
# Include project CMake options
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/project/options.cmake)
# Include target platform characteristics
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/platform/detective.cmake)
# TODO:
# Find and replace all instances of:
# - ${PRJ_PREFIX}
# - ${PRJ_PREFIX_L}
# (exactly as is above)
#
# Replace these with your preferred project prefix (all-caps and
# lowercase). There are a lot of these so you should use search
# and replace for consistency. (220 + 150 = 370 to be exact)
#
# Delete the `PRJ_PREFIX` and `PRJ_PREFIX_L` variables defined
# below to avoid naming collisions. They are no longer necessary.
#
# Note that the build script will not work properly if you do not
# replace these placeholders first. Some placeholders are in non-
# build script files as well.
#
# You can't give the prefixes the same characters or all hell will
# break loose.
set(PRJ_PREFIX "DEMO")
set(PRJ_PREFIX_L "demo")
# You can delete the above after you have successfully replaced the
# variable names with the intended prefix literals. You'll have an
# easier time interpreting the template after the above is complete.
# Confirm this is top-level project
if (${CMAKE_PROJECT_NAME}_IS_TOP_LEVEL)
# Export compilation commands to build dir
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Include root CML helper module
include(cmake/utility/root_setup.cmake)
setup_testing_dependencies()
setup_clang_format_target()
setup_clang_tidy_target()
endif()
set(${PRJ_PREFIX}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(${PRJ_PREFIX}_CMAKE_MODULES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Include native install directory variables
include(GNUInstallDirs)
# Include compiler configuration module
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler/config_dispatch.cmake)
# Include project dependency module
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/project/dependencies.cmake)
# Include project metadata module
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/project/metadata.cmake)
# Source Subdirs
add_subdirectory(lib)
add_subdirectory(src)
# TODO: Add other project source directories...
# Confirm this is top-level project
if (${CMAKE_PROJECT_NAME}_IS_TOP_LEVEL)
# Testing sources
add_subdirectory(tests)
# Configure project build installation
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/project/install.cmake)
endif()