[CMake] get_file_name_component - how to return true extension

Eric Noulard eric.noulard at gmail.com
Wed Nov 25 16:24:55 EST 2009


2009/11/25 Brian Davis <bitminer at gmail.com>:
>
> for a given file of the form:
>
> openssl-0.9.8a.tar.gz
>
> I call as an example:
>
>  get_filename_component( TAR_EXT openssl-0.9.8a.tar.gz EXT )
>
> and I get for TAR_EXT
>
> .9.1.tar.gz

you should be getting: ".9.8a.tar.gz"
but I think it's a copy/paste typo

> Which is not quite what I was expecting.
> I was expecting .gz and with successive calls I would get  .tar
>
> Is there a mechanism in CMake for getting the trailing extension?

With  get_filename_component I don't think so
but may be you can use some string(xxxx) calls.
example attached.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extension.cmake
Type: application/octet-stream
Size: 277 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091125/284df77a/attachment.obj>


More information about the CMake mailing list