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

View File

@ -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 $<TARGET_FILE:atdna> -o test.cpp
"-I${ATHENA_INCLUDE_DIR}" ${CMAKE_SOURCE_DIR}/test.hpp)
endif()
endif()