summaryrefslogtreecommitdiffstats
path: root/Modules/ExternalProject.cmake
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2011-03-04 21:51:46 (GMT)
committerDavid Cole <david.cole@kitware.com>2011-03-04 22:09:41 (GMT)
commit7f10b137e1e75a57346b566a8818718b7f851625 (patch)
tree015a791124d45d324e95bfe3507d10fbea98f7c4 /Modules/ExternalProject.cmake
parented1cd2daf6bedbfc9870852184940494bfacec42 (diff)
downloadCMake-7f10b137e1e75a57346b566a8818718b7f851625.zip
CMake-7f10b137e1e75a57346b566a8818718b7f851625.tar.gz
CMake-7f10b137e1e75a57346b566a8818718b7f851625.tar.bz2
ExternalProject: Extract file names from more urls
Notably, downloads from sourceforge.net and gitweb snapshots.
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r--Modules/ExternalProject.cmake13
1 files changed, 9 insertions, 4 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 3de6b7e..390b8f9 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -403,11 +403,11 @@ endfunction(_ep_write_verifyfile_script)
function(_ep_write_extractfile_script script_filename name filename directory)
set(args "")
- if(filename MATCHES "(\\.bz2|\\.tar\\.gz|\\.tgz|\\.zip)$")
+ if(filename MATCHES "(\\.|=)(bz2|tar\\.gz|tgz|zip)$")
set(args xfz)
endif()
- if(filename MATCHES "\\.tar$")
+ if(filename MATCHES "(\\.|=)tar$")
set(args xf)
endif()
@@ -1109,10 +1109,15 @@ 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(NOT "${fname}" MATCHES "\\.(bz2|tar|tgz|tar\\.gz|zip)$")
+ string(REGEX MATCH "[^/\\?]*$" fname "${url}")
+ 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}")
+ endif()
+ if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$")
message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}")
endif()
+ string(REPLACE ";" "-" fname "${fname}")
set(file ${download_dir}/${fname})
get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT)
_ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}" "${md5}")