mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
CMake's file(DOWNLOAD) function fails silently, leading to an error occurring due to a missing file later in the build. This fails quickly and produces a better error message.
12 lines
397 B
CMake
12 lines
397 B
CMake
macro(download_and_check source destination)
|
|
file(DOWNLOAD ${source} ${destination} STATUS download_status)
|
|
list(GET download_status 0 status_code)
|
|
list(GET download_status 1 status_message)
|
|
|
|
if(${status_code} EQUAL 0)
|
|
message(VERBOSE "Download of \"${source}\" successful.")
|
|
else()
|
|
message(FATAL_ERROR "Download of \"${source}\" failed: ${status_message}")
|
|
endif()
|
|
endmacro()
|