[CMake] FindPerlLibs.cmake bug or I don't understand string regex replace

Hugh Sorby h.sorby at auckland.ac.nz
Mon Dec 21 16:55:14 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Finally I have gotten around to doing this.  I have created this patch
on Linux so hopefully missing line ends are back.

Alexander Neundorf wrote:
> On Monday 07 December 2009, Hugh Sorby wrote:
>> I have been trying to get FindPerlLibs to work on windows (Vista).  It's
>> taken me a while but I think I have found the problem.  As far as I have
>> been able to identify the string regex replace call returns (what I
>> think is) an undesirable result.  Below is an example to illustrate the
>> problem:
>>
>>     SET( TEST_STRING  "test stuff libperl='libperl23.lib'" "\n" )
>>     string(REGEX REPLACE "libperl='([^']+)'" "\\1" TEST_OUTPUT_VARIABLE
>> ${TEST_STRING} )
>>     MESSAGE( STATUS "TEST OUT: (${TEST_OUTPUT_VARIABLE})
>> (${CMAKE_MATCH_0}) (${CMAKE_MATCH_1})" )
>>
>> where: TEST_STRING is my approximation to the string(s) return from
>> ${PERL_EXECUTABLE} -V:libperl
>>
>> The output is:
>>
>> -- TEST OUT: (test sturff libperl23.lib
>> ) (libperl='libperl23.lib') (libperl23.lib)
>>
>>
>> So the carriage return is the unexpected bit for me, for the
>> TEST_OUTPUT_VARIABLE.  This is why I have put parentheses around the
>> variables so that I could see hidden characters.
>>
>> The attached patch is what I came up with to address the problem, plus
>> some other random stuff that I did whilst trying to ascertain what was
>> going on.  This is a windows patch so don't try and apply it on Linux.
>>
>> Also, I took this FindPerlLibs.cmake from the CMake CVS repository
>> recently, like today.
> 
> Hmm, it looks like this patch changes all line ends of the file.
> Can you post a patch which keeps the line ends ?
> 
> Alex

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksv7sIACgkQ9LYoSqnnwfC5xwCfeYL4f1mSKeBCsoFi5i4/aUIy
xrsAn3q692FaRRWkwB0Ovnm7YuZ4mtq/
=A3En
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: FindPerlLibs.cmake.patch
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091222/41dca96b/attachment-0001.asc>


More information about the CMake mailing list