[CMake] REGEX ^ and $ do not match on multi-line <input>

Brandon Van Every bvanevery at gmail.com
Sun Jul 22 12:10:03 EDT 2007


On 7/22/07, Mathieu Malaterre <mathieu.malaterre at gmail.com> wrote:
> Hi Brandon,
>
>   I think you can use this trick to work around your issue:
>
> http://www.cmake.org/pipermail/cmake/2007-May/014317.html
>
>   STRING(REGEX REPLACE "\r?\n" ";" ENT "${input}")
>   FOREACH(line ${ENT})
>   # do the match on each line

Thanks for the cross-platform \r\n CR+LF hint.  Last night I tried to
match \n, but it didn't seem to be working.  Actually it was matching
fine, but my output only had \n in it, and a Windows shell needs CR+LF
to go down a line.

Injecting semicolons is really dangerous though.  What if your file
already has semicolons?  In my code, FILE(...) followed by
STRING(REGEX ...) is destroying the semicolons in the file.  I need to
get to the bottom of that.


Cheers,
Brandon Van Every


More information about the CMake mailing list