[CMake] cleaning targets

Tyler Roscoe tyler at cryptio.net
Thu Nov 6 12:53:38 EST 2008


On Thu, Nov 06, 2008 at 10:14:20AM -0700, Eric (Brad) Lemings wrote:
> 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.

Fwiw, as a cmake noob, I agree with wanting a "distclean" target.
Cleaning up cmake's generated files is sort of a pain because it
produces a bunch of them in different directories and I can't just rm
-rf CMake* because it will kill my painstakingly constructed
CMakeLists.txt.

I have wanted to clean up and start over several times, such as for:

- copying my cmake testing sandbox to a Windows machine for testing

- demonstrating to co-workers the awe-inspiring wonder of cmake to go
  from a clean dirtree to a built application

- preparing to add my work to source control


It's true that there can be gotchas if CMakeLists.txt creates some other
build chaff that the distclean target doesn't know about. Maybe it would
be better to call the target "cmakeclean" or similar and it could
explicitly only delete the "standard" cmake stuff (CMakeCache,
CMakeFiles/, ...).


tyler


More information about the CMake mailing list