Comment 4 for bug 1203786

Revision history for this message
Brad King (brad.king) wrote :

From target_link_libraries documentation:

 http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:target_link_libraries
 "Library dependencies are transitive by default. When this target is linked into another target then the libraries linked to this target will appear on the link line for the other target too."

For shared libraries one can set the LINK_INTERFACE_LIBRARIES property to disable transitive behavior (see also the LINK_PRIVATE/LINK_PUBLIC signature of target_link_libraries). For static libraries there is no way to disable transitive linking because it is necessary to satisfy link dependencies of the objects in the static library itself.

Link flags meant to adjust library search behavior can go in target_link_libraries calls, but those meant for things like linker scripts should go in LINK_FLAGS.