[CMake] Transitive Link Dependencies
mhertling at online.de
Wed Jul 14 09:13:51 EDT 2010
On 07/14/2010 02:38 PM, Kevin Fitch wrote:
> I have found a situation where transitive link dependencies don't seem to
> work the way I would expect. I have a library A that depends on B. e.g.
> target_link_libraries(A B)
> # and elsewhere we have ...
> target_link_libraries(foo A)
> #then B gets linked into foo as expected
> #But, if I try to be more explicit in saying I want the static version of
> target_link_libraries(bar A.a)
> # B does not get linked into bar ... :(
> Is this known/expected behavior, or is it a bug?
Known/expected because "A.a" does not denote a target but a path, i.e.
CMake links "bar" against the library file "A.a" but can't figure out
any dependencies of the latter. With "target_link_libraries(foo A)",
you link "foo" against a target "A", so CMake's dependency tracking
applies and "B" is pulled in, too.
More information about the CMake