[CMake] Backup copy on install?

Chris Johnson cxjohnson at gmail.com
Tue Jun 9 13:56:02 EDT 2015


About a year ago we converted our build system, which used a huge pile of
custom Makefile code, to use CMake.  It has been working well for us.

But now, the boss (who dabbles at the command line) and a couple of the
developers are asking for a "feature" which went away with that
conversion.  Namely, the old Makefiles used the "install -b" command, which
results in every installed binary first making a backup copy of the old
file before replacing it.  That is:

Before install:
% ls ~/bin
~/bin/myprog

After install:
% ls ~/bin
~/bin/myprog.old
~/bin/myprog

Is there a quick and easy way to globally add such an automatic copy of the
install target in CMake?

I've searched high and low for some setting or method, but have come up
empty handed.

We do use a globally included set of CMake rules in all of our
CMakeLists.txt files, so if there's a bit of code that could be added
there, that would be sufficient.

All suggestions welcome!

Thanks,
..chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150609/8d890c09/attachment.html>


More information about the CMake mailing list