[CMake] Help cmake to resolve link lines with multiple circular dependencies?
Hendrik Sattler
post at hendrik-sattler.de
Thu Apr 23 10:01:29 EDT 2009
Zitat von Alexandre.Feblot at thomsonreuters.com:
> Using target_link_libraries(), I set that:
> - exe depends on lib1
> - lib1 depends on lib2, lib3
> - lib2 depends on lib3
> - lib3 depends on lib2
>
> And the generated link line is : lib1 lib2 lib3 lib1 lib2 lib3.
>
> Of course, this fails with an undefined symbol lib1f3 first declared in
> lib3/f2.c.
>
> So, is there a way to help cmake resolve this link line without changing
> the lib1,2,3 code (because my project has too many of such circular
> dependencies to make such corrections possible. (I'm still evaluating if
> we can switch to our build system to cmake))
Did you think about merging lib2 and lib3 into one library? Circular
dependencies between them simply means that they cannot live without
each other, so you can as well make them one piece. If that's not
wanted, redesign the code. That's why it's usually called dependency
_tree_.
HS
More information about the CMake
mailing list