From 490009c016af093ace1e85c2e5e185220766190e Mon Sep 17 00:00:00 2001 From: David Cole Date: Fri, 11 Dec 2009 15:04:55 -0500 Subject: [PATCH] Fix issue #9764 - add TIMEOUT arg to ExternalProject_Add so that callers have explicit control over the amount of time they are willing to wait for a download step. Default to no timeout, which means just run download for however long it takes. --- Modules/ExternalProject.cmake | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 84c732263..0302d5c4b 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -17,6 +17,7 @@ # [SVN_REPOSITORY url] # URL of Subversion repo # [SVN_REVISION rev] # Revision to checkout from Subversion repo # [URL /.../src.tgz] # Full path or URL of source +# [TIMEOUT seconds] # Time allowed for file download operations # #--Update/Patch step---------- # [UPDATE_COMMAND cmd...] # Source work-tree update command # [PATCH_COMMAND cmd...] # Command to patch downloaded source @@ -203,19 +204,24 @@ define_property(DIRECTORY PROPERTY "EP_PREFIX" INHERITED function(_ep_write_downloadfile_script script_filename remote local timeout) - if(NOT timeout) - set(timeout 30) + if(timeout) + set(timeout_args TIMEOUT ${timeout}) + set(timeout_msg "${timeout} seconds") + else() + set(timeout_args "# no TIMEOUT") + set(timeout_msg "none") endif() file(WRITE ${script_filename} "message(STATUS \"downloading... src='${remote}' - dst='${local}'\") + dst='${local}' + timeout='${timeout_msg}'\") file(DOWNLOAD \"${remote}\" \"${local}\" - TIMEOUT ${timeout} + ${timeout_args} STATUS status LOG log) @@ -694,7 +700,8 @@ function(_ep_add_download_command name) message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}") endif() set(file ${download_dir}/${fname}) - _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "") + get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) + _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}") set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake COMMAND) set(comment "Performing download step (download and extract) for '${name}'")