mirror of
https://github.com/TheLartians/ModernCppStarter.git
synced 2025-08-31 14:11:14 +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:
parent
f697dc8a2e
commit
e77cb5b008
1 changed files with 8 additions and 1 deletions
|
@ -15,8 +15,15 @@ function(download_cpm)
|
||||||
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
|
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
|
||||||
file(DOWNLOAD
|
file(DOWNLOAD
|
||||||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
|
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()
|
endfunction()
|
||||||
|
|
||||||
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
|
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue