<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormal>>Alternatively, consider using a configured header file
that gets included in the places that need those definitions. They're much
easier to deal with than trying to wrap your head around escapings and multiple
platforms and compilers.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>This is what I do. Much, much easier than dealing with ‘nested’
escape sequences.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>mm<br>
<br>
<span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
cmake-bounces@cmake.org [mailto:cmake-bounces@cmake.org] <b>On Behalf Of </b>David
Cole<br>
<b>Sent:</b> Friday, December 17, 2010 5:59 PM<br>
<b>To:</b> Clifford Yapp<br>
<b>Cc:</b> CMake List<br>
<b>Subject:</b> Re: [CMake] Ensuring spaces in CFLAGS reach Visual Studio
project files<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='margin-bottom:12.0pt'>Have you tried add_definitions
for -D flags?<br>
<br>
I'm not sure what's required for getting spaces-in-the-value across, but I
think it's possible.<br>
<br>
Maybe somebody who's done it more recently than me can speak up here?<br>
<br>
Alternatively, consider using a configured header file that gets included in
the places that need those definitions. They're much easier to deal with than
trying to wrap your head around escapings and multiple platforms and compilers.<br>
<br>
<br>
HTH,<br>
David<br>
<br>
<o:p></o:p></p>
<div>
<p class=MsoNormal>On Fri, Dec 17, 2010 at 5:54 PM, Clifford Yapp <<a
href="mailto:cliffyapp@gmail.com">cliffyapp@gmail.com</a>> wrote:<o:p></o:p></p>
<p class=MsoNormal>I have a situation where I need to pass strings with spaces
in them as<br>
definitions in CFLAGS, e.g.<br>
<br>
SET(CMAKE_C_CFLAGS -DINPUT_STRING=\\\"first\\ second\\\"")<br>
<br>
This is NOT working for Visual Studio, which is apparently quite picky<br>
about this - it apparently needs to end up with something like:<br>
<br>
INPUT_STRING="\"first second\""<br>
<br>
I can duplicate the "\" quote structure part (VERY ugly -<br>
\\\"\\\\\\\") but I'm getting stopped cold by the space between first<br>
and second. I've tried quoting variations, and while I can preserve<br>
the space as far as CMake's definition in the cache, the results that<br>
get written into the Visual Studio file ALWAYS seem to break on the<br>
space, quoted or not. e.g. I get:<br>
<br>
INPUT_STRING="\"first<br>
<br>
or<br>
<br>
INPUT_STRING="\"first\<br>
<br>
etc.<br>
<br>
For variable definitions I might be able to live with not using a<br>
space, but some of the arguments I have to pass in are pathnames with<br>
spaces. That's user controlled - I HAVE to be able to handle it, or<br>
in the worst case impose the limitation of no spaces in pathnames on<br>
Windows (ouch).<br>
<br>
Can someone tell me how to quote a space such that it ends up included<br>
in the preprocessor definition line in a Visual Studio project?<br>
<br>
Cheers,<br>
CY<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><o:p></o:p></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>