Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions cmake/get_cpm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,31 @@ endif()
# Expand relative path. This is important if the provided path contains a tilde (~)
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)

file(DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM}
file(
DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION}
EXPECTED_HASH SHA256=${CPM_HASH_SUM}
TLS_VERIFY ON
STATUS DOWNLOAD_STATUS
)

list(GET DOWNLOAD_STATUS 0 DOWNLOAD_ERRCODE)
# 35 is "SSL connect error"
if(DOWNLOAD_ERRCODE EQUAL 35)
message(
WARNING
"Could not retrieve CPM.cmake at the first tentative, retrying with TLS verification turned off."
)
# On Windows TLS issues may arise
file(
DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION}
EXPECTED_HASH SHA256=${CPM_HASH_SUM}
TLS_VERIFY OFF
STATUS DOWNLOAD_STATUS
)
endif()

include(${CPM_DOWNLOAD_LOCATION})