Browse Source

BUG: Fix get_property result for bad property

When a property does not exist we are supposed to return an empty value.
Previously if a property did not exist we just left the value of the
output variable unchanged.  This teaches CMake to remove the definition
of the output variable in this case.
Brad King 16 years ago
parent
commit
21fc04efaf
1 changed files with 8 additions and 1 deletions
  1. 8 1
      Source/cmGetPropertyCommand.cxx

+ 8 - 1
Source/cmGetPropertyCommand.cxx

@@ -205,7 +205,14 @@ bool cmGetPropertyCommand::StoreResult(const char* value)
     }
   else // if(this->InfoType == OutValue)
     {
-    this->Makefile->AddDefinition(this->Variable.c_str(), value);
+    if(value)
+      {
+      this->Makefile->AddDefinition(this->Variable.c_str(), value);
+      }
+    else
+      {
+      this->Makefile->RemoveDefinition(this->Variable.c_str());
+      }
     }
   return true;
 }