From bec2665741ac256e5b7b2fe549658c4d14ab0ab0 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 21 Oct 2020 00:22:22 -0400 Subject: [PATCH] Disable tests when included as subdirectory --- CMakeLists.txt | 2 ++ atdna/CMakeLists.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a199a9a..5ac11ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,6 +267,7 @@ install(EXPORT AthenaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT athena) ################ add_subdirectory(atdna) +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) # Test target add_executable(atdna-test atdna/test.cpp atdna/test.hpp) target_atdna(atdna-test atdna_test.cpp atdna/test.hpp) @@ -276,6 +277,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Switch") else() target_link_libraries(atdna-test athena-core) endif() +endif() ######### # CPack # diff --git a/atdna/CMakeLists.txt b/atdna/CMakeLists.txt index 085bb9f..e67272c 100644 --- a/atdna/CMakeLists.txt +++ b/atdna/CMakeLists.txt @@ -192,9 +192,11 @@ install(EXPORT atdnaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT atdna) # CTest # ######### +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) enable_testing() add_test(NAME test-dna COMMAND $ -o test.cpp "-I${ATHENA_INCLUDE_DIR}" ${CMAKE_SOURCE_DIR}/test.hpp) +endif() endif()