4

I need to get this as a result in the preprocessor definitions of the msvc generator:

MYPATH=\"d:\\;.\\Lib\"

But when I use the following escape sequence in set_source_files_properties:

set_source_files_properties(source.c PROPERTIES COMPILE_FLAGS "-DMYPATH=\\\"d:\\\;.\\\\Lib\\\"")

the generated result is: MYPATH=\"d:\";".\Lib\"

Note the double-quoted semicolon. Is there a quoting workaround to allow unquoted semicolons?

David
  • 9,635
  • 5
  • 62
  • 68

1 Answers1

3

AFAIR, cmake treat ; as list separator, so it behaves in such way for properties as per documentation.

PROPERTY [value1 [value2 ...]

Probably you've better to try something like this - make it string variable and then try substitute it.

set(MY_PATH "\"d:\\\;.\\\\Lib\\\"")
set_source_files_properties(source.c PROPERTIES COMPILE_FLAGS ${MY_PATH})

HTH, Sergey

Sergei Nikulov
  • 5,029
  • 23
  • 36