[cmake-developers] INTERFACE_INCLUDE_DIRECTORIES on STATIC libs

Brad King brad.king at kitware.com
Thu Feb 7 16:49:08 EST 2013


On 02/07/2013 04:15 PM, Stephen Kelly wrote:
> What about OBJECT_LIBRARYs ? I have no experience with them.

Do you add any interface properties to any object libraries currently?
Do the new tcd() and tid() work for them, at least for the impl
properties (COMPILE_DEFINITIONS and INCLUDE_DIRECTORIES)?

Note that object libraries never appear in tll() calls as either
the LHS or RHS argument.  They are also never installed or exported.

It does make sense to publish INTERFACE_INCLUDE_DIRECTORIES and
INTERFACE_COMPILE_DEFINITIONS on object library targets, but we
do not need to chain to them automatically.  Consumers of an
object library already need to do

  add_executable(consumer $<TARGET_OBJECTS:objlib>)

so they could also do

  target_include_directories(consumer
    $<TARGET_PROPERTY:objlib,INTERFACE_INCLUDE_DIRECTORIES>)
  target_compile_definitions(consumer
    $<TARGET_PROPERTY:objlib,INTERFACE_COMPILE_DEFINITIONS>)

explicitly.

-Brad



More information about the cmake-developers mailing list