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

Rolf Eike Beer eike at sf-mail.de
Sat Oct 1 07:35:40 EDT 2011


Am Samstag 01 Oktober 2011, 12:31:36 schrieb Stephen Kelly:
> Rolf Eike Beer wrote:
> >> 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=72
> >> 030
> >> 
> >> 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.
> 
> I don't think I understand your description of the tricky part or your
> suggested solution. Can you expand on it?

What I once tried to do was: build a bunch of libraries (both shared and 
static), link in some ways, and then export just one shared library that had 
the link dependencies set to empty. CMake didn't let me, it always wanted to 
have me export all the other stuff, too.

Eike



More information about the cmake-developers mailing list