[CMake] what is wrong with this snippet? (bug?)

Matthew Woehlke mw_triad at users.sourceforge.net
Thu Nov 20 15:00:04 EST 2008

set("var with space" wacky CACHE STRING "" FORCE)
message(STATUS "This is !BANG: ${!BANG}")
message(STATUS "This is var with space: ${var with space}")

The above snippet (as expected) causes a CMake error. What's interesting 
is that the error is in the message, not the set. More so, the variables 
do indeed end up in the cache!

The utility of a variable that can't be referenced seems... dubious. 
Should CMake prevent this?

(cmake 2.6-2)

Please do not quote my e-mail address unobfuscated in message bodies.
C++ is for people who want to be able to not just shoot themselves in 
the foot, but do it with a rocket launcher. -- Igor Peshansky

More information about the CMake mailing list