Mercurial > hg > orthanc
comparison Resources/CMake/DownloadPackage.cmake @ 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 | d4f44a8028a1 |
children | f5ce33d3295c |
comparison
equal
deleted
inserted
replaced
2854:ebb3f2aa5f23 | 2855:706da802f1e3 |
---|---|
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 if (MD5) | 79 if ("${MD5}" STREQUAL "no-check") |
80 message(WARNING "Not checking the MD5 of: ${Url}") | |
81 file(DOWNLOAD "${Url}" "${TMP_PATH}" SHOW_PROGRESS TIMEOUT 60 INACTIVITY_TIMEOUT 60) | |
82 else() | |
80 file(DOWNLOAD "${Url}" "${TMP_PATH}" SHOW_PROGRESS TIMEOUT 60 INACTIVITY_TIMEOUT 60 EXPECTED_MD5 "${MD5}") | 83 file(DOWNLOAD "${Url}" "${TMP_PATH}" SHOW_PROGRESS TIMEOUT 60 INACTIVITY_TIMEOUT 60 EXPECTED_MD5 "${MD5}") |
81 else() | |
82 file(DOWNLOAD "${Url}" "${TMP_PATH}" SHOW_PROGRESS TIMEOUT 60 INACTIVITY_TIMEOUT 60) | |
83 endif() | 84 endif() |
84 | 85 |
85 else() | 86 else() |
86 message("Using local copy of ${Url}") | 87 message("Using local copy of ${Url}") |
87 | 88 |
88 if (MD5) | 89 if ("${MD5}" STREQUAL "no-check") |
90 message(WARNING "Not checking the MD5 of: ${Url}") | |
91 else() | |
89 file(MD5 ${TMP_PATH} ActualMD5) | 92 file(MD5 ${TMP_PATH} ActualMD5) |
90 if (NOT "${ActualMD5}" STREQUAL "${MD5}") | 93 if (NOT "${ActualMD5}" STREQUAL "${MD5}") |
91 message(FATAL_ERROR "The MD5 hash of a previously download file is invalid: ${TMP_PATH}") | 94 message(FATAL_ERROR "The MD5 hash of a previously download file is invalid: ${TMP_PATH}") |
92 endif() | 95 endif() |
93 endif() | 96 endif() |