1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-08-30 13:41:13 +02:00

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.
This commit is contained in:
Tobias Schmidl 2023-05-04 09:59:47 +02:00
parent f697dc8a2e
commit e77cb5b008

View file

@ -15,8 +15,15 @@ function(download_cpm)
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
file(DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION}
${CPM_DOWNLOAD_LOCATION} STATUS CPM_DOWNLOAD_STATUS
)
list(GET CPM_DOWNLOAD_STATUS 0 CPM_DOWNLOAD_STATUS_CODE)
list(GET CPM_DOWNLOAD_STATUS 1 CPM_DOWNLOAD_ERROR_MESSAGE)
if(${CPM_DOWNLOAD_STATUS_CODE} EQUAL 0)
message(STATUS "CPM: Download completed successfully.")
else()
message(FATAL_ERROR "CPM: Error occurred during download: ${CPM_DOWNLOAD_ERROR_MESSAGE}")
endif()
endfunction()
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))