Mercurial > hg > orthanc-wsi
comparison Resources/Orthanc/CMake/DownloadPackage.cmake @ 254:20a730889ae2
upgrade to 2023
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 07 Jul 2023 17:38:07 +0200 |
parents | 5ed8d1cee52d |
children | 7020852a8fa9 |
comparison
equal
deleted
inserted
replaced
253:a40295af8771 | 254:20a730889ae2 |
---|---|
1 # Orthanc - A Lightweight, RESTful DICOM Store | 1 # Orthanc - A Lightweight, RESTful DICOM Store |
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | 2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
3 # Department, University Hospital of Liege, Belgium | 3 # Department, University Hospital of Liege, Belgium |
4 # Copyright (C) 2017-2021 Osimis S.A., Belgium | 4 # Copyright (C) 2017-2023 Osimis S.A., Belgium |
5 # Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | 5 # Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
6 # | 6 # |
7 # This program is free software: you can redistribute it and/or | 7 # This program is free software: you can redistribute it and/or |
8 # modify it under the terms of the GNU Lesser General Public License | 8 # modify it under the terms of the GNU Lesser General Public License |
9 # as published by the Free Software Foundation, either version 3 of | 9 # as published by the Free Software Foundation, either version 3 of |
10 # the License, or (at your option) any later version. | 10 # the License, or (at your option) any later version. |
99 # https://code.google.com/p/orthanc/issues/detail?id=6 | 99 # https://code.google.com/p/orthanc/issues/detail?id=6 |
100 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS) | 100 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS) |
101 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON") | 101 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON") |
102 endif() | 102 endif() |
103 | 103 |
104 if ("${MD5}" STREQUAL "no-check") | 104 foreach (retry RANGE 1 5) # Retries 5 times |
105 message(WARNING "Not checking the MD5 of: ${Url}") | 105 if ("${MD5}" STREQUAL "no-check") |
106 file(DOWNLOAD "${Url}" "${TMP_PATH}" | 106 message(WARNING "Not checking the MD5 of: ${Url}") |
107 SHOW_PROGRESS TIMEOUT 300 INACTIVITY_TIMEOUT 60 | 107 file(DOWNLOAD "${Url}" "${TMP_PATH}" |
108 STATUS Failure) | 108 SHOW_PROGRESS TIMEOUT 30 INACTIVITY_TIMEOUT 10 |
109 else() | 109 STATUS Failure) |
110 file(DOWNLOAD "${Url}" "${TMP_PATH}" | 110 else() |
111 SHOW_PROGRESS TIMEOUT 300 INACTIVITY_TIMEOUT 60 | 111 file(DOWNLOAD "${Url}" "${TMP_PATH}" |
112 EXPECTED_MD5 "${MD5}" STATUS Failure) | 112 SHOW_PROGRESS TIMEOUT 30 INACTIVITY_TIMEOUT 10 |
113 endif() | 113 EXPECTED_MD5 "${MD5}" STATUS Failure) |
114 | 114 endif() |
115 list(GET Failure 0 Status) | 115 |
116 list(GET Failure 0 Status) | |
117 if (Status EQUAL 0) | |
118 break() # Successful download | |
119 endif() | |
120 endforeach() | |
121 | |
116 if (NOT Status EQUAL 0) | 122 if (NOT Status EQUAL 0) |
123 file(REMOVE ${TMP_PATH}) | |
117 message(FATAL_ERROR "Cannot download file: ${Url}") | 124 message(FATAL_ERROR "Cannot download file: ${Url}") |
118 endif() | 125 endif() |
119 | 126 |
120 else() | 127 else() |
121 message("Using local copy of ${Url}") | 128 message("Using local copy of ${Url}") |