Have you tried add_definitions for -D flags?<br><br>I&#39;m not sure what&#39;s required for getting spaces-in-the-value across, but I think it&#39;s possible.<br><br>Maybe somebody who&#39;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&#39;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><br><div class="gmail_quote">On Fri, Dec 17, 2010 at 5:54 PM, Clifford Yapp <span dir="ltr">&lt;<a href="mailto:cliffyapp@gmail.com">cliffyapp@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
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=\\\&quot;first\\ second\\\&quot;&quot;)<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=&quot;\&quot;first second\&quot;&quot;<br>
<br>
I can duplicate the &quot;\&quot; quote structure part (VERY ugly -<br>
\\\&quot;\\\\\\\&quot;) but I&#39;m getting stopped cold by the space between first<br>
and second.  I&#39;ve tried quoting variations, and while I can preserve<br>
the space as far as CMake&#39;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=&quot;\&quot;first<br>
<br>
or<br>
<br>
INPUT_STRING=&quot;\&quot;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&#39;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><br>
</blockquote></div><br>