From ddc5fc16df4fcdb2651e4a5307e6c012422d5da3 Mon Sep 17 00:00:00 2001 From: friendlyanon Date: Wed, 6 Jan 2021 01:38:31 +0000 Subject: [PATCH] Add lists file for tests --- test/CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/CMakeLists.txt diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..c73f75a --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,35 @@ +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 +include(doctest) + +# ---- Test ---- + +enable_testing() + +foreach(name IN ITEMS test_parser test_converter test_extractions) + add_executable("${name}" "${name}.cpp") + target_link_libraries("${name}" PRIVATE ssp::ssp doctest::doctest) + doctest_discover_tests("${name}") +endforeach()