[CMake] installation of properly line ended text files

Dizzy dizzy at roedu.net
Fri Aug 24 05:40:20 EDT 2007


On Friday 24 August 2007 12:30:58 Andreas Pakulat wrote:
> On 24.08.07 12:08:34, Dizzy wrote:
> > On Friday 24 August 2007 11:48:27 Andreas Pakulat wrote:
> > > 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.
> >
> > The program is already able to deal with these files, the problem is that
> > being configuration files means the admin should be able to easily edit
> > them.
>
> An admin that doesn't have a eol-aware editor shouldn't do
> administration tasks anyway. I'd accept that statement for "normal"
> Desktop users who might use notepad, but then again those people
> seldomly search for a config file, they normally search for config
> options in the application itself.

Our "admins" are just the users who install the application and they usually 
do need to edit at least one/two settings in the config file. Until we will 
have (a platform independent) GUI interface for the various administration 
tasks we provide them text only config files. I agree that people knowing how 
to mess with them should know what line endings are and they should use a 
proper editor but sadly "the world" doesn't care what we think it shoud 
happen.

> A workaround for what you want, would be to read the config file, change
> the lineendings, write it to a temp file and then let cmake install that
> temp file. (reading and writing can be done with cmake, but I don't know
> the exact commands atm).

Thanks for the idea. I could use as a workarround configure_file() in some way 
or another but then I still need one more issue solved. How to 
escape "${variable}" strings in a input to configure_file() so that it 
doesn't try to do variable replacement on the placeholder? (this should be a 
general available feature, people would probably need to escape variable 
placeholders in other situations than mine). Example: I had an almost similar 
problem where "${variable}" from the Makefile were replaced by their value by 
the running "make" but I didnt wanted to so I had to use $${variable}. Is 
there something similar?

-- 
Mihai RUSU					Email: dizzy at roedu.net
			"Linux is obsolete" -- AST


More information about the CMake mailing list