From 308e94231ca349cf7521d0b959b86b021d2d8e6d Mon Sep 17 00:00:00 2001 From: Pascal Palenda <pascal.palenda@akustik.rwth-aachen.de> Date: Tue, 25 Feb 2025 13:56:50 +0100 Subject: [PATCH] Feat: bump CPM version This also checks if we are using the newest version of CPM and downloads it if necessary. This should help with updating. --- src/Index.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Index.cmake b/src/Index.cmake index 4397d2c..c7981de 100644 --- a/src/Index.cmake +++ b/src/Index.cmake @@ -5,10 +5,15 @@ include_guard () include (${CMAKE_CURRENT_LIST_DIR}/InitProject.cmake) # Check for CPM +# set (CPM_DOWNLOAD_VERSION 0.40.5) +set(CPM_DOWNLOAD_VERSION 0.40.5) file (GLOB CPM_MODULE_LOCATIONS ${CMAKE_BINARY_DIR}/cmake/CPM*.cmake) -if (NOT CPM_MODULE_LOCATIONS) - set (CPM_DOWNLOAD_VERSION 0.37.0) +# get the version from the last element in the list +list (GET CPM_MODULE_LOCATIONS -1 CPM_MODULE_LOCATION) +string (REGEX REPLACE ".*CPM_([0-9]+\\.[0-9]+\\.[0-9]+)\\.cmake" "\\1" CPM_MODULE_VERSION ${CPM_MODULE_LOCATION}) + +if (NOT CPM_MODULE_LOCATIONS OR CPM_MODULE_VERSION VERSION_LESS CPM_DOWNLOAD_VERSION) set (CPM_MODULE_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") message (STATUS "Downloading CPM.cmake") -- GitLab