[Cmake] regex error ? in 2.1

Brad King brad.king at kitware.com
Mon Jun 7 15:11:42 EDT 2004


Nicolas Belan wrote:

> Hi all,
> 
> i am just starting using cmake, but i can not understand regex arguments
> behavior ...
> if you write:
> SET(A foo)
> SET(B bar)
> STRING(REGEX REPLACE "foo" "bar" AB ${A} ${B})
> 
> for me it is the same as doing:
> STRING(REGEX REPLACE "foo" "bar" AB "foo bar")
> 
> but if you look code, this is what is happening:
> STRING(REGEX REPLACE "foo" "bar" AB "foobar") // notice space deleted
> 
> so, why don't you concatenate args with spaces ?

A concatenation choice had to be made.  We chose to concatenate without 
spaces.  To get the behavior you want, use

STRING(REGEX REPLACE "foo" "bar" AB "${A} ${B}")

-Brad



More information about the Cmake mailing list