From 3e23f3f725d854a6ecfa4b77ac8d163340416301 Mon Sep 17 00:00:00 2001 From: Nir Azkiel Date: Thu, 9 May 2024 17:00:44 +0300 Subject: [PATCH 1/2] force shallow clone of json --- CMake/json-download.cmake.in | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CMake/json-download.cmake.in b/CMake/json-download.cmake.in index 2b719edd4b..ac7a5099b9 100644 --- a/CMake/json-download.cmake.in +++ b/CMake/json-download.cmake.in @@ -5,15 +5,16 @@ include(ExternalProject) ExternalProject_Add( nlohmann_json PREFIX . - GIT_REPOSITORY "https://github.com/nlohmann/json.git" - GIT_TAG v3.11.3 - GIT_CONFIG advice.detachedHead=false # otherwise we'll get "You are in 'detached HEAD' state..." - SOURCE_DIR "${CMAKE_BINARY_DIR}/third-party/json" - GIT_SHALLOW 1 # No history needed (requires cmake 3.6) + + # We do not use 'GIT_REPOSITORY' as it doesn't support a shallow clone of a specific commit, + # this make the clone step very long, so we clone by ourselves + DOWNLOAD_COMMAND git clone -c advice.detachedHead=false --branch v3.11.3 https://github.com/nlohmann/json.git --depth 1 json + DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/third-party/ + # Override default steps with no action, we just want the clone step. + UPDATE_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" ) - From c025eebbb6830794bcd3612385c165d48a5c6d64 Mon Sep 17 00:00:00 2001 From: Nir Azkiel Date: Sun, 12 May 2024 11:09:42 +0300 Subject: [PATCH 2/2] wrap with quotes and add comments --- CMake/json-download.cmake.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMake/json-download.cmake.in b/CMake/json-download.cmake.in index ac7a5099b9..0133c4a973 100644 --- a/CMake/json-download.cmake.in +++ b/CMake/json-download.cmake.in @@ -7,9 +7,10 @@ ExternalProject_Add( PREFIX . # We do not use 'GIT_REPOSITORY' as it doesn't support a shallow clone of a specific commit, - # this make the clone step very long, so we clone by ourselves + # this make the clone step very long, so we clone by ourselves (See https://gitlab.kitware.com/cmake/cmake/-/issues/17770). + # Adding detachedHead=false to avoid warnings like: "You are in 'detached HEAD' state..." DOWNLOAD_COMMAND git clone -c advice.detachedHead=false --branch v3.11.3 https://github.com/nlohmann/json.git --depth 1 json - DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/third-party/ + DOWNLOAD_DIR "${CMAKE_BINARY_DIR}/third-party/" # Override default steps with no action, we just want the clone step. UPDATE_COMMAND ""