[CMake] Naive (stupid?) question

Alexander Neundorf a.neundorf-work at gmx.net
Thu Feb 17 12:12:50 EST 2011


On Thursday 17 February 2011, Dominik Szczerba wrote:
> I am also sometimes surprised by the radius of needed re-compilation
> in my complex project... I think CMake tries to be on the safe side
> and just regenerates everything that might have been affected. 

From the experiences in KDE and at work, I haven't seen anything being 
unnecessarily being recompiled for a long time (I think the last time I saw 
something unnecessary being built again was in summer 2006).

When a include dir changes, everything below it will be rebuilt. The same for 
anything else which changes the compile flags.
If only your link command changes, the stuff will only be linked again.

CMake takes great care to ensure only the necessary stuff will be rebuilt: it 
uses copy-if-changed semantics for creating the Makefiles, the Makefiles are 
split in parts in such a way that as mentioned above, if only linking has 
changed, then there are separate files which contain only the linking 
commands, etc.

Most probably you really have the dependencies which cause a rebuild.

Or maybe something is wrong with your (networked ?) filesystem and the 
timestamps. I have seen that, unncessary recompiles on a network filesystem, 
which was most probably caused by filesystem issues.

Alex


More information about the CMake mailing list