[CMake] Status of escaped characters in cmake?

Brad King brad.king at kitware.com
Wed Jul 20 10:12:45 EDT 2005


David Cole wrote:
> This works for me on CMake 2.0.5 on Windows... Setting a plain $ into a 
> variable is not a problem and doesn't need escaping unless it's followed 
> by an opening curly brace '{'. Even then escaping doesn't seem to be the 
> solution - that tricky bit has to be done in two stages (as far as I can 
> tell...) :-)
> 
> Like so:
> MESSAGE(SEND_ERROR "Setting DOLLAR_LITERAL to $")
> 
> SET(DOLLAR_LITERAL "$")
> MESSAGE(SEND_ERROR "Stage1-DOLLAR_LITERAL='${DOLLAR_LITERAL}'")

This will work well for all CMake versions.  In version 2.2 and later 
the escape should work for a dollar:

MESSAGE("Unexpanded: \${VAR}")

> There's some way to jam ascii character values by number into variables, 
> too, but I can't remember where I saw that right now.

STRING(ASCII ...)

-Brad


More information about the CMake mailing list