[CMake] Static Modules

Alexander Neundorf a.neundorf-work at gmx.net
Thu Mar 11 16:06:26 EST 2010


On Thursday 11 March 2010, Markus Raab wrote:
> Alexander Neundorf wrote:
> > We don't have that anymore, we just compile all the files directly into
> > one library.
>
> But only in the dynamic way?

Hmm, we don't really have a lot of static libs in KDE...

> > We didn't have any issues with this since then.
> >
> > (it may be possible to hack something together with custom commands to
> > extract the object files from the ar archives and put them together into
> > a resulting ar file
>
> The code I posted is exactly doing that.
>
> But I dont see the way to add these objects to the resulting static
> library.

I think if you either just add the object files as sources or link to them 
using target_link_libraries() it should work.

> > but I wouldn't recommend this)
>
> Why are you not recommending that? Static linkage has it advantages and use

I would not recommend creating the static libs, taking them apart again and 
then putting other libs together again.
That will be kind of hacky. 
Just listing all the source files doesn't make problems and is 
straightforward.

Alex


More information about the CMake mailing list