[cfe-dev] Why copy_if_different?
Óscar Fuentes
ofv at wanadoo.es
Fri Apr 29 07:53:54 PDT 2011
Yuri Gribov <tetra2005 at googlemail.com> writes:
> What is the reason for custom build rules in Visual Studion using
> 'cmake -E copy_if_different' instead of plain 'cmake -E copy'?
We suppose that most of the time the tablegenned files do not
change. Using `copy' is like touching the tablegenned file and hence
forcing all dependencies to rebuild. This is a typical scenario:
* A change is made to Support or tblgen.
* tblgen is rebuilt.
* Everything is re-tablegenned.
* If the *.inc.tmp output files are the same as the definitive ones,
using copy_if_different leaves the definitive files untouched, which
saves a massive rebuild.
> If target file is older than source but contents is the same the
> source will not be copied and the timestamp of target will remain the
> same. This means that VS will try to rebuild this file (and a dozen
> of dependent projects) on every run (I observe this particular
> behavior on my system).
Well, the idea is that this is less expensive than the occasional
massive rebuild mentioned above. This comes from the experience of some
users who contributed the patches for this behavior. You can try
changing the code in cmake/modules/TableGen.cmake and see if using
`copy' works significantly better for you. Then we could consider making
it optional.
More information about the cfe-dev
mailing list