Skip to content

Commit 776d4f3

Browse files
Added a download status (#171)
* bump the version of CPM to 0.38.1 * feature: added CPM download status This is very useful in shaky network solutions. We want both a success and a failure message, to determine if the download was successful. * feature: compare CPM against a given checksum This is more comprehensive than just comparing against an empty file. * bump the version of Ccache.cmake to 1.2.4 * bump the version of StableCoder/cmake-scripts to 23.04 * update to use new get_cpm.cmake script --------- Co-authored-by: Lars Melchior <[email protected]>
1 parent f0b5bdb commit 776d4f3

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

cmake/CPM.cmake

+10-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
set(CPM_DOWNLOAD_VERSION 0.37.0)
1+
# SPDX-License-Identifier: MIT
2+
#
3+
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors
4+
5+
set(CPM_DOWNLOAD_VERSION 0.38.5)
6+
set(CPM_HASH_SUM "192aa0ccdc57dfe75bd9e4b176bf7fb5692fd2b3e3f7b09c74856fc39572b31c")
27

38
if(CPM_SOURCE_CACHE)
49
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
@@ -11,22 +16,9 @@ endif()
1116
# Expand relative path. This is important if the provided path contains a tilde (~)
1217
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)
1318

14-
function(download_cpm)
15-
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
16-
file(DOWNLOAD
17-
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
18-
${CPM_DOWNLOAD_LOCATION}
19-
)
20-
endfunction()
21-
22-
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
23-
download_cpm()
24-
else()
25-
# resume download if it previously failed
26-
file(READ ${CPM_DOWNLOAD_LOCATION} check)
27-
if("${check}" STREQUAL "")
28-
download_cpm()
29-
endif()
30-
endif()
19+
file(DOWNLOAD
20+
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
21+
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM}
22+
)
3123

3224
include(${CPM_DOWNLOAD_LOCATION})

cmake/tools.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/CPM.cmake)
1111
# enables sanitizers support using the the `USE_SANITIZER` flag available values are: Address,
1212
# Memory, MemoryWithOrigins, Undefined, Thread, Leak, 'Address;Undefined'
1313
if(USE_SANITIZER OR USE_STATIC_ANALYZER)
14-
CPMAddPackage("gh:StableCoder/cmake-scripts#1f822d1fc87c8d7720c074cde8a278b44963c354")
14+
CPMAddPackage("gh:StableCoder/cmake-scripts@23.04")
1515

1616
if(USE_SANITIZER)
1717
include(${cmake-scripts_SOURCE_DIR}/sanitizers.cmake)
@@ -62,5 +62,5 @@ endif()
6262

6363
# enables CCACHE support through the USE_CCACHE flag possible values are: YES, NO or equivalent
6464
if(USE_CCACHE)
65-
CPMAddPackage("gh:TheLartians/[email protected].3")
65+
CPMAddPackage("gh:TheLartians/[email protected].4")
6666
endif()

0 commit comments

Comments
 (0)