-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
97 lines (76 loc) · 2.18 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
cmake_minimum_required(VERSION 3.13)
project(
dynamic_array
LANGUAGES
CXX
VERSION
1.0.0
)
set(CMAKE_CXX_STANDARD "17" CACHE STRING "Required C++ standard")
if(CMAKE_CXX_STANDARD LESS 17)
message(FATAL_ERROR "Minimum C++17 version not met!")
endif()
find_package(Boost 1.71 REQUIRED)
include(GNUInstallDirs)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
add_library(dynamic_array INTERFACE)
target_include_directories(
dynamic_array
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/sleip-${PROJECT_VERSION}>
)
target_link_libraries(dynamic_array INTERFACE Boost::headers)
include(CTest)
if (BUILD_TESTING)
include("cmake/SleipAddTest.cmake")
add_subdirectory(test)
endif()
option(
SLEIP_ADD_SUBDIRECTORY
"set(SLEIP_ADD_SUBDIRECTORY ON CACHE BOOL \"\") to disable installation rules allowing Sleip to support add_subdirectory"
OFF
)
if (SLEIP_ADD_SUBDIRECTORY)
add_library(Sleip::dynamic_array ALIAS dynamic_array)
endif()
if (NOT SLEIP_ADD_SUBDIRECTORY)
install(
TARGETS
dynamic_array
EXPORT
sleip-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(
EXPORT
sleip-targets
NAMESPACE Sleip::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/sleip-${PROJECT_VERSION}
)
install(
DIRECTORY
include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sleip-${PROJECT_VERSION}
FILES_MATCHING PATTERN "*.hpp"
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/sleip-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/cmake/sleip-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/sleip-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/sleip-${PROJECT_VERSION}
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/sleip-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/sleip-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/sleip-${PROJECT_VERSION}
)
endif()