55
66cmake_minimum_required (VERSION 3.27...3.31)
77
8- project (
9- beman.iterator_interface
10- VERSION 0.0.0
11- LANGUAGES CXX)
8+ project (beman.iterator_interface VERSION 0.0.0 LANGUAGES CXX)
129
1310# Local helpers: required to include CompilerFeatureTest.
1411list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR} /cmake" )
@@ -24,76 +21,83 @@ beman_iterator_check_deducing_this(COMPILER_SUPPORTS_DEDUCING_THIS)
2421set (TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME} Targets)
2522
2623option (
27- BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
28- "Make use of C++23 \" deducing this\" feature (P0847R7). Turn this off for non-conforming compilers."
29- ${COMPILER_SUPPORTS_DEDUCING_THIS} )
24+ BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
25+ "Make use of C++23 \" deducing this\" feature (P0847R7). Turn this off for non-conforming compilers."
26+ ${COMPILER_SUPPORTS_DEDUCING_THIS}
27+ )
3028
3129option (
32- BEMAN_ITERATOR_INTERFACE_BUILD_TESTS
33- "Enable building tests and test infrastructure. Default: ON. Values: {ON, OFF}."
34- ${PROJECT_IS_TOP_LEVEL} )
35-
36- option (BEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES
37- "Enable building examples. Default: ON. Values: {ON, OFF}."
38- ${PROJECT_IS_TOP_LEVEL} )
39-
40- if (BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
41- AND NOT COMPILER_SUPPORTS_DEDUCING_THIS)
42- message (
43- WARNING
44- "Building with C++23 \" deducing this\" feature (P0847R7) despite of the compiler's lack of actual support for it."
45- )
30+ BEMAN_ITERATOR_INTERFACE_BUILD_TESTS
31+ "Enable building tests and test infrastructure. Default: ON. Values: {ON, OFF}."
32+ ${PROJECT_IS_TOP_LEVEL}
33+ )
34+
35+ option (
36+ BEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES
37+ "Enable building examples. Default: ON. Values: {ON, OFF}."
38+ ${PROJECT_IS_TOP_LEVEL}
39+ )
40+
41+ if (
42+ BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
43+ AND NOT COMPILER_SUPPORTS_DEDUCING_THIS
44+ )
45+ message (
46+ WARNING
47+ "Building with C++23 \" deducing this\" feature (P0847R7) despite of the compiler's lack of actual support for it."
48+ )
4649endif ()
4750
4851configure_file (
49- "${PROJECT_SOURCE_DIR} /include/beman/iterator_interface/config.hpp.in"
50- "${PROJECT_BINARY_DIR} /include/beman/iterator_interface/config.hpp" @ONLY)
52+ "${PROJECT_SOURCE_DIR} /include/beman/iterator_interface/config.hpp.in"
53+ "${PROJECT_BINARY_DIR} /include/beman/iterator_interface/config.hpp"
54+ @ONLY
55+ )
5156
5257if (BEMAN_ITERATOR_INTERFACE_BUILD_TESTS)
53- # Fetch GoogleTest
54- FetchContent_Declare(
55- googletest
56- EXCLUDE_FROM_ALL
57- GIT_REPOSITORY https://github.com/google/googletest.git
58- GIT_TAG e39786088138f2749d64e9e90e0f9902daa77c40 # release-1.15.0
59- )
60- FetchContent_MakeAvailable(googletest)
58+ # Fetch GoogleTest
59+ FetchContent_Declare(
60+ googletest
61+ EXCLUDE_FROM_ALL
62+ GIT_REPOSITORY https://github.com/google/googletest.git
63+ GIT_TAG
64+ e39786088138f2749d64e9e90e0f9902daa77c40 # release-1.15.0
65+ )
66+ FetchContent_MakeAvailable(googletest)
6167endif ()
6268
6369# Create the library target and named header set for beman.iterator_interface
6470add_library (beman.iterator_interface STATIC )
6571add_library (beman::iterator_interface ALIAS beman.iterator_interface)
6672
6773target_sources (
68- beman.iterator_interface
69- PUBLIC FILE_SET
70- beman_iterator_interface_headers
71- TYPE
72- HEADERS
73- BASE_DIRS
74- ${PROJECT_BINARY_DIR} /include
75- ${PROJECT_SOURCE_DIR} /include
76- FILES
77- ${PROJECT_BINARY_DIR} /include /beman/iterator_interface/config.hpp)
74+ beman.iterator_interface
75+ PUBLIC
76+ FILE_SET beman_iterator_interface_headers
77+ TYPE HEADERS
78+ BASE_DIRS ${PROJECT_BINARY_DIR} /include ${PROJECT_SOURCE_DIR} /include
79+ FILES ${PROJECT_BINARY_DIR} /include /beman/iterator_interface/config.hpp
80+ )
7881
7982add_subdirectory (src/beman/iterator_interface)
8083add_subdirectory (include /beman/iterator_interface)
8184
8285if (BEMAN_ITERATOR_INTERFACE_BUILD_TESTS)
83- enable_testing ()
84- add_subdirectory (tests/beman/iterator_interface)
86+ enable_testing ()
87+ add_subdirectory (tests/beman/iterator_interface)
8588endif ()
8689
8790if (BEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES)
88- add_subdirectory (examples)
91+ add_subdirectory (examples)
8992endif ()
9093
9194# Coverage
9295configure_file ("cmake/gcovr.cfg.in" gcovr.cfg @ONLY)
9396
9497add_custom_target (
95- process_coverage
96- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
97- COMMENT "Running gcovr to process coverage results"
98- COMMAND mkdir -p coverage
99- COMMAND gcovr --config gcovr.cfg .)
98+ process_coverage
99+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
100+ COMMENT "Running gcovr to process coverage results"
101+ COMMAND mkdir -p coverage
102+ COMMAND gcovr --config gcovr.cfg .
103+ )
0 commit comments