[cmake-developers] An option to set LINK_INTERFACE_LIBRARIES to empty on all shared library targets?

Rolf Eike Beer eike at sf-mail.de
Mon Sep 26 08:35:11 EDT 2011


>
> Hi,
>
> In KDE we set the LINK_INTERFACE_LIBRARIES to empty in a wrapper around
> add_library. The reason is to reduce the number of libraries which are
> linked to by default - developers have to be explicit about what is in the
> LINK_INTERFACE.
>
> I was considering patching CMake to do that by setting an option.
>
> http://thread.gmane.org/gmane.comp.kde.devel.buildsystem/6622/focus=72030
>
> Would such a feature of making
>
> set(CMAKE_SET_LINK_INTERFACE_EMPTY ON)
>
> cause the LINK_INTERFACE to be empty for all shared library targets be
> accepted into CMake?

I personally am all into this, as this basically makes the same as the
linker does when it gets passed --no-copy-dt-needed-entries --as-needed.

I would call it a bit different to make more clear what this is all about,
something like CMAKE_NO_LINK_IMPLICIT_DEPENDENCIES.

The "tricky" part of this is to tell CMake to not enforce the implicit
dependencies to be exported when creating an export file for targets
created with this property enabled. Or better: to not enforce _any_
dependencies of a shared library to be exported then.

Eike



More information about the cmake-developers mailing list