c++ - Add raw string macro using target_compile_definitions -


i want add cmakelists.txt raw string macro equivalent of:

#if defined(q_os_win) #define commport_name r"(\\.\com1)" #elif defined(q_os_unix) #define commport_name "/dev/ttys0" #else #error "platform not supported" #endif 

i tried following:

if(win32)     target_compile_definitions(${project_name} private -dcommport_name="r"(\\.\com1)"") elseif(unix)     target_compile_definitions(${project_name} private -dcommport_name="/dev/ttys0") else()     message(fatal_error "platform not supported") endif()  

but error:

cmake warning (dev) @ path/to/project/cmakelists.txt:68: syntax warning in cmake code @ column 85

argument not separated preceding token whitespace. warning project developers. use -wno-dev suppress it.

is possible use kind of quotes, '' in bash prevent occurrence of above error?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -