# HG changeset patch # User am@osimis.io # Date 1538488476 -7200 # Node ID d4f44a8028a10d053922bad873726a2dadfc18fe # Parent 859e880ac9a81d74907d8476cd0a27969bafb045 allow passing FALSE as expeted MD5 in DownloadPackage when we don't wan't to check the MD5 diff -r 859e880ac9a8 -r d4f44a8028a1 Resources/CMake/DownloadPackage.cmake --- a/Resources/CMake/DownloadPackage.cmake Mon Oct 01 14:19:45 2018 +0200 +++ b/Resources/CMake/DownloadPackage.cmake Tue Oct 02 15:54:36 2018 +0200 @@ -73,18 +73,23 @@ # 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() - file(DOWNLOAD "${Url}" "${TMP_PATH}" - SHOW_PROGRESS EXPECTED_MD5 "${MD5}" - TIMEOUT 60 INACTIVITY_TIMEOUT 60) + if (MD5) + 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}") - 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}") + if (MD5) + 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() endif()