[CMake] how work dependencies

Bill Hoffman bill.hoffman at kitware.com
Mon Feb 19 13:02:57 EST 2007


klaas.holwerda wrote:
> Hi Bill,
>
> Working on the test case you asked for, i discovered the problem.
> Using SET_TARGET_PROPERTIES() i changed the name of the libraries.
> But also is use TARGET_LINK_LIBRARIES using that real name.
> I should have used the original target name it seems.
Sure, cmake does not add depend information unless it has a full path to 
a library. 
In your case, you basically had something like this:
target_link_libraries(foo bar)
So, cmake added a -lbar as requested, but had no idea where bar was coming
from.   If you had had a full path to bar, cmake would have put that 
depend in.
However, if bar is a cmake target, you should link to bar by specifying 
the name
of the CMake target that makes bar.

-Bill




More information about the CMake mailing list