Yes so I did find the string regexp functions and the following seems to be working for me.<br><br>For example (in case anyone else sees this thread and finds it helpful) <br><br>SET( FILE_NAME openssl-0.9.8a.tar.gz )<br>STRING( REGEX REPLACE "[.]gz" "" FILE_NAME_NO_EXT ${FILE_NAME} )<br>
STRING( REGEX REPLACE "[.]tar" "" FILE_NAME_NO_EXT ${FILE_NAME_NO_EXT} )<br>MESSAGE( STATUS "File name only is ${FILE_NAME_NO_EXT}" )<br><br>Displays the following in the CMake GUI output window<br>
<br>File name only is openssl-0.9.8a<br><br> STRING( REGEX REPLACE ".*([.]tar).*" "\\1" TAR_EXT ${FILE_NAME} )<br> <br> STRING( REGEX REPLACE ".*([.]gz).*" "\\1" GZ_EXT ${FILE_NAME} )<br>
<br> MESSAGE( STATUS "File extension is ${TAR_EXT}" )<br> MESSAGE( STATUS "File extension is ${GZ_EXT}" )<br><br>Outputs:<br><br>File extension is .tar
<p style="margin: 0px; text-indent: 0px;"></p><p style="margin: 0px; text-indent: 0px;">File extension is .gz</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">So TAR_EXT and GZ_EXT can be tested for and zxvf or xvf can then be used appropriately amd TAR_OPTS set accordingly.</p>
<p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">Thanks,<br></p><br>Brian<br><br><br><div class="gmail_quote">On Wed, Nov 25, 2009 at 3:24 PM, Eric Noulard <span dir="ltr"><<a href="mailto:eric.noulard@gmail.com">eric.noulard@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">2009/11/25 Brian Davis <<a href="mailto:bitminer@gmail.com">bitminer@gmail.com</a>>:<br>
<div class="im">><br>
> for a given file of the form:<br>
><br>
> openssl-0.9.8a.tar.gz<br>
><br>
> I call as an example:<br>
><br>
> get_filename_component( TAR_EXT openssl-0.9.8a.tar.gz EXT )<br>
><br>
> and I get for TAR_EXT<br>
><br>
> .9.1.tar.gz<br>
<br>
</div>you should be getting: ".9.8a.tar.gz"<br>
but I think it's a copy/paste typo<br>
<div class="im"><br>
> Which is not quite what I was expecting.<br>
> I was expecting .gz and with successive calls I would get .tar<br>
><br>
> Is there a mechanism in CMake for getting the trailing extension?<br>
<br>
</div>With get_filename_component I don't think so<br>
but may be you can use some string(xxxx) calls.<br>
example attached.<br>
<font color="#888888"><br>
--<br>
Erk<br>
Membre de l'April - « promouvoir et défendre le logiciel libre » -<br>
<a href="http://www.april.org" target="_blank">http://www.april.org</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Brian J. Davis<br><br>