|
project(logging)
|
|
|
|
|
|
set(${PROJECT_NAME}_src
|
|
src/logging.cppm)
|
|
# this is the "object library" target: compiles the sources only once
|
|
add_library(${PROJECT_NAME}_lib STATIC ${${PROJECT_NAME}_src})
|
|
target_include_directories(${PROJECT_NAME}_lib PUBLIC ./src)
|
|
|
|
find_package(spdlog CONFIG REQUIRED)
|
|
target_link_libraries(${PROJECT_NAME}_lib PUBLIC spdlog::spdlog)
|
|
# Setup tests
|
|
enable_testing()
|
|
|
|
find_package(GTest CONFIG REQUIRED)
|
|
include(GoogleTest)
|
|
|
|
file(GLOB_RECURSE tests_${PROJECT_NAME}_src CONFIGURE_DEPENDS tests/*.cppm tests/*/*.cppm)
|
|
|
|
add_executable(tests_${PROJECT_NAME} ${tests_${PROJECT_NAME}_src}
|
|
tests/sanitizers.cpp)
|
|
target_link_libraries(tests_${PROJECT_NAME} PRIVATE GTest::gtest GTest::gtest_main GTest::gmock GTest::gmock_main ${PROJECT_NAME}_lib)
|
|
add_test(AllTestsIn${PROJECT_NAME} tests_${PROJECT_NAME})
|
|
|
|
gtest_discover_tests(tests_${PROJECT_NAME})
|
|
|