cmPropertyMap: Require a non-empty name parameter.
The cmGetPropertyCommand already checks for this.
This commit is contained in:
parent
7c0aa672fe
commit
3ac4b90bfd
|
@ -52,9 +52,11 @@ bool cmGetCMakePropertyCommand
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *prop =
|
const char *prop = 0;
|
||||||
this->Makefile->GetState()
|
if (!args[1].empty())
|
||||||
->GetGlobalProperty(args[1]);
|
{
|
||||||
|
prop = this->Makefile->GetState()->GetGlobalProperty(args[1]);
|
||||||
|
}
|
||||||
if (prop)
|
if (prop)
|
||||||
{
|
{
|
||||||
output = prop;
|
output = prop;
|
||||||
|
|
|
@ -84,7 +84,11 @@ bool cmGetDirectoryPropertyCommand
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *prop = dir->GetProperty(*i);
|
const char *prop = 0;
|
||||||
|
if (!i->empty())
|
||||||
|
{
|
||||||
|
prop = dir->GetProperty(*i);
|
||||||
|
}
|
||||||
if (prop)
|
if (prop)
|
||||||
{
|
{
|
||||||
this->Makefile->AddDefinition(variable, prop);
|
this->Makefile->AddDefinition(variable, prop);
|
||||||
|
|
|
@ -38,7 +38,11 @@ bool cmGetSourceFilePropertyCommand
|
||||||
this->Makefile->AddDefinition(var, sf->GetLanguage().c_str());
|
this->Makefile->AddDefinition(var, sf->GetLanguage().c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const char *prop = sf->GetPropertyForUser(args[2]);
|
const char *prop = 0;
|
||||||
|
if (!args[2].empty())
|
||||||
|
{
|
||||||
|
prop = sf->GetPropertyForUser(args[2]);
|
||||||
|
}
|
||||||
if (prop)
|
if (prop)
|
||||||
{
|
{
|
||||||
this->Makefile->AddDefinition(var, prop);
|
this->Makefile->AddDefinition(var, prop);
|
||||||
|
|
|
@ -40,7 +40,11 @@ bool cmGetTargetPropertyCommand
|
||||||
else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName))
|
else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName))
|
||||||
{
|
{
|
||||||
cmTarget& target = *tgt;
|
cmTarget& target = *tgt;
|
||||||
const char* prop_cstr = target.GetProperty(args[2], this->Makefile);
|
const char* prop_cstr = 0;
|
||||||
|
if (!args[2].empty())
|
||||||
|
{
|
||||||
|
prop_cstr = target.GetProperty(args[2], this->Makefile);
|
||||||
|
}
|
||||||
if(prop_cstr)
|
if(prop_cstr)
|
||||||
{
|
{
|
||||||
prop = prop_cstr;
|
prop = prop_cstr;
|
||||||
|
|
|
@ -29,7 +29,11 @@ bool cmGetTestPropertyCommand
|
||||||
cmTest *test = this->Makefile->GetTest(testName);
|
cmTest *test = this->Makefile->GetTest(testName);
|
||||||
if (test)
|
if (test)
|
||||||
{
|
{
|
||||||
const char *prop = test->GetProperty(args[1]);
|
const char *prop = 0;
|
||||||
|
if (!args[1].empty())
|
||||||
|
{
|
||||||
|
prop = test->GetProperty(args[1]);
|
||||||
|
}
|
||||||
if (prop)
|
if (prop)
|
||||||
{
|
{
|
||||||
this->Makefile->AddDefinition(var, prop);
|
this->Makefile->AddDefinition(var, prop);
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
#include "cmState.h"
|
#include "cmState.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name)
|
cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name)
|
||||||
{
|
{
|
||||||
cmPropertyMap::iterator it = this->find(name);
|
cmPropertyMap::iterator it = this->find(name);
|
||||||
|
@ -60,10 +62,7 @@ const char *cmPropertyMap
|
||||||
bool &chain) const
|
bool &chain) const
|
||||||
{
|
{
|
||||||
chain = false;
|
chain = false;
|
||||||
if (name.empty())
|
assert(!name.empty());
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmPropertyMap::const_iterator it = this->find(name);
|
cmPropertyMap::const_iterator it = this->find(name);
|
||||||
if (it == this->end())
|
if (it == this->end())
|
||||||
|
|
Loading…
Reference in New Issue