[cmake-developers] Setting include directories via target_link_libraries() ?

Brad King brad.king at kitware.com
Fri Dec 21 14:16:59 EST 2012


On 12/21/2012 01:08 PM, Stephen Kelly wrote:
> If the target_use_interfaces command did not manipulate a USE_INTERFACES 
> property, but instead manipulated the mulitple INTERFACE_* properties in-
> place (not appending) as my branch already does, it would be more clear. 
> 
> I added a patch to my wip-target-interface branch to illustrate that a bit. 
> 
> Note that my branch still uses the tll() command for populating the 
> INTERFACE_* properties, but that does not matter as the transitivity-with-
> properties question is separate to the new-command question.

Okay, I think the per-property approach may work with the new command.
The new command can have my proposed signature but will immediately update
the individual properties:

 target_use_interfaces(tgt [<PUBLIC|PRIVATE|INTERFACE> tgts...]...)

For each t in tgts the command will populate target properties of tgt.
For example the INCLUDE_DIRECTORIES will be updated as (pseudo-code):

 includes = "$<TARGET_PROPERTY:t,INTERFACE_INCLUDE_DIRECTORIES>"
 if PUBLIC or PRIVATE:
   tgt.INCLUDE_DIRECTORIES.append(includes)
 if PUBLIC or INTERFACE:
   tgt.INTERFACE_INCLUDE_DIRECTORIES.append(includes)

and similar appropriate updates for COMPILE_DEFINTIONS and link libraries.
Transitivity will be handled by recursive generator expression evaluation
in each property.

Basically this is what you have in mind for tll() but with the new command,
right?

-Brad



More information about the cmake-developers mailing list