[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 08:52:38 EDT 2011


Am Samstag 01 Oktober 2011, 14:26:46 schrieb Stephen Kelly:
> Rolf Eike Beer wrote:
> > Am Samstag 01 Oktober 2011, 13:57:09 schrieb Stephen Kelly:
> >> Rolf Eike Beer wrote:
> >> >> > 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.
> >> 
> >> When you talk about exports you're talking about install(foo EXPORTS
> >> ...) right?
> > 
> > Yes.
> > 
> >> And when you say CMake didn't let you, do you mean that the installed
> >> 
> >> lib/cmake/foo/fooTargets-debug.cmake
> >> 
> >> contains
> >> 
> >>   IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG "Bar;Baz"
> >> 
> >> though it shouldn't contain Baz? What did you do to make it not
> >> contain
> >> Baz, assuming I've restated your issue correctly?
> > 
> > Nope, it gave me a CMake error when trying to make an export for Bar
> > because it depends on Baz and Baz wasn't exported.
> > 
> > At the end I just exported everything for our local build stuff and
> > didn't pass any of these files to users that could have used them, but
> > provided a Find*.cmake for them.
> 
> That sounds like 'just' a bug, right? I can't see how that relates to using
> 
> set(CMAKE_LINK_INTERFACE_LIBRARIES "")
> 
> instead of
> 
> macro(wrapper_add_library)
>   add_library(${ARGN})
>   target_link_libraries(${ARG1} LINK_INTERFACE_LIBRARIES "")
> endmacro()
> 
> Then again, I haven't understood your issue, because what I understand from
> your issue would make almost the entire exports stuff not work, so clearly I
> have not understood your issue.
> 
> It looks like it should either be a bug report or a documented limitation
> though.

I honestly must confess that I don't recall the complete details anymore. But 
IIRC I have not modified anything in the target_link_libraries(), but used 
some target properties.

Sorry, I don't get the pieces together anymore at the moment. It was something 
that I would have called a bug, but the other guys had some reasons they 
wanted this for. Dunno.

Eike



More information about the cmake-developers mailing list