Skip to content

Commit fe8d15b

Browse files
authored
Expand CPM_SOURCE_CACHE path provided as a configure argument (#186)
Otherwise if one configures with -DCPM_SOURCE_CACHE=~/something (tilde to be expanded to $HOME), https://gitlab.kitware.com/cmake/cmake/-/issues/21729 hits, EXISTS always fails, and file(DOWNLOAD) fails
1 parent ab6e8d6 commit fe8d15b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cmake/get_cpm.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
set(CPM_DOWNLOAD_VERSION 1.0.0-development-version)
22

33
if(CPM_SOURCE_CACHE)
4+
# Expand relative path. This is important if the provided path contains a tilde (~)
5+
get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE)
46
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
57
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
68
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")

0 commit comments

Comments
 (0)