<div>The only character you need to escape in the whole sequence is the backslash. You only have to escape a $ if it precedes a { to disambiguate from a variable dereference.</div><div><br></div><div>This works for me:</div>
<div><br></div><div>$ cat w.cmake<br></div><div>file(WRITE "w.txt" "$'\\r'")</div><div><br></div><div>$ cmake -P w.cmake<br></div><div><br></div><div>$ cat w.txt<br></div><div>$'\r'</div>
<div><br></div><div><br></div><div>HTH,</div><div>David</div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 31, 2012 at 7:34 PM, Alan W. Irwin <span dir="ltr"><<a href="mailto:irwin@beluga.phys.uvic.ca" target="_blank">irwin@beluga.phys.uvic.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">After a lot of thrashing around I finally discovered that<br>
<br>
file(WRITE <filename> "\$""'""\\r""'")<br>
<br>
worked to write the literal string<br>
<br>
$'\r'<br>
<br>
to a file, i.e, so that the od -a result was<br>
<br>
$ ' \ r '<br>
<br>
Is there an easier way to write this literal string to a file that I missed?<br>
<br>
Alan<br>
__________________________<br>
Alan W. Irwin<br>
<br>
Astronomical research affiliation with Department of Physics and Astronomy,<br>
University of Victoria (<a href="http://astrowww.phys.uvic.ca" target="_blank">astrowww.phys.uvic.ca</a>).<br>
<br>
Programming affiliations with the FreeEOS equation-of-state<br>
implementation for stellar interiors (<a href="http://freeeos.sf.net" target="_blank">freeeos.sf.net</a>); the Time<br>
Ephemerides project (<a href="http://timeephem.sf.net" target="_blank">timeephem.sf.net</a>); PLplot scientific plotting<br>
software package (<a href="http://plplot.sf.net" target="_blank">plplot.sf.net</a>); the libLASi project<br>
(<a href="http://unifont.org/lasi" target="_blank">unifont.org/lasi</a>); the Loads of Linux Links project (<a href="http://loll.sf.net" target="_blank">loll.sf.net</a>);<br>
and the Linux Brochure Project (<a href="http://lbproject.sf.net" target="_blank">lbproject.sf.net</a>).<br>
__________________________<br>
<br>
Linux-powered Science<br>
__________________________<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/<u></u>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/<u></u>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/<u></u>listinfo/cmake</a><br>
</blockquote></div><br></div>