Skip to content

Commit

Permalink
[CMake] Use already-downloaded prebuilt packages if present
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Nov 2, 2023
1 parent 1bbd9c8 commit 007500e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ function(WZ_FETCH_PREBUILT_PACKAGE PACKAGE_URL PACKAGE_FILENAME PACKAGE_SHA512 O
endif()
endif()

# Check if file already exists at output path
if (EXISTS "${OUTPUT_PATH}")
file(SHA512 "${OUTPUT_PATH}" _dl_received_sha512)
if("${_dl_received_sha512}" STREQUAL "${PACKAGE_SHA512}")
message(STATUS "Found: Already downloaded prebuilt package: ${OUTPUT_PATH}, with hash: ${PACKAGE_SHA512}")
set(${STATUS} TRUE PARENT_SCOPE)
return()
endif()
endif()

# Try to download the prebuilt package
file(DOWNLOAD "${PACKAGE_URL}" "${OUTPUT_PATH}" INACTIVITY_TIMEOUT 60 SHOW_PROGRESS STATUS _dl_status TLS_VERIFY ON)
list(GET _dl_status 0 _dl_status_code)
Expand Down

0 comments on commit 007500e

Please sign in to comment.