[vcpkg_find_acquire_program] Use vcpkg_download_distfile()

This commit is contained in:
Alexander Karatarakis 2017-11-02 18:54:34 -07:00
parent 24c3f87bf4
commit 9150cb8a90

View File

@ -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()