Warning behavior for OLD is inconsistent between CMP0077 and CMP0126
CMP0077 relates to the option()
command, CMP0126 relates to the set()
command. Both policies are about how an existing non-cache variable of the same name is handled/affected. The OLD
behavior for CMP0077 issues a warning if such a variable is used and the policy is not set, but CMP0126 does not warn for the equivalent case. This seems inconsistent and one could argue that we should be issuing a warning for set()
just like we do for option()
. Given that we've had the option()
behavior for a number of releases now, it would seem appropriate that we follow that behavior for the newly introduced CMP0126. Keep in mind that one of the motivations for CMP0126
was to simplify the mental understanding of how these two commands work, so consistency of behavior is of perhaps a stronger importance in this case.
The silent OLD behavior doesn't seem to have been mentioned in the MR (!6146 (merged)), while comments in the associated issue (#22038 (closed)) kinda skirt around it but don't explicitly mention it either. Furthermore, CMP0102 may also be relevant here and it also does not warn on OLD behavior. I think there is a stronger relationship to CMP0077 though and it should be what we follow for CMP0126. The non-warning for OLD behavior of CMP0102 is unfortunate, perhaps we might even want to consider whether it should start warning now (we should at least cover this in discussions here).