Got another idea. We can use default name like 'archive.tar'. Seems that internal type of archive determined automatically and doesn't depends on the filename. I've tried one example for each extension: 7z, tar.bz2, tar.gz, tar.xz, tbz2, tgz, txz, zip and it just works. Patch attached.

Ruslo

On 01-Jul-16 15:01, Ruslan Baratov via cmake-developers wrote:
Hi,

With attached patch it's possible to extract name from URLs like 'https://.../archive.tar.gz?a=x&b=y'.

Ruslo


>From 5284eedbd1b038aab2eab73252eb41914afb14e1 Mon Sep 17 00:00:00 2001
From: Ruslan Baratov <ruslan_bara...@yahoo.com>
Date: Tue, 5 Jul 2016 16:17:12 +0300
Subject: [PATCH] Use default filename if extracting from URL failed

---
 Modules/ExternalProject.cmake | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 2ff18fc..4c35c8b 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1880,7 +1880,10 @@ function(_ep_add_download_command name)
         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}")
+          # Do not put warning message here. If everything works OK it will
+          # only distract. If unpack will fail the standard name can be found in logs.
+          # (see _ep_write_extractfile_script function)
+          set(fname "archive.tar")
         endif()
         string(REPLACE ";" "-" fname "${fname}")
         set(file ${download_dir}/${fname})
-- 
1.9.1

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to