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

Brad King brad.king at kitware.com
Fri Sep 5 08:50:06 EDT 2014


On 09/04/2014 11:58 AM, Nils Gladitz wrote:
> Thanks, that actually sounds doable.
> 
> I'll give it a try.

Good work on the topic so far.  I have a few more thoughts:

- The dashboard submissions that bootstrap got many CMP0054
  warnings.  Most of them are the same warning repeated due
  to presence in a macro or loop.  Please update the warning
  to not warn on the same line more than once.  A set<> of
  already-emitted warning lines can be kept somewhere.

- I think we can generalize the policy a bit further.  Consider:

   set(x EXISTS)
   if("${x}" STREQUAL "EXISTS")

  Currently that will get an error because the evaluated
  variable spells "EXISTS" which is treated as a keyword.
  The policy could also make if() honor such keywords only
  when they are unquoted.

- The new cmExpandedCommandArgument class interface could
  be simplified by making it derive from std::string and
  then just add the boolean as an extra member.

- In the documentation we need to be precise about when
  the expansion is still allowed.  The cmake-language(7)
  manual defines unquoted, "quoted", and [[bracket]]
  arguments as distinct argument types.  We should use the
  same terminology here.  You can even link back to the
  manual with cross-reference syntax:

   :ref:`Bracket Argument`
   :ref:`Quoted Argument`
   :ref:`Unquoted Argument`

Also please extend the test cases for this policy to cover:

- All if() command conditions that do variable-or-string.
- if() inside a macro() and a function(), covering each
  combination of policy settings when the macro/function
  is recorded and when it is invoked.  The policy value
  should be that when the macro/function was recorded.

Thanks,
-Brad




More information about the cmake-developers mailing list