[CMake] problem getting defines quoted properly

Andreas Pakulat apaku at gmx.de
Fri Jan 14 14:25:25 EST 2011


Hi,

I'm trying to set a define so that it can be used as string-literal in
C++ code using add_definitions. This:

add_definition( -DMYFOO=\"BAR BAZ\" )

works fine on linux, but breaks with MSVC6 on windows. I always thought
I understood cmake's quoting rules, but apparently I'm wrong :(

I've already tried:
add_definition( -DMYFOO=\\\"BAR BAZ\\\" )

What I didn't think of trying when I was at the machine is
add_definition( -DMYFOO=\\"BAR BAZ\\" )

Would that be the correct one? Or do I need even more \?

Andreas

-- 
You had some happiness once, but your parents moved away, and you had to
leave it behind.


More information about the CMake mailing list