As part of every file compilation, CMake asks the compiler to record the dependencies it read during compilation using a combination of the -MD, -MT and -MF flags. When you then change a file, the underlying build system (Make) can quickly see if any file needs to be recompiled if either itself or one of the files it depends on has changed.
This dependency information is stored in lots of small files. Since reading lots of small files can be very slow, they are consolidated onto "depend.cmake" and "compiler_depend.cmake" files deep inside the CMake-generated build system. On my local version of CMake, this is notified as a purple "Consolidate compiler generated dependencies of target T" message.
Finally, calling make depend
does two things:
- It checks whether the build system is complete and not corrupt, and
- it replaces all the consolidated dependency files with empty files so the next run will start fresh and regenerate these files.