From a543065d61ec5fdc8cfd03205dfd0093acd6a8b2 Mon Sep 17 00:00:00 2001 From: Johannes Kauffmann <19662702+JohannesKauffmann@users.noreply.github.com> Date: Wed, 3 Aug 2022 10:26:07 +0000 Subject: [PATCH] Use enable_testing() in toplevel CMakeLists.txt This allows for using ctest (-V) for running the testsuite, instead of manually calling the test executable. enable_testing() should be in the toplevel CMakeLists.txt, according to the documentation [1]. [1]. https://cmake.org/cmake/help/latest/command/enable_testing.html --- CMakeLists.txt | 2 +- test/CMakeLists.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 397ef55..08eee71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,6 @@ if (EXAMPLE_ENABLED) endif() if (TEST_ENABLED) + enable_testing() add_subdirectory(test) endif() - diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 557bc15..6a28f14 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,3 @@ -enable_testing() include_directories("${CMAKE_SOURCE_DIR}/src") include_directories("${CMAKE_SOURCE_DIR}/test") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")