[CMake] Problem with circular dependencies

Hendrik Sattler post at hendrik-sattler.de
Fri May 29 03:00:07 EDT 2009


Zitat von Dmytro Ovdiienko <dmitriy.ovdienko at gmail.com>:
> 2009/5/28 Tyler Roscoe <tyler at cryptio.net>
>> But from your Lists below it appears that they don't really depend on
>> one another, in a "target A must be built before target B" sense, but
>> simply that they use headers from each other's source directories?
>>
>
> A and B are static libraries. The order static libraries building has no
> mater.

But you can never ever build shared libraries this way (at least not  
on all platform). So in fact A and B are one project as one cannot  
live without the other. Questionable software design, I'd say.

>> > The other side of this problem is you have to write ADD_SUBDIRECTORY
>> > commands in specific order. IMHO it is inconvenient.
>>
>> CMakeLists are essentially a scripting language, so of course order
>> matters. What would you propose instead?
>>
>
> But... why does TARGET_LINK_LIBRARIES work correctly?

It doesn't. You just think it does because instead of a target name,  
you can also pass basic non-target library names.
Additionally, static libraries are not linked, so that doesn't matter anyway.

HS




More information about the CMake mailing list