From a1d76a4fc3df9823a5ce7bfe2f3f8632f05ac644 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 27 May 2021 20:37:47 +0300 Subject: [PATCH] Only enable tests when root project --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c8c4164f..a55f9d920 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,8 +41,10 @@ else() endif() -if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") +# Only enable tests when we're the root project +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + include(CTest) add_subdirectory(test) endif()