diff options
author | Brad King <brad.king@kitware.com> | 2009-07-13 14:46:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-07-13 14:46:32 (GMT) |
commit | a03bb5a28f42767d1494cb17971103faae5b409b (patch) | |
tree | 469da658f8fb6bc47d2802d841d266c969da6f8a /Modules | |
parent | 87434fc38fafcd9ec49c2cdec2bbf7f25e46820c (diff) | |
download | CMake-a03bb5a28f42767d1494cb17971103faae5b409b.zip CMake-a03bb5a28f42767d1494cb17971103faae5b409b.tar.gz CMake-a03bb5a28f42767d1494cb17971103faae5b409b.tar.bz2 |
ENH: Check tarball filename in ep_add
This teaches the ExternalProject module to check the download URL file
name. If it is not a tarball (.tar, .tgz, .tar.gz) it is an error
because UntarFile does not yet understand other archive formats.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/ExternalProject.cmake | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 5465875..1adcd79 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -512,8 +512,11 @@ function(_ep_add_download_command name) else() if("${url}" MATCHES "^[a-z]+://") # TODO: Should download and extraction be different steps? - string(REGEX MATCH "\\.(tar|tgz|tar\\.gz)" ext "${url}") - set(file ${download_dir}/${name}${ext}) + string(REGEX MATCH "[^/]*$" fname "${url}") + if(NOT "${fname}" MATCHES "\\.(tar|tgz|tar\\.gz)$") + message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}") + endif() + set(file ${download_dir}/${fname}) set(cmd ${CMAKE_COMMAND} -Dremote=${url} -Dlocal=${file} -P ${CMAKE_ROOT}/Modules/DownloadFile.cmake COMMAND) set(comment "Performing download step (download and extract) for '${name}'") |