CMake refactoring to functions

This commit is contained in:
gabime
2019-06-10 18:09:36 +03:00
parent 80740f0e46
commit 68a0193d95
7 changed files with 57 additions and 53 deletions

View File

@@ -21,13 +21,22 @@ enable_testing()
# The compiled library tests
if(SPDLOG_BUILD_TESTS)
add_executable(spdlog-utests ${SPDLOG_UTESTS_SOURCES})
spdlog_enable_warnings(spdlog-utests)
target_link_libraries(spdlog-utests spdlog)
add_test(NAME spdlog-utests COMMAND spdlog-utests)
if(SPDLOG_SANITIZE_ADDRESS)
spdlog_enable_sanitizer(spdlog-utests)
endif()
add_test(NAME spdlog-utests COMMAND spdlog-utests)
endif()
# The header-only library version tests
if(SPDLOG_BUILD_HO_TESTS)
add_executable(spdlog-utests-ho ${SPDLOG_UTESTS_SOURCES})
spdlog_enable_warnings(spdlog-utests-ho)
target_link_libraries(spdlog-utests-ho spdlog::spdlog_header_only)
if(SPDLOG_SANITIZE_ADDRESS)
spdlog_set_address_sanitizer(spdlog-utests-ho)
endif()
add_test(NAME spdlog-utests-ho COMMAND spdlog-utests-ho)
endif()