-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
79 lines (64 loc) · 1.62 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
cmake_minimum_required(VERSION 3.10)
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project(terse-lambda
VERSION 1.0.0
LANGUAGES CXX
DESCRIPTION "Terse lambdas for C++"
)
include(is_root)
is_root(is_root_project)
option(BUILD_TESTING "Build tests" ON)
if(BUILD_TESTING)
enable_testing()
endif()
# Target
add_library(tl INTERFACE)
add_library(tl::tl ALIAS tl)
target_include_directories(tl
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_compile_features(tl
INTERFACE
cxx_std_20
)
# Tests
if(BUILD_TESTING AND "${is_root_project}")
enable_testing()
add_subdirectory(tests)
endif()
# Install
include(GNUInstallDirs)
set(INSTALL_CONFIGDIR "${CMAKE_INSTALL_LIBDIR}/cmake/tl")
install(TARGETS tl
EXPORT tl-targets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
install(EXPORT tl-targets
FILE tl-targets.cmake
NAMESPACE tl::
DESTINATION "${INSTALL_CONFIGDIR}"
)
install(DIRECTORY include/
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
include(CMakePackageConfigHelpers)
# Not architecture sensitive
set(CMAKE_SIZEOF_VOID_P)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/tlConfigVersion.cmake"
VERSION "${PROJECT_VERSION}"
COMPATIBILITY SameMajorVersion
)
configure_package_config_file(
cmake/tlConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/tlConfig.cmake"
INSTALL_DESTINATION "${INSTALL_CONFIGDIR}"
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/tlConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/tlConfigVersion.cmake"
DESTINATION "${INSTALL_CONFIGDIR}"
)