From b0e065e2ef27d49dfbb5180ead28454549b016f4 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Wed, 1 Dec 2021 15:36:08 +0100 Subject: [PATCH] default to BUILD_TESTING=ON if the engine is built as a root project --- CMakeLists.txt | 10 ++++++---- framework/common_components/CMakeLists.txt | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fc99e7..4675c97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,12 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +# enable test +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + include(CTest) + #enable_testing() +endif() + include("${CMAKE_CURRENT_LIST_DIR}/mm_options_and_defines.cmake") # external libs @@ -47,10 +53,6 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") endif() endif() -if (BUILD_TESTING) - enable_testing() -endif() - # cmake setup end # MM code diff --git a/framework/common_components/CMakeLists.txt b/framework/common_components/CMakeLists.txt index ef21f4d..042709c 100644 --- a/framework/common_components/CMakeLists.txt +++ b/framework/common_components/CMakeLists.txt @@ -25,4 +25,3 @@ if(BUILD_TESTING) add_subdirectory(test) endif() -