[CMake] Undesirable behavior of TARGET_LINK_LIBRARIES()
Brad King
brad.king at kitware.com
Wed Jun 27 22:48:31 EDT 2007
Darrin West wrote:
>
>
> It seems to me that TARGET_LINK_LIBRARIES and ADD_DEPENDENCIES are
> “poorly” defined, and lead to problems. I think the fix is “easy”, but
> might not be popular.
>
>
>
> My comments might be related to the following question in the FAQ:
>
> http://www.cmake.org/Wiki/CMake_FAQ#Why_are_libraries_linked_to_my_shared_library_included_when_something_links_to_it.3F
Note the last line in that answer about the future separation of
interface link rules from implementation link rules. We are actually
pretty close to implementing that. Basically one will be able to write
something like
add_library(mysharedlib SHARED ...)
target_link_libraries(mysharedlib myhelperlib)
set_target_properties(mysharedlib PROPERTIES
INTERFACE_LINK_LIBRARIES ""
)
and then linking to mysharedlib will not chain to any libraries. The
INTERFACE_LINK_LIBRARIES property will list the libs to be linked when
mysharedlib is linked. There will be no chaining. For compatibility
the old behavior will be preserved if the property is not set.
-Brad
More information about the CMake
mailing list