Browse Source

ExternalProject: Add option to disable download progress (#14807)

Add a DOWNLOAD_NO_PROGRESS option to disable progress reports while
downloading source tarballs.
Brad King 11 years ago
parent
commit
7d35b55060
2 changed files with 12 additions and 3 deletions
  1. 11 3
      Modules/ExternalProject.cmake
  2. 1 0
      Tests/ExternalProject/CMakeLists.txt

+ 11 - 3
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)

+ 1 - 0
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