@@ -1160,7 +1160,10 @@ function(YCM_EP_HELPER _name)
11601160 # a git repo folder if it already exists
11611161
11621162 # We do not define the custom GIT DOWNLOAD command if the outside call of YCMEPHelper already redefined it
1163- if(NOT DEFINED _YH_${_name} _DOWNLOAD_COMMAND)
1163+ # or if we are using the vendored ExternalProject of YCM, that already redefines DOWNLOAD internally
1164+ get_property(_yeph_YCM_USE_CMAKE_NEXT GLOBAL PROPERTY YCM_USE_CMAKE_NEXT)
1165+
1166+ if(NOT DEFINED _YH_${_name} _DOWNLOAD_COMMAND AND NOT _yeph_YCM_USE_CMAKE_NEXT)
11641167 # Coherently with how the gitclone command is created inside ExternalProject, we also define a CMake
11651168 # script that defines the clone commands, and then we call it
11661169 # This part is inspired by https://gitlab.kitware.com/cmake/cmake/-/blob/v3.30.2/Modules/ExternalProject/shared_internal_commands.cmake#L945-1034
@@ -1186,8 +1189,8 @@ function(YCM_EP_HELPER _name)
11861189 set(git_remote_name "origin" )
11871190 endif()
11881191
1189- _ep_get_tls_version( ${_name} tls_version)
1190- _ep_get_tls_verify( ${_name} tls_verify)
1192+ set( tls_version "" )
1193+ set( tls_verify "" )
11911194 set(git_shallow "${_YH_${_name} _SHALLOW}" )
11921195 set(git_progress "" )
11931196 set(git_config "" )
@@ -1216,6 +1219,7 @@ submodules=${git_submodules}
12161219 get_filename_component(work_dir "${${_name} _SOURCE_DIR}" PATH)
12171220
12181221 set(clone_script ${${_name} _TMP_DIR}/${_name} -gitsafeclone.cmake)
1222+ set(stamp_dir ${${_name} _STAMP_DIR})
12191223 _ycm_ep_write_gitclone_script(
12201224 ${clone_script}
12211225 ${${_name} _SOURCE_DIR}
@@ -1242,6 +1246,16 @@ submodules=${git_submodules}
12421246 -P ${clone_script}
12431247 )
12441248
1249+ # We use configure_file() to write the repo_info_file for compatibility
1250+ # with upstreams CMake's gitclone
1251+
1252+ set(repo_info_file ${stamp_dir} /${_name} -gitinfo.txt)
1253+ configure_file(
1254+ "${YCM_MODULE_DIR} /modules/YCMEPHelper/RepositoryInfo.txt.in"
1255+ "${repo_info_file} "
1256+ @ONLY
1257+ )
1258+
12451259 list(APPEND ${_name} _COMMAND_ARGS DOWNLOAD_COMMAND "${cmd} " )
12461260 endif()
12471261
0 commit comments