[CMake] Double quotes being removed Windows removing compiler flags

François Best francois.best at eiosis.com
Wed Jul 11 11:09:01 EDT 2012


Hi all,

I'm following up on this subject, since I have the same problem as Luke,
which is to include quotes in VS 2008 options.

For example, in a test project, the following lines:

set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} /Test1:"Test1")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} "/Test2:\"Test2\"")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} /Test3:\"Test3\")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} "/Test4:\\\"Test4\\\"")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} /Test5:\\\"Test5\\\")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}
"/Test6:"Test6"")

Will generate a project file which content looks like this:
AdditionalOptions=""/Test1:Test1";"/Test2:Test2";"/Test3:Test3";"/Test4:\"Test4\"";"/Test5:\"Test5\"";"/Test6:&quot";"Test6&quot";"""

Leading to the following result in the command-line options:
"/Test1:Test1";"/Test2:Test2";"/Test3:Test3";"/Test4:\"Test4\"";"/Test5:\"Test5\"";"/Test6:&quot";"Test6&quot";""


What I'm looking for is a way to achieve the following:

In the project file:
AdditionalOptions="/foo:"bar""

Interpreted in the command-line as
/foo:"bar"

We both tried every combination of escaping quotes, but without any success.

Original thread (if reply is broken):
http://www.cmake.org/pipermail/cmake/2012-April/050081.html

Best regards,

François Best
Hardware & Software Engineer

Eiosis - http://www.eiosis.com/ <http://www.slatedigital.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120711/227dc6e8/attachment.htm>


More information about the CMake mailing list