Skip to content

Commit af58b8a

Browse files
committed
Apply Beman Standard: CMAKE.SKIP_EXAMPLES + CMAKE.SKIP_TESTS
1 parent fed466b commit af58b8a

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

CMakeLists.txt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ option(BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
2727
"Make use of C++23 \"deducing this\" feature (P0847R7). Turn this off for non-conforming compilers."
2828
${COMPILER_SUPPORTS_DEDUCING_THIS})
2929

30-
option(ITERATOR_INTERFACE_ENABLE_TESTING
31-
"Enable building tests and test infrastructure" ${PROJECT_IS_TOP_LEVEL})
30+
option(ITERATOR_INTERFACE_BUILD_TESTING
31+
"Enable building tests and test infrastructure. Default: ON. Values: {ON, OFF}." ${PROJECT_IS_TOP_LEVEL})
32+
33+
option(ITERATOR_INTERFACE_BUILD_EXAMPLES
34+
"Enable building examples. Default: ON. Values: {ON, OFF}." ${PROJECT_IS_TOP_LEVEL})
3235

3336
if(BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
3437
AND NOT COMPILER_SUPPORTS_DEDUCING_THIS)
@@ -42,8 +45,8 @@ configure_file(
4245
"${PROJECT_SOURCE_DIR}/include/beman/iterator_interface/config.hpp.in"
4346
"${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp" @ONLY)
4447

45-
# Build the tests if enabled via the option ITERATOR_INTERFACE_ENABLE_TESTING
46-
if(ITERATOR_INTERFACE_ENABLE_TESTING)
48+
# Build the tests if enabled via the option ITERATOR_INTERFACE_BUILD_TESTING
49+
if(ITERATOR_INTERFACE_BUILD_TESTING)
4750
# Fetch GoogleTest
4851
FetchContent_Declare(
4952
googletest
@@ -79,11 +82,16 @@ target_include_directories(
7982
add_subdirectory(src/beman/iterator_interface)
8083
add_subdirectory(include/beman/iterator_interface)
8184

82-
add_subdirectory(examples)
83-
if(ITERATOR_INTERFACE_ENABLE_TESTING)
85+
# [CMAKE.SKIP_TESTS]
86+
if(ITERATOR_INTERFACE_BUILD_TESTING)
8487
add_subdirectory(tests/beman/iterator_interface)
8588
endif()
8689

90+
# [CMAKE.SKIP_EXAMPLES]
91+
if(ITERATOR_INTERFACE_BUILD_EXAMPLES)
92+
add_subdirectory(examples)
93+
endif()
94+
8795
# Coverage
8896
configure_file("cmake/gcovr.cfg.in" gcovr.cfg @ONLY)
8997

0 commit comments

Comments
 (0)