From 7743cdc269ebad7690e59552906bd1ca3261a4e2 Mon Sep 17 00:00:00 2001 From: Edward Nolan Date: Sat, 4 Jan 2025 17:02:31 -0500 Subject: [PATCH] Bring into compliance with [CMAKE.SKIP_TESTS] section of Beman Standard This commit replaces the use of BUILD_TESTING with a BEMAN_EXAMPLE_BUILD_TESTING option that is enabled by default iff the project is not being included by another project, as recommended by the Beman Standard. --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e06dca..5af2fb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,10 +7,16 @@ project(example DESCRIPTION "An example Beman library" LANGUAGES CXX ) -include(CTest) + +option( + BEMAN_EXAMPLE_BUILD_TESTING + "Enable building tests and test infrastructure. Default: ON. Values: { ON, OFF }." + ${PROJECT_IS_TOP_LEVEL} +) add_subdirectory(src/example) -if (BUILD_TESTING) +if (BEMAN_EXAMPLE_BUILD_TESTING) + enable_testing() add_subdirectory(test/example) endif ()