[CMake] STRING(REPLACE eats semi-colons

Brandon Van Every bvanevery at gmail.com
Thu Aug 2 22:56:54 EDT 2007


On 8/2/07, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> JD Smith wrote:
> >
> > set( f "this; ...is: a; test")
> > MESSAGE(${f})
> > STRING(REPLACE is was f ${f})
> > MESSAGE(${f})
> >
> > Probably to do with the syntax for lists, but is there a way to avoid
> > STRING(REPLACE from eating semi-colons?  I'm trying to replace a sed
> > call with pure CMAKE, but in text replacing on an XML file, it's doing
> > damage.
> The problem is in the message command.
>
> Try message("${f}")

No, the problem is in the STRING command.  It should be
STRING(REPLACE is was f "${f}")

The original poster's code is equivalent to
STRING(REPLACE is was f "this" "...is: a" " test")
which doesn't contain any semicolons.

You're right that the message command *also* needs to be "${f}"

Cheers,
Brandon Van Every


More information about the CMake mailing list