diff options
author | Brad King <brad.king@kitware.com> | 2014-11-10 16:09:12 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-11-10 16:26:52 (GMT) |
commit | ee7405a6dbcc780c9ce720f20cbb25dde5f1b7f8 (patch) | |
tree | 563658a952dbae78678d154e20449c031f68d884 /Modules | |
parent | 0c3ddf8b652311ec2a9447a9e6303691841628b4 (diff) | |
download | CMake-ee7405a6dbcc780c9ce720f20cbb25dde5f1b7f8.zip CMake-ee7405a6dbcc780c9ce720f20cbb25dde5f1b7f8.tar.gz CMake-ee7405a6dbcc780c9ce720f20cbb25dde5f1b7f8.tar.bz2 |
ExternalProject: Restore logic to not download already-existing file
The change in commit v3.1.0-rc1~85^2 (ExternalProject: Fix download
retry logic, 2014-09-13) dropped the file(DOWNLOAD) EXPECTED_HASH
argument. This prevents file(DOWNLOAD) from skipping the download if
the output file already exists with the proper hash. Restore this check
with explicit code in the download script.
Reported-by: Ruslan Baratov <ruslan_baratov@yahoo.com>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/ExternalProject.cmake | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index d6a6b72..cdd3039 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -628,6 +628,19 @@ function(_ep_write_downloadfile_script script_filename remote local timeout no_p set(show_progress "SHOW_PROGRESS") endif() + if("${hash}" MATCHES "${_ep_hash_regex}") + string(CONCAT hash_check + "if(EXISTS \"${local}\")\n" + " file(\"${CMAKE_MATCH_1}\" \"${local}\" hash_value)\n" + " if(\"x\${hash_value}\" STREQUAL \"x${CMAKE_MATCH_2}\")\n" + " return()\n" + " endif()\n" + "endif()\n" + ) + else() + set(hash_check "") + endif() + # check for curl globals in the project if(DEFINED CMAKE_TLS_VERIFY) set(tls_verify "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})") @@ -651,7 +664,7 @@ function(_ep_write_downloadfile_script script_filename remote local timeout no_p endif() file(WRITE ${script_filename} -"message(STATUS \"downloading... +"${hash_check}message(STATUS \"downloading... src='${remote}' dst='${local}' timeout='${timeout_msg}'\") |