[vcpkg_download_distfile] Add explicit case for "0" (#18285)

This commit is contained in:
ras0219 2021-06-11 09:58:25 -07:00 committed by GitHub
parent 13c8ffbfad
commit abcaa4ba09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,6 +80,13 @@ function(vcpkg_download_distfile VAR)
message(FATAL_ERROR "vcpkg_download_distfile must not be passed both SHA512 and SKIP_SHA512.")
endif()
endif()
if(vcpkg_download_distfile_SHA512 STREQUAL "0")
string(REPEAT "0" 128 vcpkg_download_distfile_SHA512)
endif()
string(LENGTH "${vcpkg_download_distfile_SHA512}" vcpkg_download_distfile_SHA512_length)
if(NOT vcpkg_download_distfile_SHA512_length EQUAL "128")
message(FATAL_ERROR "Invalid SHA512: ${vcpkg_download_distfile_SHA512}. If you do not know the file's SHA512, set this to \"0\".")
endif()
set(downloaded_file_path ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME})
set(download_file_path_part "${DOWNLOADS}/temp/${vcpkg_download_distfile_FILENAME}")