[cmake-developers] [patch] One more pattern for extracting file name from URL

Ruslan Baratov ruslan_baratov at yahoo.com
Tue Jul 5 14:01:36 EDT 2016


On 05-Jul-16 20:31, Ben Boeckel wrote:
> On Tue, Jul 05, 2016 at 19:49:46 +0300, Ruslan Baratov wrote:
>> Archive can be unpacked by "cmake -E tar xf" which detect type
>> automatically as far as I understand. At least this one used internally
>> by ExternalProject (see the testing I've made before).
> CMake is not my go-to tool for extracting files though (and similarly
> for others I imagine), so running `tar xf archive.tar` and getting an
> error because it is actually a .tar.gz (or even a .zip) file is not
> nice.
Well it's never too late to learn something new. Also `tar` is not 
widely used on Windows so to write nice code you should convert it to 
`cmake -E tar`. That the whole point of `cmake -E` feature.
I don't see the problem here, it was used internally, unpack archive for 
you and you can do what you want with **unpacked** sources. Anyway you 
can always force the name with |DOWNLOAD_NAME.|

>> So even if it seems that archive name is `|archive.tar.gz` it should be
>> downloaded to
>> `||gitlab-ce-v8.9.3-5e546d9b4728fc9c9623992a678cbea9eb2098f1.tar.gz`. So
>> I think it's easily can be file with another extension.|
> Here's another idea: add an `OUTPUT_FILE <var>` keyword argument to
> `file(DOWNLOAD)` to get the actual filename after content disposition
> resolution (probably similar for 30x rewrites). This would also be
> useful for things other than ExternalProject.
>
> --Ben
Good idea, I'll be happy to see this feature in future CMake releases.

Ruslo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160705/fb228a4a/attachment.html>


More information about the cmake-developers mailing list