comparison Resources/Orthanc/CMake/DownloadPackage.cmake @ 64:5fb01c588287

updated to Orthanc Framework 1.12.1
author Alain Mazy <am@osimis.io>
date Wed, 11 Oct 2023 15:58:27 +0200
parents 1256194e1c08
children 3f43bfbea00e
comparison
equal deleted inserted replaced
63:9789c6003e9d 64:5fb01c588287
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) 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}")