Hi Brad, thanks for your advice! I APPEND the log of every failed download and print that only if no URL works now. So we reserve the detailed error log of a single download attempt.
Best regards André 2016-04-29 19:45 GMT+02:00 Brad King <brad.k...@kitware.com>: > On 04/28/2016 03:13 PM, A. Klitzing wrote: >> - message(FATAL_ERROR \"error: downloading '${remote}' failed >> + message(WARNING \"downloading '\${url}' failed > > Thanks for working on this! Please revise the logic to collect > the list of failed URLs in a list and report an error listing > all URLs only after they all fail. Otherwise once the source > moves all future builds will get warnings even though they > succeed on one of the alternatives. > > Thanks, > -Brad >
From b830045866c42010fda85c88765314f4ab9543df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= <aklitz...@gmail.com> Date: Thu, 28 Apr 2016 21:03:26 +0200 Subject: [PATCH] Add support for multiple/alternative URLs Now it is possible to pass multiple URLs as a list that will be tried in and foreach(). So it will try next URL if the previous failed. ExternalProject_Add(dummy URL "${FIRST_URL}" "${SECOND_URL}" "${THIRD_URL}" ) --- Modules/ExternalProject.cmake | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 9cc8a20..3b0ce3a 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -69,8 +69,8 @@ Create custom targets to build projects in external trees URL of mercurial repo ``HG_TAG <tag>`` Mercurial branch name, commit id or tag - ``URL /.../src.tgz`` - Full path or URL of source + ``URL /.../src.tgz /other/path/src.tgz`` + Full pathes or URLs of source. ``URL_HASH ALGO=value`` Hash of file at URL ``URL_MD5 md5`` @@ -901,8 +901,10 @@ function(_ep_write_downloadfile_script script_filename remote local timeout no_p endif() file(WRITE ${script_filename} -"${hash_check}message(STATUS \"downloading... - src='${remote}' +"${hash_check} +foreach(url ${remote}) + message(STATUS \"downloading... + src='\${url}' dst='${local}' timeout='${timeout_msg}'\") @@ -910,7 +912,7 @@ ${tls_verify_code} ${tls_cainfo_code} file(DOWNLOAD - \"${remote}\" + \"\${url}\" \"${local}\" ${show_progress} ${timeout_args} @@ -921,13 +923,24 @@ list(GET status 0 status_code) list(GET status 1 status_string) if(NOT status_code EQUAL 0) - message(FATAL_ERROR \"error: downloading '${remote}' failed + string(APPEND logFailedURLs \"downloading '\${url}' failed status_code: \${status_code} status_string: \${status_string} log: \${log} \") endif() +if(status_code EQUAL 0) + break() +endif() +endforeach() + +if(NOT status_code EQUAL 0) + message(FATAL_ERROR \"error: each download failed! +\${logFailedURLs} +\") +endif() + message(STATUS \"downloading... done\") " ) -- 2.8.0
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers