summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-11-11 17:45:57 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-11-11 17:45:57 (GMT)
commit8049114bac1fa943a3f983b1725058d1a51602dd (patch)
tree79434e056ebfbad011967d4968517b1d551043de /Modules
parent70c2432887da232d65bdc56e34ff046656e19703 (diff)
parentee7405a6dbcc780c9ce720f20cbb25dde5f1b7f8 (diff)
downloadCMake-8049114bac1fa943a3f983b1725058d1a51602dd.zip
CMake-8049114bac1fa943a3f983b1725058d1a51602dd.tar.gz
CMake-8049114bac1fa943a3f983b1725058d1a51602dd.tar.bz2
Merge topic 'ExternalProject-check-hash-before-download'
ee7405a6 ExternalProject: Restore logic to not download already-existing file
Diffstat (limited to 'Modules')
-rw-r--r--Modules/ExternalProject.cmake15
1 files changed, 14 insertions, 1 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 8513437..f6e8896 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -772,6 +772,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})")
@@ -795,7 +808,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}'\")