Mercurial > hg > orthanc
comparison Resources/CMake/DownloadPackage.cmake @ 2852:d4f44a8028a1
allow passing FALSE as expeted MD5 in DownloadPackage when we don't wan't to check the MD5
author | am@osimis.io |
---|---|
date | Tue, 02 Oct 2018 15:54:36 +0200 |
parents | 3eda46f91834 |
children | 706da802f1e3 |
comparison
equal
deleted
inserted
replaced
2851:859e880ac9a8 | 2852:d4f44a8028a1 |
---|---|
71 # This fixes issue 6: "I think cmake shouldn't download the | 71 # This fixes issue 6: "I think cmake shouldn't download the |
72 # packages which are not in the system, it should stop and let | 72 # packages which are not in the system, it should stop and let |
73 # user know." | 73 # user know." |
74 # https://code.google.com/p/orthanc/issues/detail?id=6 | 74 # https://code.google.com/p/orthanc/issues/detail?id=6 |
75 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS) | 75 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS) |
76 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON") | 76 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON") |
77 endif() | 77 endif() |
78 | 78 |
79 file(DOWNLOAD "${Url}" "${TMP_PATH}" | 79 if (MD5) |
80 SHOW_PROGRESS EXPECTED_MD5 "${MD5}" | 80 file(DOWNLOAD "${Url}" "${TMP_PATH}" SHOW_PROGRESS TIMEOUT 60 INACTIVITY_TIMEOUT 60 EXPECTED_MD5 "${MD5}") |
81 TIMEOUT 60 INACTIVITY_TIMEOUT 60) | 81 else() |
82 file(DOWNLOAD "${Url}" "${TMP_PATH}" SHOW_PROGRESS TIMEOUT 60 INACTIVITY_TIMEOUT 60) | |
83 endif() | |
84 | |
82 else() | 85 else() |
83 message("Using local copy of ${Url}") | 86 message("Using local copy of ${Url}") |
84 | 87 |
85 file(MD5 ${TMP_PATH} ActualMD5) | 88 if (MD5) |
86 if (NOT "${ActualMD5}" STREQUAL "${MD5}") | 89 file(MD5 ${TMP_PATH} ActualMD5) |
87 message(FATAL_ERROR "The MD5 hash of a previously download file is invalid: ${TMP_PATH}") | 90 if (NOT "${ActualMD5}" STREQUAL "${MD5}") |
91 message(FATAL_ERROR "The MD5 hash of a previously download file is invalid: ${TMP_PATH}") | |
92 endif() | |
88 endif() | 93 endif() |
89 endif() | 94 endif() |
90 | 95 |
91 GetUrlExtension(TMP_EXTENSION "${Url}") | 96 GetUrlExtension(TMP_EXTENSION "${Url}") |
92 #message(${TMP_EXTENSION}) | 97 #message(${TMP_EXTENSION}) |