diff options
author | Craig Scott <craig.scott@crascit.com> | 2020-04-01 23:50:36 +1100 |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2020-04-03 22:05:55 +1100 |
commit | 0331092ce6cacca16b37c39186427f3baf1e3164 (patch) | |
tree | 964e9703ab741ba65cb9cc4a44480de253a840c0 /Modules | |
parent | f4e4b41a19ac5accf48e3a70c93f7d901df05136 (diff) | |
download | cmake-0331092ce6cacca16b37c39186427f3baf1e3164.tar.gz |
FetchContent: Add support for DOWNLOAD_NO_EXTRACT
Fixes: #20526
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FetchContent.cmake | 22 | ||||
-rw-r--r-- | Modules/FetchContent/CMakeLists.cmake.in | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index 0e98f49e8d..400754ccfb 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -796,6 +796,8 @@ function(__FetchContent_directPopulate contentName) SUBBUILD_DIR SOURCE_DIR BINARY_DIR + # We need special processing if DOWNLOAD_NO_EXTRACT is true + DOWNLOAD_NO_EXTRACT # Prevent the following from being passed through CONFIGURE_COMMAND BUILD_COMMAND @@ -846,6 +848,26 @@ function(__FetchContent_directPopulate contentName) set(ARG_EXTRA "${ARG_EXTRA} \"${arg}\"") endforeach() + if(ARG_DOWNLOAD_NO_EXTRACT) + set(ARG_EXTRA "${ARG_EXTRA} DOWNLOAD_NO_EXTRACT YES") + set(__FETCHCONTENT_COPY_FILE +" +ExternalProject_Get_Property(${contentName}-populate DOWNLOADED_FILE) +get_filename_component(dlFileName \"\${DOWNLOADED_FILE}\" NAME) + +ExternalProject_Add_Step(${contentName}-populate copyfile + COMMAND \"${CMAKE_COMMAND}\" -E copy_if_different + \"<DOWNLOADED_FILE>\" \"${ARG_SOURCE_DIR}\" + DEPENDEES patch + DEPENDERS configure + BYPRODUCTS \"${ARG_SOURCE_DIR}/\${dlFileName}\" + COMMENT \"Copying file to SOURCE_DIR\" +) +") + else() + unset(__FETCHCONTENT_COPY_FILE) + endif() + # Hide output if requested, but save it to a variable in case there's an # error so we can show the output upon failure. When not quiet, don't # capture the output to a variable because the user may want to see the diff --git a/Modules/FetchContent/CMakeLists.cmake.in b/Modules/FetchContent/CMakeLists.cmake.in index 0095b111bf..45e4df03ef 100644 --- a/Modules/FetchContent/CMakeLists.cmake.in +++ b/Modules/FetchContent/CMakeLists.cmake.in @@ -21,3 +21,5 @@ ExternalProject_Add(${contentName}-populate USES_TERMINAL_DOWNLOAD YES USES_TERMINAL_UPDATE YES ) + +@__FETCHCONTENT_COPY_FILE@ |