[CMake] Dependencies between static libraries

Rolf Eike Beer eike at sf-mail.de
Mon May 26 03:42:41 EDT 2014


Jörg Kreuzberger wrote:
> Hi!
> 
> i had a problem between depencendies of static libraris. Due to the
> used tools (qt, moc, uic) a library depends on another library,
> especially on header files generated by uic.
> 
> This is a litte bit a broken design, but cannot fix it currently.
> 
> On massive parallel builds ( 8 cores on ssd ) i get compiliation
> issues (missing header file) or broken dependencies ( header is
> updated later, lib already build).
> 
> So i decided to use add_dependencies() macro for cmake to "clarify"
> these dependencies. Since then it seems that no more failure occured.
> 
> Is this a correct way to handle this issue or are other solutions more 
> reliable?

Have you tried target_link_libraries(liba libb)? Even if that doesn't 
really "link", it should ensure proper dependencies.

Eike


More information about the CMake mailing list