[cmake-developers] Adding non-IMPORTED targets to the INTERFACE of IMPORTED targets?

Stephen Kelly steveire at gmail.com
Thu Jun 6 10:58:40 EDT 2013


Hi,

As I wrote in 

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/7082
 (Linking to OBJECT libraries?, 2013-06-06)

I was experimenting with adding a static library to the INTERFACE of the 
Qt5::Gui target. While that seemed to work, the target build order is not 
correctly accounted for.

For example:

 add_library(some_imported SHARED IMPORTED)
 # ...
 add_library(foo dummy.cpp)

 set_property(TARGET some_imported APPEND PROPERTY 
   LINK_INTERFACE_LIBRARIES foo
  )

 add_executable(my_exe ...)
 target_link_libraries(my_exe some_imported)

The my_exe target does not currently get a target-build-order dependency on 
foo as a result of the above. Is that a feature (you can't add non-IMPORTED 
targets to the INTERFACE of IMPORTED targets), or a bug (we should fix it)?

Fixing it is quite easy I think. All non-IMPORTED targets from the INTERFACE 
of IMPORTED targets in the link implementation simply get appended to the 
result in GetDirectLinkLibraries.

Thanks,

Steve.





More information about the cmake-developers mailing list