[CMake] installation of properly line ended text files

Andreas Pakulat apaku at gmx.de
Fri Aug 24 04:48:27 EDT 2007


On 24.08.07 11:02:02, Dizzy wrote:
> My project in the install phase copies some configuration files. These files 
> are originally using UNIX line endings (we are doing main development on UNIX 
> plus SVN likes to keep them that way).

Right, SVN internally always stores text files with only \n as
lineending, however....

> However, when installing on Win32 (or 
> other platform with different line endings) it would be nice if cmake could 
> convert to proper line endings those files (depending on the platform of 
> course).
> 
> Because some of those files are generated using configure_file() to replace 
> some variable placeholders I noticed that those generated ones do have proper 
> platform dependent line endings (probably because of configure_file() taking 
> care of that).

You can have a different lineending on the working copy really easily by
using svn:eol-style property (on each file where you want it). That way
you could checkout on win32 and automatically get win32-lineendings for
those files that should have them. Then you can build/install/package
that without problems. (only drawback here is that you can't use such a
win32 working copy from unix, via nfs or such and you need to take extra
care when copying diffs around)

Alternatively you could let your program be intelligent enough to guess
the lineending by checking wether its \r\n or just \n and adjust the
reading of the conf files apropriately.

> Any idea how to do this? (I was thinking that a INSTALL(TEXT ... ) signature 
> that does this could be perfect no?)

I'm not sure its the buildsystems job to fix lineendings for you.

Andreas

-- 
Artistic ventures highlighted.  Rob a museum.


More information about the CMake mailing list