[CMake] How to use file(WRITE... to write the literal string $'\r' to a file

Alan W. Irwin irwin at beluga.phys.uvic.ca
Wed Oct 31 19:34:34 EDT 2012


After a lot of thrashing around I finally discovered that

file(WRITE <filename> "\$""'""\\r""'")

worked to write the literal string

$'\r'

to a file, i.e, so that the od -a result was

$   '   \   r   '

Is there an easier way to write this literal string to a file that I missed?

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list