summaryrefslogtreecommitdiffstats
path: root/Modules/ExternalProject.cmake
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2009-12-11 20:04:55 (GMT)
committerDavid Cole <david.cole@kitware.com>2009-12-11 20:04:55 (GMT)
commit490009c016af093ace1e85c2e5e185220766190e (patch)
tree384e9b896a35e24ac85fd95e4b95eb7e85dc94eb /Modules/ExternalProject.cmake
parente28941b6d7aae6f07be7c594d74e29c7156c692d (diff)
downloadCMake-490009c016af093ace1e85c2e5e185220766190e.zip
CMake-490009c016af093ace1e85c2e5e185220766190e.tar.gz
CMake-490009c016af093ace1e85c2e5e185220766190e.tar.bz2
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.
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r--Modules/ExternalProject.cmake17
1 files changed, 12 insertions, 5 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 84c7322..0302d5c 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}'")