Hi there! I added that feature in the attached patch.
Best regards André Klitzing
From 856b9e78b00180a232d4b9d498a726489778a07d 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 | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 9cc8a20..7e68b30 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,22 @@ 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 + message(WARNING \"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\") +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