[cmake-developers] Alternate if() without implicit variable expansion

Brad King brad.king at kitware.com
Wed Sep 10 11:33:07 EDT 2014


On 09/08/2014 11:35 AM, Nils Gladitz wrote:
> I updated the topic, squished and merged.

Thanks.  I've updated the topic to include all the actual fixes
for CMP0054 warnings within CMake's own code that I've found so
far.

I have a few more changes to request that you add to the topic:

* The wording of the warning says what the change in behavior
  is, but does not inform the user that the old behavior is
  being used for compatibility.  Currently without reading the
  policy documentation one might think from the messages that
  the logic is being executed differently than before.

* In cmIfCommand we should avoid doing the lookups when the
  policy is NEW.  Instead of calling mf->GetPolicyStatus on
  every step of the way, call it once at the beginning of the
  if() command execution and save the result in a member.
  Then in cmIfCommand::GetDefinitionIfUnquoted, check for
  quoting and the policy status before even trying to do the
  lookup.  That should make processing of quoted arguments
  much faster because we won't have to check for a definition
  with every string value.

* The CMP0054-keywords-NEW test does not cover "(" and ")".
  (Good catch on implementing those, BTW.)

* The tests need to cover if() inside while() and foreach()
  as well as macro() and function().  Also add nested if()
  for completeness.

Thanks,
-Brad




More information about the cmake-developers mailing list