[cmake-developers] INTERFACE_INCLUDE_DIRECTORIES on STATIC libs
Stephen Kelly
steveire at gmail.com
Thu Feb 7 18:23:58 EST 2013
Brad King wrote:
> 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?
Nope. The only places where cmake populates interface properties are with
the AppendBuildInterfaceIncludes method, and target_link_libraries().
> Do the new tcd() and tid() work for them, at least for the impl
> properties (COMPILE_DEFINITIONS and INCLUDE_DIRECTORIES)?
I would expect so. cmTargetPropCommandBase is not restrictive at all on the
types of targets it expects (though maybe it should be... ?). It makes sense
to allow the use of object libraries with those commands. I can maybe
investigate tomorrow.
>
> Note that object libraries never appear in tll() calls as either
> the LHS or RHS argument. They are also never installed or exported.
Right.
> 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.
Yes. This is a little inconvenient though. I wonder if we could allow tll
with object libraries? The call would set the includes and defines just like
any other target, and would not have any effect on linking, because that is
not appropriate for object libraries anyway.
I know it's a bit of a stretch, but if tll() is for managing usage
requirements, it is sort of appropriate. Using tll with an INTERFACE library
which has only includes and defines set on it would also not have any effect
on linking, so there are other supports for the concept.
Thanks,
Steve.
More information about the cmake-developers
mailing list