changeset 2530:3eda46f91834

check md5 of previously downloaded files
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 16 Apr 2018 15:48:06 +0200
parents ae5f98eadb75
children b7ed112ce56e
files Resources/CMake/DownloadPackage.cmake
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/DownloadPackage.cmake	Mon Apr 16 15:08:41 2018 +0200
+++ b/Resources/CMake/DownloadPackage.cmake	Mon Apr 16 15:48:06 2018 +0200
@@ -81,6 +81,11 @@
         TIMEOUT 60 INACTIVITY_TIMEOUT 60)
     else()
       message("Using local copy of ${Url}")
+
+      file(MD5 ${TMP_PATH} ActualMD5)
+      if (NOT "${ActualMD5}" STREQUAL "${MD5}")
+        message(FATAL_ERROR "The MD5 hash of a previously download file is invalid: ${TMP_PATH}")
+      endif()
     endif()
 
     GetUrlExtension(TMP_EXTENSION "${Url}")