Commit 4a54d8e39e053377a877c65e897f2424b11a51e4

Edward Thomson 2021-11-17T07:27:39

cmake: enable testing at the top level Ensure that we `enable_testing()` at the top-level CMakeLists.txt or else we'll need to navigate within the build directory to the correct place in the hierarchy to run `ctest`. Now we can `ctest` at the top-level again.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 664abc0..c414bbe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -111,6 +111,7 @@ include(DefaultCFlags)
 add_subdirectory(src)
 
 if(BUILD_TESTS)
+	enable_testing()
 	add_subdirectory(tests)
 endif()
 
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index b42359a..84df92a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -68,8 +68,6 @@ function(ADD_CLAR_TEST name)
 	endif()
 endfunction(ADD_CLAR_TEST)
 
-enable_testing()
-
 add_clar_test(offline             -v -xonline)
 add_clar_test(invasive            -v -score::ftruncate -sfilter::stream::bigfile -sodb::largefiles -siterator::workdir::filesystem_gunk -srepo::init -srepo::init::at_filesystem_root)
 add_clar_test(online              -v -sonline -xonline::customcert)