ssp/test/CMakeLists.txt

37 lines
884 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 ----
set(
ssp_INCLUDE_WITHOUT_SYSTEM
YES
CACHE
INTERNAL
"Turn the warning guard off to have errors appear in test builds"
)
include(FetchContent)
FetchContent_Declare(ssp SOURCE_DIR "${PROJECT_SOURCE_DIR}/..")
FetchContent_MakeAvailable(ssp)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(ssp INTERFACE -Wall -Wextra)
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:36:34 +01:00
foreach(name IN ITEMS test_main test_parser test_converter test_extractions)
2021-01-06 02:38:31 +01:00
add_executable("${name}" "${name}.cpp")
target_link_libraries("${name}" PRIVATE ssp::ssp doctest::doctest)
2021-01-21 01:29:07 +01:00
target_compile_definitions("${name}" PRIVATE CMAKE_GITHUB_CI)
2021-01-06 02:38:31 +01:00
doctest_discover_tests("${name}")
endforeach()