From 8204eaea7f07c7fd2784bee2c2cfd495d49877df Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 31 Mar 2017 11:39:31 +0300 Subject: [PATCH] cmake: Make Download.cmake check for errors Copying from third-party/cmake/DownloadAndExtractFile.cmake. --- cmake/Download.cmake | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cmake/Download.cmake b/cmake/Download.cmake index 07ec174852..470bb19a08 100644 --- a/cmake/Download.cmake +++ b/cmake/Download.cmake @@ -1 +1,16 @@ -file(DOWNLOAD "${URL}" "${FILE}") +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) + message(FATAL_ERROR "error: downloading '${URL}' failed + status_code: ${status_code} + status_string: ${status_string} + log: ${log} +") +endif()