[CMake] avoid object file recompilation

Brandon Van Every bvanevery at gmail.com
Mon Jul 30 17:54:15 EDT 2007


On 7/30/07, Timur Ivanov <timur.ivanov at gmail.com> wrote:
> On 7/31/07, Brandon Van Every <bvanevery at gmail.com> wrote:
> > On 7/30/07, Timur Ivanov <timur.ivanov at gmail.com> wrote:
> > >
> > > The problem is that common.cpp recompiled 3 times but I would like not
> > > to do that waste of time. Is it possible ?
> >
> > Yep.  Did you look at Chicken yet?
>
> Yes, I did. But it is a little complex for me and I didn't understand
> all it logic yet.

The relevant section is "PCRE LIBRARY" in the top level CMakeLists.txt

Unfortunately there's no easy way to do what you want.  You have to
know some CMake internals to get at previously compiled objects.  I
put in feature request #5155 "standard way to locate object files" but
I don't intend to implement that myself right now, and who knows when
someone else will.

Bear in mind that in practice, reusing compiled objects is often not
desireable.  For instance, if you are compiling both shared and static
versions of an object, they're typically going to have different flags
for calling conventions and Position Independent Code behavior.

Unless you have a lot of objects to reuse, it's not worth it.  Chicken
is one of those cases though, as there's like 6 permutations of
exactly the same PCRE stuff.


Cheers,
Brandon Van Every


More information about the CMake mailing list