[CMake] Merge two static libraries

Hendrik Sattler post at hendrik-sattler.de
Tue Oct 5 07:40:19 EDT 2010


Zitat von "Marcel Loose" <loose at astron.nl>:
> Even if you opt for the "one static library" option, you already gain in
> build speed. Suppose you've modified foo.c, then CMake will only rebuild
> foo.o. Of course, it will rebuild foo.o twice, once for libconsole, once
> for libwindows. But that's already much better than recompiling all 50
> sources twice.

Such requests come up regularly. The solution would be easy: something  
like VIRTUAL as alternative to the STATIC flags of add_library().  
Cmake could just omit the link step (it already knows all object  
files) and linking such a virtual library to a static one just  
includes the already compiled object files. That would exactly achieve  
the requested features (compiling those files only once), is hack-free  
and totally straight-forward.

Just not done...

HS




More information about the CMake mailing list