[cmake-developers] INTERFACE_LINK_LIBRARIES property?

Stephen Kelly steveire at gmail.com
Wed Jun 26 12:24:41 EDT 2013


Brad King wrote:

> On 06/07/2013 09:36 AM, Brad King wrote:
>> Great.  One more part to think about is how the warning can work
>> for the interface policy. 

> * OLD behavior uses the old properties for everything
>   (tll sets them, cmTarget reads them)
> * NEW behavior uses the new property for everything
>   (tll sets it, cmTarget reads it)

> When the policy is not set we will use the old behavior, but
> when would we ever warn to ask developers to set the policy?

The current implementation in my clone emits a warning only if the old and 
new properties are both set for one target and contain different values. 
What other situations should be warned about?

In the new GetTransitivePropertyLinkLibraries() method I have code like 

+  if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN
+      || this->GetPolicyStatusCMP0022() == cmPolicies::OLD)
+    {

i.e., don't actually emit a warning from this method if the policy is WARN. 
This snippet is called only when evaluating generator expressions to get 
transitive property values from the link interface. I could check if the new 
property is populated there, and emit a warning something along the lines 
that 'you are using the old and new properties on the same target', which is 
the warning they'd see anyway from cmTarget::ComputeLinkInterface.

Similarly, I emit a warning if the CMP0022 policy is set to NEW, but the 
EXPORT_LINK_INTERFACE_LIBRARIES option to export() was not used and the old 
properties are populated. This can only happen if the developer incorrectly 
reacts to the policy by setting the policy to NEW but not using 
EXPORT_LINK_INTERFACE_LIBRARIES and not removing code which causes the old 
properties to be populated. So, it's not like a regular 'policy warning' 
which is to warn about existing code usage to migrate away from, but still 
an author warning that they haven't handled the policy correctly yet 
(Actually it's a FATAL_ERROR, not a warning).

> It can't be triggered by "new-style" code because the whole
> point of policy warnings is to trigger for old code not yet
> aware of the policy and the preferred new behavior.

I'm not sure what in particular you're referring to here. Maybe it's the 
export case I described above?
 
> Perhaps we can warn whenever someone sets the old property
> explicitly through set_property or set_target_properties
> such that it would not be mapped by the policy's changes
> to tll behavior.  Other ideas?

Such set_property or set_target_properties calls will result in a warning 
from cmTarget::ComputeLinkInterface, so I don't understand why another is 
needed?

>> We could also warn when someone sets the new-style properties
>> but does not set the policy to NEW.
> 
> To clarify, this would be a general warning and not tied to
> complaining when the policy is not set.  Obviously such code
> is aware of the new properties already.

Same as above, I'm not sure why another warning would be needed, or I don't 
understand what you are suggesting.

I've re-pushed the INTERFACE_LINK_LIBRARIES-prop branch to my clone with a 
rebase.

Thanks,

Steve.





More information about the cmake-developers mailing list