[cmake-developers] Setting includes, defines and other usage requirements with one command
Alexander Neundorf
neundorf at kde.org
Tue Jan 29 15:31:19 EST 2013
On Tuesday 29 January 2013, Stephen Kelly wrote:
...
> This INTERFACE_INCLUDE_DIRECTORIES case is not going to be the only time an
> upstream will want to add to its interface. In theory, any time they want
> to add a directory to the INTERFACE_INCLUDE_DIRECTORIES they would have to
> bump the compatibility number.
>
> Also, just to shortcut a possible discussion point - this issue is
> independent of whether tll() adds includes or a new command is added. If a
> downstream is using a new command before the upstream adds
> INTERFACE_INCLUDE_DIRECTORIES, the exact same issue comes up. Just to be
> clear.
Are you sure ?
A new command could handle libraries, targets with all interfaces set and
targets with only the link interface set differently, it could error out if a
target without includes set is used, and require keywords to denote whether
the target is supposed to be used only for linking or for linking and include
dirs.
That way, to make it work with a target where the includes are not set, some
keyword must be added by downstream to the command (which would be source
compatible, since the new command does not exist yet), and if the include
interface is added later on, it still would not be used since the keyword is
present. If the keyword is removed, the full interface is used.
target_use_interfaces(Foo PRIVATE SomeTarget /lib/libblub.so LINK_ONLY
AnotherTarget)
Or could a generator expression be used for that, something like:
target_use_interfaces(Foo PRIVATE SomeTarget /lib/libblub.so
$<TARGET_PROPERTY:AnotherTarget,INTERFACE_LINK_LIBRARIES)
?
Alex
More information about the cmake-developers
mailing list