[CMake] cleaning targets

Alexander Neundorf a.neundorf-work at gmx.net
Thu Nov 6 12:40:17 EST 2008


On Thursday 06 November 2008, Eric (Brad) Lemings wrote:
> >From the CMake FAQ:
>
>     "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.  

That doesn't make it better ;-)

> 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).

What would be the purpose of this ?
What is the purpose of distclean anyway ?

Alex


More information about the CMake mailing list