From 7d35b550605596b441af65e96be320ab7d33acc1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 17 Mar 2014 11:24:20 -0400 Subject: [PATCH] ExternalProject: Add option to disable download progress (#14807) Add a DOWNLOAD_NO_PROGRESS option to disable progress reports while downloading source tarballs. --- Modules/ExternalProject.cmake | 14 +++++++++++--- Tests/ExternalProject/CMakeLists.txt | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 1e8316319..8235dda53 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -20,6 +20,7 @@ # [DOWNLOAD_NAME fname] # File name to store (if not end of URL) # [DOWNLOAD_DIR dir] # Directory to store downloaded files # [DOWNLOAD_COMMAND cmd...] # Command to download source tree +# [DOWNLOAD_NO_PROGRESS 1] # Disable download progress reports # [CVS_REPOSITORY cvsroot] # CVSROOT of CVS repository # [CVS_MODULE mod] # Module to checkout from CVS repo # [CVS_TAG tag] # Tag to checkout from CVS repo @@ -515,7 +516,7 @@ endif() endfunction(_ep_write_gitupdate_script) -function(_ep_write_downloadfile_script script_filename remote local timeout hash tls_verify tls_cainfo) +function(_ep_write_downloadfile_script script_filename remote local timeout no_progress hash tls_verify tls_cainfo) if(timeout) set(timeout_args TIMEOUT ${timeout}) set(timeout_msg "${timeout} seconds") @@ -524,6 +525,12 @@ function(_ep_write_downloadfile_script script_filename remote local timeout hash set(timeout_msg "none") endif() + if(no_progress) + set(show_progress "") + else() + set(show_progress "SHOW_PROGRESS") + endif() + if("${hash}" MATCHES "${_ep_hash_regex}") set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1}=${CMAKE_MATCH_2}) else() @@ -563,7 +570,7 @@ ${tls_cainfo} file(DOWNLOAD \"${remote}\" \"${local}\" - SHOW_PROGRESS + ${show_progress} ${hash_args} ${timeout_args} STATUS status @@ -1443,10 +1450,11 @@ function(_ep_add_download_command name) string(REPLACE ";" "-" fname "${fname}") set(file ${download_dir}/${fname}) get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) + get_property(no_progress TARGET ${name} PROPERTY _EP_DOWNLOAD_NO_PROGRESS) get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY) get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO) set(download_script "${stamp_dir}/download-${name}.cmake") - _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${hash}" "${tls_verify}" "${tls_cainfo}") + _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}") set(cmd ${CMAKE_COMMAND} -P "${download_script}" COMMAND) set(retries 3) diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index d9344eca2..0ed556163 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -98,6 +98,7 @@ ExternalProject_Add(${proj} CVS_TAG "" DEPENDS "MinimalNoOpProject" NonExternalProjectTarget DOWNLOAD_COMMAND "" + DOWNLOAD_NO_PROGRESS 1 INSTALL_COMMAND "" PATCH_COMMAND "" STEP_TARGETS install update