aboutsummaryrefslogtreecommitdiff
path: root/cmake/Download.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/Download.cmake')
-rw-r--r--cmake/Download.cmake18
1 files changed, 18 insertions, 0 deletions
diff --git a/cmake/Download.cmake b/cmake/Download.cmake
new file mode 100644
index 0000000000..50a77816bc
--- /dev/null
+++ b/cmake/Download.cmake
@@ -0,0 +1,18 @@
+file(
+ DOWNLOAD "${URL}" "${FILE}"
+ STATUS status
+ LOG log
+)
+
+list(GET status 0 status_code)
+list(GET status 1 status_string)
+
+if(NOT status_code EQUAL 0)
+ if(NOT ALLOW_FAILURE)
+ message(FATAL_ERROR "error: downloading '${URL}' failed
+ status_code: ${status_code}
+ status_string: ${status_string}
+ log: ${log}
+ ")
+ endif()
+endif()