changeset 2855:706da802f1e3

fix checking of MD5 in CMake, new option "no-check" for MD5
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 02 Oct 2018 17:24:55 +0200
parents ebb3f2aa5f23
children 49b152059472
files Resources/CMake/DownloadPackage.cmake
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/DownloadPackage.cmake	Tue Oct 02 17:05:36 2018 +0200
+++ b/Resources/CMake/DownloadPackage.cmake	Tue Oct 02 17:24:55 2018 +0200
@@ -73,19 +73,22 @@
       # user know."
       # https://code.google.com/p/orthanc/issues/detail?id=6
       if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS)
-	      message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON")
+	message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON")
       endif()
 
-      if (MD5)
+      if ("${MD5}" STREQUAL "no-check")
+        message(WARNING "Not checking the MD5 of: ${Url}")
+        file(DOWNLOAD "${Url}" "${TMP_PATH}" SHOW_PROGRESS TIMEOUT 60 INACTIVITY_TIMEOUT 60)
+      else()
         file(DOWNLOAD "${Url}" "${TMP_PATH}" SHOW_PROGRESS TIMEOUT 60 INACTIVITY_TIMEOUT 60 EXPECTED_MD5 "${MD5}")
-      else()
-        file(DOWNLOAD "${Url}" "${TMP_PATH}" SHOW_PROGRESS TIMEOUT 60 INACTIVITY_TIMEOUT 60)
       endif()
 
     else()
       message("Using local copy of ${Url}")
 
-      if (MD5)
+      if ("${MD5}" STREQUAL "no-check")
+        message(WARNING "Not checking the MD5 of: ${Url}")
+      else()
         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}")