comparison Resources/Orthanc/CMake/DownloadPackage.cmake @ 425:c1b0f3c4e1f5

sync Orthanc code
author Alain Mazy <am@osimis.io>
date Mon, 13 Nov 2023 20:37:04 +0100
parents 3d6886f3e5b3
children ecd0b719cff5
comparison
equal deleted inserted replaced
423:7d2ba3ece4ee 425:c1b0f3c4e1f5
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}")