[cmake-developers] INTERFACE targets (Was: Generator expressisons in target properties)
Brad King
brad.king at kitware.com
Fri Nov 16 14:40:09 EST 2012
On 11/06/2012 01:32 PM, Brad King wrote:
> On 11/06/2012 12:00 PM, Stephen Kelly wrote:
>> add_library(iface INTERFACE)
>> set_property(TARGET iface PROPERTY INTERFACE_LINK_LIBRARIES foo bar)
>> target_link_libraries(test_exe directdep1 iface directdep2)
>>
>> It is not really equivalent to this:
>>
>> target_link_libraries(test_exe directdep1 foo bar directdep2)
>
> interfaces should be flattened and replaced with their content.
I think I was over-thinking this before. This is a new target type.
There is no reason the above cases need to be equivalent.
On 11/16/2012 12:56 PM, Stephen Kelly wrote:
> I've thought some more about the topic of targets which do not create any
> output files or binaries themselves, but which provide an interface to a
> group of other targets.
>
> Whatever solution we come up with to do that, I'd like it to be consistent
> with other types of targets. The way I see it, these are the options:
>
> 1) cmTarget::INTERFACE_LIBRARY
>
> 2) cmTarget::INLINED_LIBRARY or INLINE_CONTAINER_LIBRARY
[snip]
> 1) can be turned into 2) by the user by using a generator expression
>
> target_link_libraries(foo
> $<TARGET_PROPERTY:iface,INTERFACE_LINK_LIBRARIES>)
Yes, I think #1 is okay.
Thanks,
-Brad
More information about the cmake-developers
mailing list