summaryrefslogtreecommitdiffstats
path: root/Modules/ExternalProject.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r--Modules/ExternalProject.cmake17
1 files changed, 15 insertions, 2 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index d6a6b72..8832950 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -52,7 +52,7 @@
# [CMAKE_GENERATOR_PLATFORM p] # Generator-specific platform name
# [CMAKE_GENERATOR_TOOLSET t] # Generator-specific toolset name
# [CMAKE_ARGS args...] # Arguments to CMake command line
-# [CMAKE_CACHE_ARGS args...] # Initial cache arguments, of the form -Dvar:string=on
+# [CMAKE_CACHE_ARGS args...] # Initial cache args with form -Dvar:string=on
# #--Build step-----------------
# [BINARY_DIR dir] # Specify build dir location
# [BUILD_COMMAND cmd...] # Command to drive the native build
@@ -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}'\")