forked from ryanhaining/cppitertools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
42 lines (33 loc) · 1.4 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
cmake_minimum_required(VERSION 3.12)
project(cppitertools VERSION 2.0)
# installation directories
set(cppitertools_INSTALL_INCLUDE_DIR "include" CACHE STRING "The installation include directory")
set(cppitertools_INSTALL_CMAKE_DIR "share" CACHE STRING "The installation cmake directory")
# define a header-only library
add_library(cppitertools INTERFACE)
add_library(cppitertools::cppitertools ALIAS cppitertools)
target_include_directories(cppitertools INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${cppitertools_INSTALL_INCLUDE_DIR}>)
# require C++17
target_compile_features(cppitertools INTERFACE cxx_std_17)
# Make package findable
configure_file(cmake/dummy-config.cmake.in cppitertools-config.cmake @ONLY)
# Enable version checks in find_package
include(CMakePackageConfigHelpers)
write_basic_package_version_file(cppitertools-config-version.cmake COMPATIBILITY SameMajorVersion)
# install and export target
install(
TARGETS cppitertools
EXPORT cppitertools-targets)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cppitertools
DESTINATION ${cppitertools_INSTALL_INCLUDE_DIR})
install(
EXPORT cppitertools-targets
FILE cppitertools-config.cmake
NAMESPACE cppitertools::
DESTINATION ${cppitertools_INSTALL_CMAKE_DIR}/cppitertools)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/cppitertools-config-version.cmake
DESTINATION ${cppitertools_INSTALL_CMAKE_DIR}/cppitertools)