Skip to content

Commit 46b3dc7

Browse files
authored
Merge pull request intel#120 from elbeno/update-cpm
2 parents 539a4f8 + 24383d4 commit 46b3dc7

File tree

2 files changed

+15
-28
lines changed

2 files changed

+15
-28
lines changed

cmake/format.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ add_versioned_package(
1111
GITHUB_REPOSITORY
1212
TheLartians/Format.cmake
1313
OPTIONS
14-
"CMAKE_FORMAT_EXCLUDE cmake/CPM.cmake")
14+
"CMAKE_FORMAT_EXCLUDE cmake/get_cpm.cmake")
1515

1616
add_dependencies(quality check-clang-format check-cmake-format)
1717
add_dependencies(ci-quality check-clang-format check-cmake-format)

cmake/get_cpm.cmake

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,24 @@
1-
set(CPM_DOWNLOAD_VERSION 0.38.2)
1+
# SPDX-License-Identifier: MIT
2+
#
3+
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors
4+
5+
set(CPM_DOWNLOAD_VERSION 0.40.2)
6+
set(CPM_HASH_SUM "c8cdc32c03816538ce22781ed72964dc864b2a34a310d3b7104812a5ca2d835d")
27

38
if(CPM_SOURCE_CACHE)
4-
set(CPM_DOWNLOAD_LOCATION
5-
"${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
9+
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
610
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
7-
set(CPM_DOWNLOAD_LOCATION
8-
"$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
11+
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
912
else()
10-
set(CPM_DOWNLOAD_LOCATION
11-
"${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
13+
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
1214
endif()
1315

14-
# Expand relative path. This is important if the provided path contains a tilde
15-
# (~)
16+
# Expand relative path. This is important if the provided path contains a tilde (~)
1617
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)
1718

18-
function(download_cpm)
19-
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
20-
file(
21-
DOWNLOAD
22-
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
23-
${CPM_DOWNLOAD_LOCATION})
24-
endfunction()
25-
26-
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
27-
download_cpm()
28-
else()
29-
# resume download if it previously failed
30-
file(READ ${CPM_DOWNLOAD_LOCATION} check)
31-
if("${check}" STREQUAL "")
32-
download_cpm()
33-
endif()
34-
unset(check)
35-
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+
)
3623

3724
include(${CPM_DOWNLOAD_LOCATION})

0 commit comments

Comments
 (0)