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()