[CMake] avoid object file recompilation

Brandon Van Every bvanevery at gmail.com
Tue Jul 31 12:36:55 EDT 2007


On 7/30/07, gga <ggarra at advancedsl.com.ar> wrote:
> Timur Ivanov wrote:
> >
> > The problem is that common.cpp recompiled 3 times but I would like not
> > to do that waste of time. Is it possible ?
>
> No and Yes.  No, cmake in general does not allow to do it easily or
> reliably.
>
> But your OS does.  Make common.cpp into either a static or dynamic
> library and add it to your subprojects.  That's why you are using a make
> system in the first place.

But in the static case, static libs cannot include other static libs.
If the developer doesn't want to require the end user to link with a
bunch of extra flags, and just wants to embed a static library, then
they either have to re-build objects multiple times or figure out how
to reuse them.  Which, given Timur's previous posts, is why I believe
we were talking about this.

Dynamic libs don't have this problem. That's one way out.


Cheers,
Brandon Van Every


More information about the CMake mailing list