Are you using &quot;FILE(WRITE&quot;...?<div><br></div><div>What version of CMake?</div><div><br></div><div>This should work. Send the CMake code snippet you are using to try to do this so that we can see what might be wrong.</div>
<div><br></div><div>If using older CMake (2.4.something) then you may have to do:</div><div>  set(DOLLAR &quot;$&quot;)</div><div>  file(WRITE blah &quot;${DOLLAR}{varNameHere}&quot;)</div><div><br></div><div>...but escaping the &quot;$&quot; inside a string literal has worked for quite some time now... I&#39;d like to know if you have a different use case or are just seeing older-versioned CMake behavior.</div>
<div><br></div><div><br><br><div class="gmail_quote">On Wed, Sep 30, 2009 at 3:54 AM,  <span dir="ltr">&lt;<a href="mailto:fred.antares@free.fr">fred.antares@free.fr</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">Quoting Marcel Loose &lt;<a href="mailto:loose@astron.nl">loose@astron.nl</a>&gt;:<br>
<br>
&gt; On Wed, 2009-09-30 at 09:28 +0200, <a href="mailto:fred.antares@free.fr">fred.antares@free.fr</a> wrote:<br>
&gt; &gt; Quoting Jeroen Dierckx &lt;<a href="mailto:jeroen.dierckx@gmail.com">jeroen.dierckx@gmail.com</a>&gt;:<br>
&gt; &gt;<br>
&gt; &gt; &gt; On Wed, Sep 30, 2009 at 8:32 AM, &lt;<a href="mailto:fred.antares@free.fr">fred.antares@free.fr</a>&gt; wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Hi,<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; I&#39;ve seen a previous discussion on this subject, but unfortunately,<br>
&gt; none of<br>
&gt; &gt; &gt; &gt; the<br>
&gt; &gt; &gt; &gt; given solutions (as described on<br>
&gt; &gt; &gt; &gt; <a href="http://www.cmake.org/Wiki/CMake:VariablesListsStrings" target="_blank">http://www.cmake.org/Wiki/CMake:VariablesListsStrings</a>) seem to work in<br>
&gt; my<br>
&gt; &gt; &gt; &gt; case.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; I&#39;m using CMake to generate an XML config file, and one of the tags<br>
&gt; must<br>
&gt; &gt; &gt; &gt; have an<br>
&gt; &gt; &gt; &gt; argument as follows: args=&quot;${serverConfigChanged}&quot;. The XML is used by<br>
&gt; &gt; &gt; &gt; CruiseControl, and unfortunately, it uses the same variable syntax as<br>
&gt; &gt; &gt; &gt; CMake. I<br>
&gt; &gt; &gt; &gt; tried almost every combination of escaping, double dollars, but<br>
&gt; couldn&#39;t<br>
&gt; &gt; &gt; &gt; get the<br>
&gt; &gt; &gt; &gt; correct output.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Is there some way to achieve that directly from the CMakeList.txt, or<br>
&gt; &gt; &gt; &gt; should I<br>
&gt; &gt; &gt; &gt; do that in the generator code ?<br>
&gt; &gt; &gt; &gt;<br>
&gt;<br>
&gt; Hi Jeroen,<br>
&gt;<br>
&gt; What about:<br>
&gt;<br>
&gt; file(WRITE /tmp/dummy.xml &quot;args=\&quot;\${serverConfigChanged}\&quot;\n&quot;)<br>
&gt;<br>
&gt; That works for me. You must escape the double quotes (&quot;) and the dollar<br>
&gt; sign ($).<br>
&gt;<br>
&gt; Best regards,<br>
&gt; Marcel Loose.<br>
&gt;<br>
&gt;<br>
<br>
</div></div>Unfortunately, it doesn&#39;t work. I already tried escaping the dollar sign and the<br>
result in that case is args=&quot;&quot;.<br>
<br>
Fred<br>
<div><div></div><div class="h5"><br>
<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>
</div></div></blockquote></div><br></div>