-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
90 lines (72 loc) · 2.47 KB
/
CMakeLists.txt
File metadata and controls
90 lines (72 loc) · 2.47 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
78
79
80
81
82
83
84
85
86
87
88
89
90
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
cmake_minimum_required(VERSION 3.30...4.3)
project(
beman.iterator_interface
DESCRIPTION "iterator creation mechanisms"
LANGUAGES CXX
VERSION 0.1.0
)
# Local helpers: required to include CompilerFeatureTest.
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
# Includes
include(CompilerFeatureTest)
# Prechecks.
beman_iterator_check_deducing_this(COMPILER_SUPPORTS_DEDUCING_THIS)
option(
BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
"Make use of C++23 \"deducing this\" feature (P0847R7). Turn this off for non-conforming compilers."
${COMPILER_SUPPORTS_DEDUCING_THIS}
)
# [CMAKE.SKIP_TESTS]
option(
BEMAN_ITERATOR_INTERFACE_BUILD_TESTS
"Enable building tests and test infrastructure. Default: ${PROJECT_IS_TOP_LEVEL}. Values: { ON, OFF }."
${PROJECT_IS_TOP_LEVEL}
)
# [CMAKE.SKIP_EXAMPLES]
option(
BEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES
"Enable building examples. Default: ${PROJECT_IS_TOP_LEVEL}. Values: { ON, OFF }."
${PROJECT_IS_TOP_LEVEL}
)
if(
BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
AND NOT COMPILER_SUPPORTS_DEDUCING_THIS
)
message(
WARNING
"Building with C++23 \"deducing this\" feature (P0847R7) despite of the compiler's lack of actual support for it."
)
endif()
configure_file(
"${PROJECT_SOURCE_DIR}/include/beman/iterator_interface/config_generated.hpp.in"
"${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config_generated.hpp"
@ONLY
)
# for find of beman_install_library and configure_build_telemetry
include(infra/cmake/beman-install-library.cmake)
include(infra/cmake/BuildTelemetryConfig.cmake)
add_library(beman.iterator_interface INTERFACE)
add_library(beman::iterator_interface ALIAS beman.iterator_interface)
target_sources(
beman.iterator_interface
PUBLIC
FILE_SET HEADERS
BASE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_BINARY_DIR}/include"
)
set_target_properties(
beman.iterator_interface
PROPERTIES VERIFY_INTERFACE_HEADER_SETS ${PROJECT_IS_TOP_LEVEL}
)
add_subdirectory(include/beman/iterator_interface)
beman_install_library(beman.iterator_interface TARGETS beman.iterator_interface)
configure_build_telemetry()
if(BEMAN_ITERATOR_INTERFACE_BUILD_TESTS)
enable_testing()
add_subdirectory(tests/beman/iterator_interface)
endif()
if(BEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()