Download test data as external project in CMake
This commit is contained in:
parent
e9dec6ba6d
commit
7c33ab467b
1
.gitignore
vendored
1
.gitignore
vendored
@ -22,4 +22,5 @@ benchmarks/files/numbers/*.json
|
||||
cmake-build-debug
|
||||
|
||||
test/test-*
|
||||
test/data
|
||||
/.vs
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
include(ExternalProject)
|
||||
|
||||
option(JSON_Sanitizer "Build test suite with Clang sanitizer" OFF)
|
||||
option(JSON_Valgrind "Execute test suite with Valgrind" OFF)
|
||||
option(JSON_NoExceptions "Build test suite without exceptions" OFF)
|
||||
@ -97,6 +99,16 @@ if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(ExternalTestData
|
||||
GIT_REPOSITORY https://github.com/nickaein/nlohmann-json-testdata.git
|
||||
GIT_TAG 310048a5c34195b935f8062c53f30f3253fc5f50
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
|
||||
#############################################################################
|
||||
# one executable for each unit test file
|
||||
#############################################################################
|
||||
@ -107,6 +119,8 @@ foreach(file ${files})
|
||||
string(REGEX REPLACE "unit-([^$]+)" "test-\\1" testcase ${file_basename})
|
||||
|
||||
add_executable(${testcase} $<TARGET_OBJECTS:doctest_main> ${file})
|
||||
add_dependencies(${testcase} ExternalTestData)
|
||||
|
||||
target_compile_definitions(${testcase} PRIVATE
|
||||
DOCTEST_CONFIG_SUPER_FAST_ASSERTS
|
||||
)
|
||||
@ -148,3 +162,4 @@ endforeach()
|
||||
add_subdirectory(cmake_import)
|
||||
add_subdirectory(cmake_import_minver)
|
||||
add_subdirectory(cmake_add_subdirectory)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user