[CMake] STRING(CONFIGURE ...) problem with too-early variable substitution

Zachary Pincus zpincus at stanford.edu
Sat Jan 14 13:49:52 EST 2006


>> Is there any good way to get the literal '@...@' or '$  
>> {...}' (excluding the quotes) into a CMake variable?
>
> You have to escape the @ symbols with a backslash:
>
>   SET(to_configure "/path/to/\@directory\@")

In my hands (using a CMake CVS build from a week ago), these lines:

SET(bar "baz")
SET(foo "\@bar\@")
MESSAGE("${foo}")

produces this error:

> CMake Error: Invalid escape sequence \@
>
> Syntax error in cmake code at
> /Users/zpincus/Documents/Research/Theriot Lab/Development/ITK  
> Wrapping/WrapITK/ExternalProjects/PyBuffer/CMakeLists.txt:4:
> syntax error, unexpected cal_ERROR, expecting $end (2), when  
> parsing string "\@bar\@"
>
> \@bar\@

Line 4 is the SET(foo "\@bar\@") line.

Zach


More information about the CMake mailing list