<div>I was able to fix my problem by adding the replacement of "\\\"" (escaped quote) before the actual replacement of the non-escaped quote in the generator.</div><div><br></div><div>Here is the patch:</div>
<div><br></div><div><div><font face="courier new, monospace">diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx</font></div><div><font face="courier new, monospace">index 9369af6..5371d0f 100644</font></div>
<div><font face="courier new, monospace">--- a/Source/cmVisualStudioGeneratorOptions.cxx</font></div><div><font face="courier new, monospace">+++ b/Source/cmVisualStudioGeneratorOptions.cxx</font></div><div><font face="courier new, monospace">@@ -16,6 +16,7 @@ inline std::string cmVisualStudioGeneratorOptionsEscapeForXML(const char* s)</font></div>
<div><font face="courier new, monospace"> {</font></div><div><font face="courier new, monospace"> std::string ret = s;</font></div><div><font face="courier new, monospace"> cmSystemTools::ReplaceString(ret, "&", "&amp;");</font></div>
<div><font face="courier new, monospace">+ cmSystemTools::ReplaceString(ret, "\\\"", "&quot;");</font></div><div><font face="courier new, monospace"> cmSystemTools::ReplaceString(ret, "\"", "&quot;");</font></div>
<div><font face="courier new, monospace"> cmSystemTools::ReplaceString(ret, "<", "&lt;");</font></div><div><font face="courier new, monospace"> cmSystemTools::ReplaceString(ret, ">", "&gt;");</font></div>
</div><div><br></div><div>Best,</div><div><br clear="all"><font color="#333333">François Best</font><div><div><font color="#333333">Hardware & Software Engineer</font></div><div><font color="#333333"><br></font></div>
<div><font color="#6666cc">Eiosis - <a href="http://www.eiosis.com/" target="_blank">http://www.eiosis.com/</a></font></div></div><br>
<br><br><div class="gmail_quote">2012/7/12 François Best <span dir="ltr"><<a href="mailto:francois.best@eiosis.com" target="_blank">francois.best@eiosis.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Okay, none of these solutions give the expected result.. <div><br></div><div>What is strange is that the ampersand character is correctly expanded into the &amp; tag, and in
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">cmVisualStudioGeneratorOptions</span><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">.cxx</span> I can see that replacement, as well as the quote being transformed (theoretically) into the &quot; tag..</div>
<div><br></div><div>Another thing to note is that the list of options in the generated project looks like a CMake list, semicolon separated, with every element encapsulated into escaped quotes. While this is a safe way to handle spaces for every element, it prevents from using quotes in the options themselves.. </div>
<div>Basically, the tool I'm using is expecting quotes around the value of the option only.</div><div><br></div><div>The only other way I see to do this is to process the generated solution file post-generation. As I didn't see such a thing in CMake, maybe a script launching both the CMake generation and the replacement of (let's say) @quote@ tags could do the trick, although this needs to be done in every project in the tree, damn.. </div>
<div><br></div><div>I'll run a debug build of CMake tomorrow to follow the generation, to have a better understanding of the problem.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Best,</div><div>
<br></div></font></span><div><div><div class="im"><font color="#333333">François Best</font><div>
<div><font color="#333333">Hardware & Software Engineer</font></div><div><font color="#333333"><br></font></div><div><font color="#6666cc">Eiosis - <a href="http://www.eiosis.com/" target="_blank">http://www.eiosis.com/</a></font></div>
</div><br>
<br><br></div><div><div class="h5"><div class="gmail_quote">2012/7/11 François Best <span dir="ltr"><<a href="mailto:francois.best@eiosis.com" target="_blank">francois.best@eiosis.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi David, <div><br></div><div>Unfortunately, even that syntax still removes the quotes in the generated project, but thanks for the heads up!</div><div><br></div><div>@Andreas: I'm going to check your solution, thanks!</div>
<div><br></div><div>Best, </div><div><div><br clear="all"><font color="#333333">François Best</font><div><div><font color="#333333">Hardware & Software Engineer</font></div><div><font color="#333333"><br></font></div>
<div>
<font color="#6666cc">Eiosis - <a href="http://www.eiosis.com/" target="_blank">http://www.eiosis.com/</a></font></div></div><br>
<br><br></div><div class="gmail_quote">2012/7/11 David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com" target="_blank">david.cole@kitware.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>
The syntax in your original post is incorrect.<div><br><br> set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} /Test1:"Test1")<br><br></div>should be:<div><br><br> set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Test1:\"Test1\"")<br>
<br></div>i.e., to CMake, the set call should look like two arguments here: the variable name and a double quoted string with any nested quotes escaped with a \ character<div><br></div><div>The C and CXX flags variables are all single string values with multiple flags separated by spaces. With your original syntax, all the spaces get turned into semi-colons because there are multiple (more than just 2) arguments to the set command.</div>
<div><br></div><div><br></div><div>HTH,</div><div>David</div><div><br></div>
<br></div></div><span><font color="#888888">--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></font></span></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>