diff --git a/cmake/modules/TestTarget.cmake b/cmake/modules/TestTarget.cmake index 3de7c9e..203259b 100644 --- a/cmake/modules/TestTarget.cmake +++ b/cmake/modules/TestTarget.cmake @@ -8,6 +8,9 @@ if (TEST_CONFIG_DONE) endif () include(TestUtilities) +if(NOT BUILD_TESTING) + return() +endif() # find and link against CppUnit if required (used by all my projects, so it is required by default) if (NOT META_NO_CPP_UNIT) diff --git a/cmake/modules/TestUtilities.cmake b/cmake/modules/TestUtilities.cmake index 50eb2bf..89410c1 100644 --- a/cmake/modules/TestUtilities.cmake +++ b/cmake/modules/TestUtilities.cmake @@ -6,6 +6,9 @@ if (DEFINED TESTING_UTILITIES_LOADED) endif () set(TESTING_UTILITIES_LOADED YES) +# ensure CTest is loaded (e.g. for BUILD_TESTING variable) +include(CTest) + set(EXCLUDE_TEST_TARGET_BY_DEFAULT ON) if (ENABLE_DEVEL_DEFAULTS) set(EXCLUDE_TEST_TARGET_BY_DEFAULT OFF)