mirror of
https://github.com/nlohmann/json.git
synced 2026-02-17 09:03:58 +00:00
Fix CI (#4871)
* 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 👷 fix CI Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
# -Wno-padded We do not care about padding warnings.
|
||||
# -Wno-covered-switch-default All switches list all cases and a default case.
|
||||
# -Wno-unsafe-buffer-usage Otherwise Doctest would not compile.
|
||||
# -Wno-missing-noreturn We found no way to silence this warning otherwise, see PR #4871
|
||||
|
||||
set(CLANG_CXXFLAGS
|
||||
-Werror
|
||||
@@ -17,4 +18,5 @@ set(CLANG_CXXFLAGS
|
||||
-Wno-padded
|
||||
-Wno-covered-switch-default
|
||||
-Wno-unsafe-buffer-usage
|
||||
-Wno-missing-noreturn
|
||||
)
|
||||
|
||||
@@ -1,21 +1,33 @@
|
||||
set(JSON_TEST_DATA_URL https://github.com/nlohmann/json_test_data)
|
||||
set(JSON_TEST_DATA_VERSION 3.1.0)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
# if variable is set, use test data from given directory rather than downloading them
|
||||
if(JSON_TestDataDirectory)
|
||||
message(STATUS "Using test data in ${JSON_TestDataDirectory}.")
|
||||
add_custom_target(download_test_data)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${JSON_TestDataDirectory}\"\n")
|
||||
else()
|
||||
find_package(Git)
|
||||
# create a header with the path to the downloaded test data
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${CMAKE_BINARY_DIR}/test_files\"\n")
|
||||
|
||||
# download test data from GitHub release
|
||||
ExternalProject_Add(download_test_data_project
|
||||
URL "${JSON_TEST_DATA_URL}/archive/refs/tags/v${JSON_TEST_DATA_VERSION}.zip"
|
||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/test_files"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
LOG_DOWNLOAD TRUE
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
)
|
||||
|
||||
# target to download test data
|
||||
add_custom_target(download_test_data
|
||||
COMMAND test -d json_test_data || ${GIT_EXECUTABLE} clone -c advice.detachedHead=false --branch v${JSON_TEST_DATA_VERSION} ${JSON_TEST_DATA_URL}.git --quiet --depth 1
|
||||
COMMENT "Downloading test data from ${JSON_TEST_DATA_URL} (v${JSON_TEST_DATA_VERSION})"
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
DEPENDS download_test_data_project
|
||||
)
|
||||
# create a header with the path to the downloaded test data
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${CMAKE_BINARY_DIR}/json_test_data\"\n")
|
||||
endif()
|
||||
|
||||
# determine the operating system (for debug and support purposes)
|
||||
|
||||
Reference in New Issue
Block a user