mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-24 17:41:34 +08:00
Modern CMake in /tests
This commit is contained in:
parent
c336470320
commit
38ccd51399
@ -1,19 +1,23 @@
|
|||||||
#
|
project(spdlog-utests)
|
||||||
# Tests
|
|
||||||
#
|
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
find_package(Threads)
|
set(SPDLOG_UTESTS_SOURCES
|
||||||
|
errors.cpp
|
||||||
|
file_helper.cpp
|
||||||
|
file_log.cpp
|
||||||
|
format.cpp
|
||||||
|
includes.h
|
||||||
|
registry.cpp
|
||||||
|
test_macros.cpp
|
||||||
|
utils.cpp
|
||||||
|
utils.h
|
||||||
|
main.cpp)
|
||||||
|
|
||||||
# Build Catch unit tests
|
add_executable(${PROJECT_NAME} ${SPDLOG_UTESTS_SOURCES})
|
||||||
add_library(catch INTERFACE)
|
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads)
|
||||||
target_include_directories(catch INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
target_link_libraries(${PROJECT_NAME} PRIVATE spdlog)
|
||||||
|
|
||||||
file(GLOB catch_tests LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h *.hpp)
|
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
|
||||||
|
|
||||||
add_executable(catch_tests ${catch_tests})
|
|
||||||
target_link_libraries(catch_tests spdlog ${CMAKE_THREAD_LIBS_INIT})
|
|
||||||
add_test(NAME catch_tests COMMAND catch_tests)
|
|
||||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user