generated from filipdutescu/modern-cpp-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
69 lines (55 loc) · 1.56 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
cmake_minimum_required(VERSION 3.24)
#
# Project details
#
project(stdsharp VERSION 0.9.2 LANGUAGES CXX)
include(cmake/Utils.cmake)
config_lib(${PROJECT_NAME} INTERFACE STD 23)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
#
# Model project dependencies
#
find_package(range-v3 CONFIG REQUIRED)
find_package(ctre CONFIG REQUIRED)
find_package(nameof CONFIG REQUIRED)
find_package(Microsoft.GSL CONFIG REQUIRED)
target_link_libraries(
${PROJECT_NAME}
INTERFACE range-v3::range-v3 Microsoft.GSL::GSL ctre::ctre nameof::nameof
)
verbose_message("Successfully added all dependencies and linked against them.")
target_install(${PROJECT_NAME} COMPATIBILITY SameMajorVersion DEPENDENCIES
ctre;range-v3;nameof;Microsoft.GSL
)
install(
FILES cmake/Utils.cmake
DESTINATION ${${PROJECT_NAME}_INSTALL_CMAKEDIR}/stdsharp
)
get_directory_property(is_subproject PARENT_DIRECTORY)
if(NOT is_subproject)
set(is_standalone YES)
else()
set(is_standalone NO)
endif()
include(CMakeDependentOption)
cmake_dependent_option(
${PROJECT_NAME}_BUILD_TEST
"Whether to build test"
ON
"${is_standalone}"
OFF
)
cmake_dependent_option(
${PROJECT_NAME}_INCLUDE_AS_SYSTEM
"Whether to include stdsharp headers as system headers"
OFF
"${is_standalone}"
ON
)
if(${PROJECT_NAME}_INCLUDE_AS_SYSTEM)
target_include_as_system(${PROJECT_NAME} INTERFACE)
endif()
if(${PROJECT_NAME}_BUILD_TEST)
include(CTest)
add_subdirectory(tests)
endif()