-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
83 lines (68 loc) · 2.04 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
cmake_minimum_required(VERSION 3.5..3.18)
# version range does not set policies until version 3.12
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(THST
DESCRIPTION "Templated hierarchical spatial trees designed for high performance and hierarchical spatial partitioning use cases."
LANGUAGES CXX
VERSION 0.1.0
HOMEPAGE_URL "https://github.com/tuxalin/THST"
)
add_library(THST INTERFACE)
add_library(THST::THST ALIAS THST)
target_include_directories(THST
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
if(CMAKE_VERSION VERSION_GREATER 3.7)
target_compile_features(THST INTERFACE cxx_std_11)
endif()
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_subdirectory(test)
endif()
include(GNUInstallDirs)
install(
TARGETS THST
EXPORT THSTTargets
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"THSTConfigVersion.cmake"
VERSION "${PROJECT_VERSION}"
COMPATIBILITY SameMajorVersion
)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake"
)
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}.pc.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc"
@ONLY
)
export(
EXPORT ${PROJECT_NAME}Targets
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE THST::
)
export(PACKAGE ${PROJECT_NAME})
install(
EXPORT ${PROJECT_NAME}Targets
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE THST::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake
)
install(
FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${PROJECT_BINARY_DIR}/THSTConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake
)
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(
DIRECTORY ${PROJECT_SOURCE_DIR}/include/THST
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})