Skip to content

Commit ea3724a

Browse files
committed
if already available, use the legacy cache hash
1 parent 2cbbc35 commit ea3724a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cmake/CPM.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,16 @@ endfunction()
215215
# We will be able to use a shorter path with very high probability, but in the (rare) event that the
216216
# first couple characters collide, we will check longer and longer substrings.
217217
function(cpm_get_shortest_hash source_cache_dir origin_hash short_hash_output_var)
218+
# for compatibility with caches populated by a previous version of CPM, check if a directory using
219+
# the full hash already exists
220+
if(EXISTS "${source_cache_dir}/${origin_hash}")
221+
set(${short_hash_output_var}
222+
"${origin_hash}"
223+
PARENT_SCOPE
224+
)
225+
return()
226+
endif()
227+
218228
foreach(len RANGE 4 40 4)
219229
string(SUBSTRING "${origin_hash}" 0 ${len} short_hash)
220230
set(hash_lock ${source_cache_dir}/${short_hash}.lock)

0 commit comments

Comments
 (0)