[Cmake-commits] CMake branch, next, updated. v3.5.1-687-g83a4aec

Ben Boeckel ben.boeckel at kitware.com
Tue Mar 29 10:28:31 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  83a4aec25e404a2975fcc06bf181ec1bf4941bd2 (commit)
       via  d5a5af252e1280e62bc3ec146d2baabc0f2e18d5 (commit)
      from  a2d1f4c6d990cecc9ce724758eabdb0e77d1e7a8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=83a4aec25e404a2975fcc06bf181ec1bf4941bd2
commit 83a4aec25e404a2975fcc06bf181ec1bf4941bd2
Merge: a2d1f4c d5a5af2
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Tue Mar 29 10:28:30 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Mar 29 10:28:30 2016 -0400

    Merge topic 'external-project-no-extract' into next
    
    d5a5af25 ExternalProject: add support for just downloading a file


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d5a5af252e1280e62bc3ec146d2baabc0f2e18d5
commit d5a5af252e1280e62bc3ec146d2baabc0f2e18d5
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Tue Mar 29 10:25:01 2016 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Tue Mar 29 10:25:01 2016 -0400

    ExternalProject: add support for just downloading a file
    
    Some projects only ship self-extracting installers rather than
    compressed archives. Add a flag so that these files may be used in
    ExternalProject.

diff --git a/Help/release/dev/external-project-no-extract.rst b/Help/release/dev/external-project-no-extract.rst
new file mode 100644
index 0000000..af5d717
--- /dev/null
+++ b/Help/release/dev/external-project-no-extract.rst
@@ -0,0 +1,6 @@
+external-project-no-extract
+---------------------------
+
+* The :module:`ExternalProject` module leared the ``NO_EXTRACT 1`` argument to
+  skip extracting the file that is downloaded (e.g., for self-extracting shell
+  installers or MSI files).
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 249658d..f2f005b 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -77,6 +77,9 @@ Create custom targets to build projects in external trees
     Path to a certificate authority file
   ``TIMEOUT <seconds>``
     Time allowed for file download operations
+  ``NO_EXTRACT 1``
+    Just download the file and do not extract it; the full path to the
+    downloaded file is available as ``<DOWNLOADED_FILE>``.
 
   Update/Patch step options are:
 
@@ -1107,7 +1110,7 @@ macro(_ep_replace_location_tags target_name)
   set(vars ${ARGN})
   foreach(var ${vars})
     if(${var})
-      foreach(dir SOURCE_DIR BINARY_DIR INSTALL_DIR TMP_DIR)
+      foreach(dir SOURCE_DIR BINARY_DIR INSTALL_DIR TMP_DIR DOWNLOADED_FILE)
         get_property(val TARGET ${target_name} PROPERTY _EP_${dir})
         string(REPLACE "<${dir}>" "${val}" ${var} "${${var}}")
       endforeach()
@@ -1875,6 +1878,7 @@ function(_ep_add_download_command name)
       set(cmd   ${CMAKE_COMMAND} -E remove_directory ${source_dir}
         COMMAND ${CMAKE_COMMAND} -E copy_directory ${abs_dir} ${source_dir})
     else()
+      get_property(no_extract TARGET "${name}" PROPERTY _EP_NO_EXTRACT SET)
       if("${url}" MATCHES "^[a-z]+://")
         # TODO: Should download and extraction be different steps?
         if("x${fname}" STREQUAL "x")
@@ -1884,7 +1888,9 @@ function(_ep_add_download_command name)
           string(REGEX MATCH "([^/\\?]+(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip))/.*$" match_result "${url}")
           set(fname "${CMAKE_MATCH_1}")
         endif()
-        if(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
+        if (no_extract)
+          get_filename_component(fname "${url}" NAME)
+        elseif(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
           message(FATAL_ERROR "Could not extract tarball filename from url:\n  ${url}")
         endif()
         string(REPLACE ";" "-" fname "${fname}")
@@ -1898,16 +1904,30 @@ function(_ep_add_download_command name)
         set(cmd ${CMAKE_COMMAND} -P "${download_script}"
           COMMAND)
         set(retries 3)
-        set(comment "Performing download step (download, verify and extract) for '${name}'")
+        if (no_extract)
+          set(steps "download and verify")
+        else ()
+          set(steps "download, verify and extract")
+        endif ()
+        set(comment "Performing download step (${steps}) for '${name}'")
       else()
         set(file "${url}")
-        set(comment "Performing download step (verify and extract) for '${name}'")
+        if (no_extract)
+          set(steps "verify")
+        else ()
+          set(steps "verify and extract")
+        endif ()
+        set(comment "Performing download step (${steps}) for '${name}'")
       endif()
       _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}" "${retries}" "${download_script}")
       list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake
         COMMAND)
-      _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${name}" "${file}" "${source_dir}")
-      list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/extract-${name}.cmake)
+      if (NOT no_extract)
+        _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${name}" "${file}" "${source_dir}")
+        list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/extract-${name}.cmake)
+      else ()
+        set_property(TARGET ${name} PROPERTY _EP_DOWNLOADED_FILE ${file})
+      endif ()
     endif()
   else()
     _ep_is_dir_empty("${source_dir}" empty)

-----------------------------------------------------------------------

Summary of changes:
 Help/release/dev/external-project-no-extract.rst |    6 ++++
 Modules/ExternalProject.cmake                    |   32 ++++++++++++++++++----
 2 files changed, 32 insertions(+), 6 deletions(-)
 create mode 100644 Help/release/dev/external-project-no-extract.rst


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list