2 # Use 'cmake -Dremote=${url} -Dlocal=${filename} -Dtimeout=${seconds}
3 # -P DownloadFile.cmake' to call this script...
6 message(FATAL_ERROR "error: required variable 'remote' not defined...")
10 message(FATAL_ERROR "error: required variable 'local' not defined...")
13 if(NOT DEFINED timeout)
15 endif(NOT DEFINED timeout)
17 message(STATUS "info: downloading '${remote}'...")
18 file(DOWNLOAD "${remote}" "${local}" TIMEOUT ${timeout} STATUS status LOG log)
20 list(GET status 0 status_code)
21 list(GET status 1 status_string)
23 if(NOT status_code EQUAL 0)
24 message(FATAL_ERROR "error: download of '${remote}' failed
25 status_code: ${status_code}
26 status_string: ${status_string}
31 message(STATUS "info: done downloading '${remote}'...")