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

Alexander Neundorf a.neundorf-work at gmx.net
Tue Dec 8 18:36:37 EST 2009


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


More information about the CMake mailing list