file(DOWNLOAD): Add option to capture errors and continue
Minimal working example:
cmake_minimum_required(VERSION 3.11)
project(foo)
file(
DOWNLOAD https://github.com/NVIDIA/MDL-SDK/archive/2020.1.2.zip mdl.zip
TIMEOUT 1
TLS_VERIFY ON
EXPECTED_HASH SHA256=83a4456467a96ee509d6bc03c0a073ade6e097e141eed99104244f6c9721971e
STATUS status
)
list(GET status 0 status_code)
list(GET status 1 status_string)
message(STATUS "download status (${status_string}, status ${status_code})")
Run the following in project mode, the message shows up. Run the same in script mode (comment the first two lines), and the message doesn't show up on the terminal (CMake exits immediately). This behavior makes it impossible to catch an error and attempt to retry a download (e.g. due to networking issues, etc.).
Is there any way to perform a retry in script mode?