diff options
author | Brad King <brad.king@kitware.com> | 2012-09-18 20:02:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-09-18 20:06:21 (GMT) |
commit | 8da0fe4b535103484960c7f5c60461b1349854dd (patch) | |
tree | 21871d62d6ede27989a0aa04a66ea89ace681d85 /Modules/ExternalProject.cmake | |
parent | 70169ec1bfa5adc4bc99c1777f44c6f8446bba04 (diff) | |
download | CMake-8da0fe4b535103484960c7f5c60461b1349854dd.zip CMake-8da0fe4b535103484960c7f5c60461b1349854dd.tar.gz CMake-8da0fe4b535103484960c7f5c60461b1349854dd.tar.bz2 |
ExternalProject: Add DOWNLOAD_NAME option
Some download URLs do not have the filename embedded in the url.
Add an interface to specify the local filename explicitly.
Suggested-by: James Goppert <james.goppert@gmail.com>
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r-- | Modules/ExternalProject.cmake | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index cd77ba4..56f8f9e 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -9,6 +9,7 @@ # [TMP_DIR dir] # Directory to store temporary files # [STAMP_DIR dir] # Directory to store step timestamps # #--Download step-------------- +# [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 # [CVS_REPOSITORY cvsroot] # CVSROOT of CVS repository @@ -1092,6 +1093,7 @@ function(_ep_add_download_command name) get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY) get_property(hg_repository TARGET ${name} PROPERTY _EP_HG_REPOSITORY ) get_property(url TARGET ${name} PROPERTY _EP_URL) + get_property(fname TARGET ${name} PROPERTY _EP_DOWNLOAD_NAME) # TODO: Perhaps file:// should be copied to download dir before extraction. string(REGEX REPLACE "^file://" "" url "${url}") @@ -1272,7 +1274,9 @@ function(_ep_add_download_command name) else() if("${url}" MATCHES "^[a-z]+://") # TODO: Should download and extraction be different steps? - string(REGEX MATCH "[^/\\?]*$" fname "${url}") + if("x${fname}" STREQUAL "x") + string(REGEX MATCH "[^/\\?]*$" fname "${url}") + endif() if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$") string(REGEX MATCH "([^/\\?]+(\\.|=)(bz2|tar|tgz|tar\\.gz|zip))/.*$" match_result "${url}") set(fname "${CMAKE_MATCH_1}") |