[CMake] REGEX ^ and $ do not match on multi-line <input>
David Cole
david.cole at kitware.com
Sun Jul 22 12:43:28 EDT 2007
See also the details in this thread:
http://www.cmake.org/pipermail/cmake/2007-May/014222.html
...which describes how to iterate a text file line by line using
"FILE(READ", converting to a list preserving existing semi-colons, and
iterating the lines with cmake FOREACH...
HTH,
David
On 7/22/07, Brandon Van Every <bvanevery at gmail.com> wrote:
>
> 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
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070722/1c32c45f/attachment.htm
More information about the CMake
mailing list