No subject


Sun Oct 26 02:42:03 EDT 2008


    "CMake does not generate a "make distclean" target. Why?

    Some build trees created with GNU autotools have a "make distclean"
target that cleans the build and also removes Makefiles and other parts
of the generated build system. CMake does not generate a "make
distclean" target because CMakeLists.txt files can run scripts and
arbitrary commands; CMake has no way of tracking exactly which files are
generated as part of running CMake."

The distclean target works in GNU build systems only if maintainers
utilize the hooks into the distclean target (e.g. distclean-local,
maintainer-clean-generic) that allows build scripts/Makefiles to execute
commands that delete all other config files that the GNU build system
does not know about.  By default, GNU build scripts only delete config
files that they DO know about.  This could work the same way in CMake.

    "Providing a distclean target would give users the false impression
that it would work as expected."

This also applies to GNU build systems.  The onus is on maintainers to
supplement the distclean target with hooks.  If they do not, the
distclean target does not clean all relevant files.

CMake could/should also generate a 'mostlyclean' target in addition to
the 'clean' target that just removes intermediate files (e.g. object
files) but not target files (e.g. programs and libraries).

Eric.



More information about the CMake mailing list