-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
86 lines (65 loc) · 2.37 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
cmake_minimum_required(VERSION 3.13...3.19)
project(DContainers
VERSION 0.1
LANGUAGES CXX
DESCRIPTION "Multi-dimensional containers for C++"
HOMEPAGE_URL "https://github.com/nR3D/DContainers")
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake)
add_library(DContainers
INTERFACE
include/DContainers/DArray.hpp
include/DContainers/DVector.hpp
include/DContainers/Span/Spanning.hpp
include/DContainers/Span/DSpanning.hpp
include/DContainers/Span.hpp)
# Add an alias so that library can be used inside the build tree, e.g. when testing
add_library(DContainers::DContainers ALIAS DContainers)
#Set target properties
target_include_directories(DContainers
INTERFACE
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
target_compile_features(DContainers INTERFACE cxx_std_20)
# --- Installation instructions ---
include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/DContainers)
install(TARGETS DContainers
EXPORT DContainers-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT DContainers-targets
FILE
DContainersTargets.cmake
NAMESPACE
DContainers::
DESTINATION
${INSTALL_CONFIGDIR}
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/DContainersConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/DContainersConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/DContainersConfig.cmake
INSTALL_DESTINATION ${INSTALL_CONFIGDIR}
)
# Install configuration files
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/DContainersConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/DContainersConfigVersion.cmake
DESTINATION ${INSTALL_CONFIGDIR}
)
# --- Export ---
export(EXPORT DContainers-targets
FILE ${CMAKE_CURRENT_BINARY_DIR}/DContainersTargets.cmake
NAMESPACE DContainers::)
# Register package in the User Package Registry
export(PACKAGE DContainers)
# --- Enable Testing ---
enable_testing()
add_subdirectory(test)