[cmake-developers] INTERFACE_INCLUDE_DIRECTORIES on STATIC libs

Stephen Kelly steveire at gmail.com
Fri Feb 8 13:46:31 EST 2013


Stephen Kelly wrote:

>> 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.

I've added a whitelist for target types for those commands. 

I noticed that

 add_custom_target(check ALL
   COMMAND ${CMAKE_COMMAND} -E echo check
 )

 target_link_libraries(check somelib)

works. That should probably be an error, but making it one requires a policy 
and can be deferred.

I also looked into the generator expressions which deal with targets, and 
considered changing TARGET_PROPERTY, LINKED, and TARGET_DEFINED to not 
consider utility targets as targets. TARGET_FILE and friends already errors 
on utility and UNKNOWN_LIBRARY targets.

I think it might make sense to handle them particularly in LINKED, but I 
notice set_property and set_target_properties also work fine with them 
(should that be changed too?), so I don't know if TARGET_PROPERTY should be 
changed too. If it is, then it makes sense to change TARGET_DEFINED to 
consider utilities to not be targets, as that expression is most usefully 
used with TARGET_PROPERTY.

Is there a real need to allow things like

 add_custom_target(check ALL
   COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:check,message>
 )
 set_property(TARGET check PROPERTY message Hello)

?

Thanks,

Steve.





More information about the cmake-developers mailing list