From fe8d15ba829f619fa2ed7bc151ab5faf7c312319 Mon Sep 17 00:00:00 2001 From: Borislav Stanimirov Date: Thu, 21 Jan 2021 17:31:55 +0200 Subject: [PATCH] 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 --- cmake/get_cpm.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/get_cpm.cmake b/cmake/get_cpm.cmake index aab553b..473f83f 100644 --- a/cmake/get_cpm.cmake +++ b/cmake/get_cpm.cmake @@ -1,6 +1,8 @@ set(CPM_DOWNLOAD_VERSION 1.0.0-development-version) if(CPM_SOURCE_CACHE) + # Expand relative path. This is important if the provided path contains a tilde (~) + get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE) set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") elseif(DEFINED ENV{CPM_SOURCE_CACHE}) set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")