Hi,
With attached patch it's possible to extract name from URLs like
'https://.../archive.tar.gz?a=x&b=y'.
Ruslo
>From 0bab30e859541dde51e9e21d3a22ec80a649a30a Mon Sep 17 00:00:00 2001
From: Ruslan Baratov <ruslan_bara...@yahoo.com>
Date: Fri, 1 Jul 2016 14:55:29 +0300
Subject: [PATCH] Add pattern for extracting file name from URL
Add one more pattern like 'https://.../archive.tar.gz?a=x&b=y'
to try to extract name of the archive from URL
---
Modules/ExternalProject.cmake | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 2ff18fc..96f315f 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1880,7 +1880,12 @@ 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}")
+ # Try: https://.../archive.tar.gz?a=x&b=y
+ string(REGEX MATCH "^.*/([^/]*)\\?.*$" match_result "${url}")
+ set(fname "${CMAKE_MATCH_1}")
+ if(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}")
+ endif()
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