[CMake] Possible to clean files of one target libraryonly?

Jörg Förstner Joerg.Foerstner at ubidyne.com
Fri Aug 21 13:16:58 EDT 2009


> On Wed, 2009-08-19 at 11:02 -0700, Tyler Roscoe wrote:
> > On Wed, Aug 19, 2009 at 11:54:18AM -0600, Timothy M. Shead wrote:
> > > If you are using CMake to generate makefiles, you can run 
> "make clean" 
> > > in a subdirectory of your build tree, and make will only 
> remove the 
> > > files for that directory - you can use this to do 
> library-specific 
> > > cleaning, provided that you've organized your sources so 
> each library 
> > > has its own directory.
> > 
> > I do not see this behavior. make clean gets rid of object files and
> > libraries for the project where I run "make clean" and for all that
> > project's dependencies. All my projects have their own 
> source and binary
> > directories.
> > 
> > tyler
> 
> Hmm, just a guess (I haven't tried it out).
> 
> Maybe it's working for Tim because he has a hierarchy of projects. I
> have a big project that is subdivided into (sub)projects. As a result,
> the build directory of a sub-project is a subdirectory of the build
> directory of the top-level project. When I go to the build 
> directory of
> a given sub-project and issue 'make clean', only the files for that
> sub-project are deleted, not those of its parent project.
> 
> So, maybe this only works if you've divided your (big) project into
> sub-projects.
> 
> Best regards,
> Marcel Loose.

We have a structure like this: <root>/<subproject>/<library>
The sources are in the <library> folders.
It works like you guessed it.

Thanks,
Jörg


More information about the CMake mailing list