[CMake] cleaning targets

Michael Jackson mike.jackson at bluequartz.net
Thu Nov 6 12:57:52 EST 2008


On Nov 6, 2008, at 12:53 PM, Tyler Roscoe wrote:

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

Are you using a dedicated build directory or are you running cmake  
directly from your source directory? If the latter.. STOP.. don't do  
that. If you use a dedicated build directory then cleaning up from  
cmake is as simple as rm -rf Build/ and there are no worries about  
adding to source control because none of the build products are within  
your source directories. Does this make sense?

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
             www.bluequartz.net



More information about the CMake mailing list