Mercurial > hg > orthanc
comparison OrthancFramework/Resources/CMake/DownloadPackage.cmake @ 5807:8279eaab0d1d attach-custom-data
merged default -> attach-custom-data
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 24 Sep 2024 11:39:52 +0200 |
parents | f7adfb22e20e |
children |
comparison
equal
deleted
inserted
replaced
5085:79f98ee4f04b | 5807:8279eaab0d1d |
---|---|
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-2022 Osimis S.A., Belgium | 4 # Copyright (C) 2017-2023 Osimis S.A., Belgium |
5 # Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | 5 # Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
6 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | |
6 # | 7 # |
7 # This program is free software: you can redistribute it and/or | 8 # This program is free software: you can redistribute it and/or |
8 # modify it under the terms of the GNU Lesser General Public License | 9 # modify it under the terms of the GNU Lesser General Public License |
9 # as published by the Free Software Foundation, either version 3 of | 10 # as published by the Free Software Foundation, either version 3 of |
10 # the License, or (at your option) any later version. | 11 # the License, or (at your option) any later version. |
99 # https://code.google.com/p/orthanc/issues/detail?id=6 | 100 # https://code.google.com/p/orthanc/issues/detail?id=6 |
100 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS) | 101 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") | 102 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON") |
102 endif() | 103 endif() |
103 | 104 |
104 if ("${MD5}" STREQUAL "no-check") | 105 foreach (retry RANGE 1 5) # Retries 5 times |
105 message(WARNING "Not checking the MD5 of: ${Url}") | 106 if ("${MD5}" STREQUAL "no-check") |
106 file(DOWNLOAD "${Url}" "${TMP_PATH}" | 107 message(WARNING "Not checking the MD5 of: ${Url}") |
107 SHOW_PROGRESS TIMEOUT 300 INACTIVITY_TIMEOUT 60 | 108 file(DOWNLOAD "${Url}" "${TMP_PATH}" |
108 STATUS Failure) | 109 SHOW_PROGRESS TIMEOUT 30 INACTIVITY_TIMEOUT 10 |
109 else() | 110 STATUS Failure) |
110 file(DOWNLOAD "${Url}" "${TMP_PATH}" | 111 else() |
111 SHOW_PROGRESS TIMEOUT 300 INACTIVITY_TIMEOUT 60 | 112 file(DOWNLOAD "${Url}" "${TMP_PATH}" |
112 EXPECTED_MD5 "${MD5}" STATUS Failure) | 113 SHOW_PROGRESS TIMEOUT 30 INACTIVITY_TIMEOUT 10 |
113 endif() | 114 EXPECTED_MD5 "${MD5}" STATUS Failure) |
114 | 115 endif() |
115 list(GET Failure 0 Status) | 116 |
117 list(GET Failure 0 Status) | |
118 if (Status EQUAL 0) | |
119 break() # Successful download | |
120 endif() | |
121 endforeach() | |
122 | |
116 if (NOT Status EQUAL 0) | 123 if (NOT Status EQUAL 0) |
124 file(REMOVE ${TMP_PATH}) | |
117 message(FATAL_ERROR "Cannot download file: ${Url}") | 125 message(FATAL_ERROR "Cannot download file: ${Url}") |
118 endif() | 126 endif() |
119 | 127 |
120 else() | 128 else() |
121 message("Using local copy of ${Url}") | 129 message("Using local copy of ${Url}") |