ssp/test/CMakeLists.txt

40 lines
975 B
CMake
Raw Normal View History

2021-01-06 02:38:31 +01:00
cmake_minimum_required(VERSION 3.14)
project(ssp_tests CXX)
# ---- Dependencies ----
2023-02-08 21:54:44 +01:00
set(SSP_INCLUDE_WITHOUT_SYSTEM YES
CACHE INTERNAL
2021-01-06 02:38:31 +01:00
"Turn the warning guard off to have errors appear in test builds"
)
include(FetchContent)
2023-02-08 21:54:44 +01:00
fetchcontent_declare(ssp SOURCE_DIR "${PROJECT_SOURCE_DIR}/..")
fetchcontent_makeavailable(ssp)
2021-01-06 02:38:31 +01:00
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
2023-02-08 21:54:44 +01:00
target_compile_options(ssp INTERFACE -Wall -Wextra)
2021-01-06 02:38:31 +01:00
endif()
find_package(doctest 2.4.4 CONFIG REQUIRED)
# for doctest_discover_tests
2021-01-21 01:32:52 +01:00
include(doctest)
2021-01-06 02:38:31 +01:00
# ---- Test ----
enable_testing()
2021-01-21 01:54:20 +01:00
foreach(name IN ITEMS test_splitter test_parser test_converter test_extractions)
2023-02-08 21:54:44 +01:00
add_executable("${name}" "${name}.cpp")
target_link_libraries(
"${name}"
PRIVATE ssp::ssp fast_float doctest::doctest
)
target_compile_definitions(
"${name}"
PRIVATE DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN CMAKE_GITHUB_CI
)
doctest_discover_tests("${name}")
2021-01-06 02:38:31 +01:00
endforeach()