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

Stephen Kelly steveire at gmail.com
Sat Oct 1 06:37:18 EDT 2011


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.





More information about the cmake-developers mailing list