-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
77 lines (62 loc) · 1.96 KB
/
CMakeLists.txt
File metadata and controls
77 lines (62 loc) · 1.96 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
cmake_minimum_required(VERSION 3.10)
if(NOT DEFINED PACKAGE_VERSION)
set(PACKAGE_VERSION "1.0.0")
endif()
project("shards" VERSION ${PACKAGE_VERSION} LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(INCLUDE_INSTALL_DIR include CACHE STRING "The subdirectory where header files should be installed")
set(LIB_INSTALL_DIR lib CACHE STRING "The subdirectory where libraries should be installed")
set(BIN_INSTALL_DIR bin CACHE STRING "The subdirectory where binaries should be installed")
set(CMAKE_INSTALL_DIR lib/cmake/shards CACHE STRING "The subdirectory where CMake package config files should be installed")
include(GNUInstallDirs)
file(GLOB SHARDS_SOURCES "shards/*.cpp")
add_library(shards
shards
${SHARDS_SOURCES}
)
target_include_directories(
shards
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>"
PRIVATE
"${CMAKE_SOURCE_DIR}/ext/xxhash"
)
install(
TARGETS shards
EXPORT shards-exports
DESTINATION ${LIB_INSTALL_DIR}
)
install(
DIRECTORY "shards"
DESTINATION "${INCLUDE_INSTALL_DIR}"
FILES_MATCHING
PATTERN "*.h"
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/shards-config.cmake.in
shards-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_DIR}
PATH_VARS
INCLUDE_INSTALL_DIR
CMAKE_INSTALL_DIR
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/shards-config.cmake
DESTINATION ${CMAKE_INSTALL_DIR}
)
install(
EXPORT shards-exports
FILE shards-targets.cmake
NAMESPACE shards::
DESTINATION ${CMAKE_INSTALL_DIR}
)