Disable tests when included as subdirectory

This commit is contained in:
Luke Street 2020-10-21 00:22:22 -04:00
parent b690d4d7da
commit bec2665741
2 changed files with 4 additions and 0 deletions

View File

@ -267,6 +267,7 @@ install(EXPORT AthenaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT athena)
################ ################
add_subdirectory(atdna) add_subdirectory(atdna)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
# Test target # Test target
add_executable(atdna-test atdna/test.cpp atdna/test.hpp) add_executable(atdna-test atdna/test.cpp atdna/test.hpp)
target_atdna(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() else()
target_link_libraries(atdna-test athena-core) target_link_libraries(atdna-test athena-core)
endif() endif()
endif()
######### #########
# CPack # # CPack #

View File

@ -192,9 +192,11 @@ install(EXPORT atdnaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT atdna)
# CTest # # CTest #
######### #########
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
enable_testing() enable_testing()
add_test(NAME test-dna COMMAND $<TARGET_FILE:atdna> -o test.cpp add_test(NAME test-dna COMMAND $<TARGET_FILE:atdna> -o test.cpp
"-I${ATHENA_INCLUDE_DIR}" ${CMAKE_SOURCE_DIR}/test.hpp) "-I${ATHENA_INCLUDE_DIR}" ${CMAKE_SOURCE_DIR}/test.hpp)
endif()
endif() endif()