James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame] | 1 | macro(download_and_check source destination) |
Maxwell Henderson | 80bec32 | 2024-01-09 15:48:44 -0800 | [diff] [blame] | 2 | file(DOWNLOAD ${source} ${destination} STATUS download_status) |
| 3 | list(GET download_status 0 status_code) |
| 4 | list(GET download_status 1 status_message) |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame] | 5 | |
Maxwell Henderson | 80bec32 | 2024-01-09 15:48:44 -0800 | [diff] [blame] | 6 | if(${status_code} EQUAL 0) |
| 7 | message(VERBOSE "Download of \"${source}\" successful.") |
| 8 | else() |
| 9 | message(FATAL_ERROR "Download of \"${source}\" failed: ${status_message}") |
| 10 | endif() |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame] | 11 | endmacro() |