[CMake]
Passing a string through a macro, without escaping (\) woes!
Josef Karthauser
joe.karthauser at geomerics.com
Wed Oct 31 09:32:00 EDT 2007
I've got a problem with backslashes in strings, and macros....
This works:
SET(PATH "c:/test/path")
FILE(TO_NATIVE_PATH ${PATH} CPATH)
MESSAGE("Path: ${CPATH}")
It displays "Path: c:\test\path" as expected (on windows)
However this fails:
MACRO(MYMESSAGE MSG)
MESSAGE("${MSG}")
ENDMACRO(MYMESSAGE MSG)
MYMESSAGE("MyPath: ${CPATH}")
With the error:
syntax error, unexpected cal_ERROR, expecting $end (17), when
parsing string "MyPath: c:\test\path"
MyPath: c:\test\path
CMake Error: Invalid escape sequence \P
How do I prevent the parsing of \P?
Joe
More information about the CMake
mailing list