mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-18 13:13:34 +08:00
[vcpkg_find_acquire_program] Use vcpkg_download_distfile()
This commit is contained in:
parent
24c3f87bf4
commit
9150cb8a90
@ -164,18 +164,20 @@ function(vcpkg_find_acquire_program VAR)
|
||||
|
||||
do_find()
|
||||
if("${${VAR}}" MATCHES "-NOTFOUND")
|
||||
file(DOWNLOAD ${URL} ${DOWNLOADS}/${ARCHIVE}
|
||||
EXPECTED_HASH SHA512=${HASH}
|
||||
SHOW_PROGRESS
|
||||
vcpkg_download_distfile(ARCHIVE_PATH
|
||||
URLS ${URL}
|
||||
SHA512 ${HASH}
|
||||
FILENAME ${ARCHIVE}
|
||||
)
|
||||
|
||||
file(MAKE_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR})
|
||||
if(DEFINED NOEXTRACT)
|
||||
file(COPY ${DOWNLOADS}/${ARCHIVE} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR})
|
||||
file(COPY ${ARCHIVE_PATH} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR})
|
||||
else()
|
||||
get_filename_component(ARCHIVE_EXTENSION ${ARCHIVE} EXT)
|
||||
string(TOLOWER "${ARCHIVE_EXTENSION}" ARCHIVE_EXTENSION)
|
||||
if(ARCHIVE_EXTENSION STREQUAL ".msi")
|
||||
file(TO_NATIVE_PATH "${DOWNLOADS}/${ARCHIVE}" ARCHIVE_NATIVE_PATH)
|
||||
file(TO_NATIVE_PATH "${ARCHIVE_PATH}" ARCHIVE_NATIVE_PATH)
|
||||
file(TO_NATIVE_PATH "${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}" DESTINATION_NATIVE_PATH)
|
||||
execute_process(
|
||||
COMMAND msiexec /a ${ARCHIVE_NATIVE_PATH} /qn TARGETDIR=${DESTINATION_NATIVE_PATH}
|
||||
@ -183,7 +185,7 @@ function(vcpkg_find_acquire_program VAR)
|
||||
)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${DOWNLOADS}/${ARCHIVE}
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${ARCHIVE_PATH}
|
||||
WORKING_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}
|
||||
)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user