Brad King wrote:

> target_link_libraries(staticB INTERFACE staticA)
> 
> However, that will propagate all usage requirements of A to consumers
> of B.  Depending on the usage requirements specified for A and B that
> may be correct or not.

We could consider making the LINK_ONLY generator expression public in order 
to allow the user to decide the granularity here (possibly encapsulated in a 
INTERFACE_LIBRARY).

 add_library(ifaceA INTERFACE)
 target_link_libraries(ifaceA INTERFACE $<LINK_ONLY:staticA>)
 target_include_directories(ifaceA 
   INTERFACE $<TARGET_PROPERTY:staticA,INTERFACE_INCLUDE_DIRECTORIES>)
 # Propagate the includes from A, but not the compile definitions 
 # or compile options.
 target_link_libraries(staticB ifaceA)

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

Reply via email to