[cmake-developers] Setting the link interface and dependencies in one command

David Cole david.cole at kitware.com
Sat Oct 1 09:26:25 EDT 2011


On Sat, Oct 1, 2011 at 6:37 AM, Stephen Kelly <steveire at gmail.com> wrote:
>
> Hi,
>
> Currently setting the link dependencies and the link interface involves a
> lot of repetition. It is necessary to call target_link_libraries twice:
>
> target_link_libraries(radiobuttonmodel
>  ${QT_QTCORE_LIBRARIES}
>  ${QT_QTGUI_LIBRARIES}
>  ${QT_QTNETWORK_LIBRARIES}
> )
>
> target_link_libraries(radiobuttonmodel
> LINK_INTERFACE_LIBRARIES
>  ${QT_QTCORE_LIBRARIES}
>  ${QT_QTGUI_LIBRARIES}
> )
>
> cmTargetLinkLibrariesCommand.cxx seems to intentionally allow making
> libraries part of the link interface without actually linking to them, so we
> can't change the behaviour of
>
> target_link_libraries(radiobuttonmodel
>  ${QT_QTNETWORK_LIBRARIES}
> LINK_INTERFACE_LIBRARIES
>  ${QT_QTCORE_LIBRARIES}
>  ${QT_QTGUI_LIBRARIES}
> )
>
> to be the equivalent of the above. However, we could do something like this:
>
> target_link_libraries(radiobuttonmodel
>  ${QT_QTNETWORK_LIBRARIES}
> LINK_INTERFACE
>  ${QT_QTCORE_LIBRARIES}
>  ${QT_QTGUI_LIBRARIES}
> )
>
> to be able to specify the link dependencies and the link interface (which
> are also dependencies) in one command.
>
> Would that be acceptable to cmake?
>
> Thanks,
>
> Steve.
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
>

I'm going to say wait until Brad replies here, but I do not see a
problem with that, *if* it's actually necessary. (Other than the
obvious problem, which is that LINK_INTERFACE and
LINK_INTERFACE_LIBRARIES are very close to each other and people will
get them confused, and constantly be looking at the documentation to
try to figure out which is which... A distinguishing naming
difference, if you could come up with one, would be better. i.e.,
names where you can tell what the meaning is for each, without
referring to the documentation...)

I guess I don't fully understand what you're doing here. If the
libraries are necessary as actual dependencies, then why do they also
have to be in the "link interface libraries" list...? I thought that
list was just to indicate that you need the libraries, but that things
that link to your library do not need them. If they are actual, hard
dependencies, then how could things that link to your library *not*
need them, too?


David



More information about the cmake-developers mailing list