Improvement on cmake script to print detailed status message when download fails.
Example of new message format:
[ 11s] CMake Error at cmake/modules/ExternalSourceTools.cmake:39 (message):
[ 11s] error: downloading
[ 11s] 'https://github.com/ARM-software/ComputeLibrary/archive/v18.11.tar.gz'
[ 11s] failed
[ 11s]
[ 11s] status_code: 1
[ 11s] status_string: "Unsupported protocol"
[ 11s] log: Protocol "https" not supported or disabled in libcurl
[ 11s]
[ 11s] Closing connection -1
Signed-off-by: Saulo A. Moraes <s.moraes@samsung.com>
file(MAKE_DIRECTORY "${TMP_DIR}")
message("-- Download ${PREFIX} from ${URL}")
- file(DOWNLOAD ${URL} "${DOWNLOAD_PATH}")
+ file(DOWNLOAD ${URL} "${DOWNLOAD_PATH}"
+ 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()
message("-- Download ${PREFIX} from ${URL} - done")
message("-- Extract ${PREFIX}")