aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cmake/vcpkg_download_distfile.cmake9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake
index b8acfc823..ff32f1aed 100644
--- a/scripts/cmake/vcpkg_download_distfile.cmake
+++ b/scripts/cmake/vcpkg_download_distfile.cmake
@@ -38,7 +38,12 @@ function(vcpkg_download_distfile VAR)
set(oneValueArgs FILENAME SHA512)
set(multipleValuesArgs URLS)
cmake_parse_arguments(vcpkg_download_distfile "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN})
+
set(downloaded_file_path ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME})
+ set(download_file_path_part "${DOWNLOADS}/temp/${vcpkg_download_distfile_FILENAME}")
+
+ file(REMOVE_RECURSE "${DOWNLOADS}/temp")
+ file(MAKE_DIRECTORY "${DOWNLOADS}/temp")
function(test_hash FILE_KIND CUSTOM_ERROR_ADVICE)
message(STATUS "Testing integrity of ${FILE_KIND}...")
@@ -65,13 +70,13 @@ function(vcpkg_download_distfile VAR)
# Tries to download the file.
foreach(url IN LISTS vcpkg_download_distfile_URLS)
message(STATUS "Downloading ${url}...")
- file(DOWNLOAD ${url} ${downloaded_file_path} STATUS download_status)
+ file(DOWNLOAD ${url} "${download_file_path_part}" STATUS download_status SHOW_PROGRESS)
list(GET download_status 0 status_code)
if (NOT "${status_code}" STREQUAL "0")
message(STATUS "Downloading ${url}... Failed. Status: ${download_status}")
- file(REMOVE ${downloaded_file_path})
set(download_success 0)
else()
+ file(RENAME ${download_file_path_part} ${downloaded_file_path})
message(STATUS "Downloading ${url}... OK")
set(download_success 1)
break()