Replace the full nlohmann_json repo with a fetch_content variant. (#279)

During the configuring of json-schema-validator, the repository
nlohmann_json is fetched via the fetch_content functionality of CMake.
It is a huge repository with size 180MB, which are downloaded whenever
one configures CMake on an empty build directory (e.g. after deleting the
build directory to clear out cached CMake variables.)
The repository
https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent

only contains releases instead of all development commits and has
(at the moment) size of only 830kB, which stronly cuts the download time.
This commit is contained in:
eike-fokken 2023-07-04 13:02:33 +02:00 committed by GitHub
parent bfdda20f5b
commit 540a7e3dd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,7 +84,7 @@ set(fetch_packages "")
# TODO: Remove when bumping cmake >= 3.24 # TODO: Remove when bumping cmake >= 3.24
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24) if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
FetchContent_Declare(nlohmann_json FetchContent_Declare(nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent
GIT_TAG ${JSON_FETCH_VERSION} GIT_TAG ${JSON_FETCH_VERSION}
FIND_PACKAGE_ARGS FIND_PACKAGE_ARGS
) )
@ -95,7 +95,7 @@ else ()
if (NOT nlohmann_json_FOUND) if (NOT nlohmann_json_FOUND)
# If failed fetch the desired version # If failed fetch the desired version
FetchContent_Declare(nlohmann_json FetchContent_Declare(nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent
GIT_TAG ${JSON_FETCH_VERSION} GIT_TAG ${JSON_FETCH_VERSION}
) )
list(APPEND fetch_packages nlohmann_json) list(APPEND fetch_packages nlohmann_json)