From f623a85ea29d824bbb92c112b725027bc3045242 Mon Sep 17 00:00:00 2001 From: Christopher Howard Date: Thu, 26 May 2022 22:11:28 -0400 Subject: [PATCH 1/2] Add TEST_DRIVE_BUILD_TESTING flag for including tests --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba27141..7372a54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,8 @@ project( DESCRIPTION "The simple testing framework" ) +option(TEST_DRIVE_BUILD_TESTING "Enable tests for test-drive framework" ON) + # Follow GNU conventions for installing directories include(GNUInstallDirs) @@ -96,5 +98,7 @@ install( ) # add the testsuite -enable_testing() -add_subdirectory("test") +if (TEST_DRIVE_BUILD_TESTING) + enable_testing() + add_subdirectory("test") +endif() From 58143b34fdea8365c46203a796eb185fd8c3d4f9 Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Sat, 4 Jun 2022 23:53:07 +0200 Subject: [PATCH 2/2] Also use BUILD_TESTING variable --- CMakeLists.txt | 6 ++---- config/CMakeLists.txt | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7372a54..2a8f0ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,8 +21,6 @@ project( DESCRIPTION "The simple testing framework" ) -option(TEST_DRIVE_BUILD_TESTING "Enable tests for test-drive framework" ON) - # Follow GNU conventions for installing directories include(GNUInstallDirs) @@ -98,7 +96,7 @@ install( ) # add the testsuite -if (TEST_DRIVE_BUILD_TESTING) - enable_testing() +include(CTest) +if(BUILD_TESTING AND TEST_DRIVE_BUILD_TESTING) add_subdirectory("test") endif() diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index d8fe100..e4bc2df 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -12,6 +12,7 @@ # limitations under the License. option(BUILD_SHARED_LIBS "Whether the libraries built should be shared" FALSE) +option(TEST_DRIVE_BUILD_TESTING "Enable testing for this project" ON) set( module-dir