[cmake-developers] CMakeParseArguments: Do not skip empty arguments

Brad King brad.king at kitware.com
Fri Nov 8 17:27:34 EST 2013


On 11/8/2013 4:19 PM, Alexander Neundorf wrote:
> On Friday 08 November 2013, Daniele E. Domenichelli wrote:
>> So it looks like that "set(FOO "" PARENT_SCOPE)" instead of setting an
>> empty FOO value, unsets it in the parent scope, and the behaviour is
>> definitely different from set for the current scope.
> 
> How about adding one new policy "modify handling of empty variables" which is 
> used by both ?

At most the policy should affect PARENT_SCOPE.  One can see the
difference right in cmSetCommand, where parentScope was added:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fc8ce174#patch6

For parentScope it does

    if (value.empty())
      {
      this->Makefile->RaiseScope(variable, 0);
      }
    else
      {
      this->Makefile->RaiseScope(variable, value.c_str());
      }

while for normal scope it does just

    this->Makefile->AddDefinition(variable, value.c_str());

-Brad



More information about the cmake-developers mailing list