stringapi: Use strings for property names

Property names are always generated by CMake and should never be NULL.
This commit is contained in:
Ben Boeckel 2013-09-02 16:27:32 -04:00 committed by Brad King
parent 2977330a7b
commit ec97ed7d0c
32 changed files with 262 additions and 310 deletions

View File

@ -807,13 +807,13 @@ bool cmCacheManager::CacheIterator::GetValueAsBool() const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* const char*
cmCacheManager::CacheEntry::GetProperty(const char* prop) const cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const
{ {
if(strcmp(prop, "TYPE") == 0) if(prop == "TYPE")
{ {
return cmCacheManagerTypes[this->Type]; return cmCacheManagerTypes[this->Type];
} }
else if(strcmp(prop, "VALUE") == 0) else if(prop == "VALUE")
{ {
return this->Value.c_str(); return this->Value.c_str();
} }
@ -823,14 +823,14 @@ cmCacheManager::CacheEntry::GetProperty(const char* prop) const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmCacheManager::CacheEntry::SetProperty(const char* prop, void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
const char* value) const char* value)
{ {
if(strcmp(prop, "TYPE") == 0) if(prop == "TYPE")
{ {
this->Type = cmCacheManager::StringToType(value? value : "STRING"); this->Type = cmCacheManager::StringToType(value? value : "STRING");
} }
else if(strcmp(prop, "VALUE") == 0) else if(prop == "VALUE")
{ {
this->Value = value? value : ""; this->Value = value? value : "";
} }
@ -841,15 +841,15 @@ void cmCacheManager::CacheEntry::SetProperty(const char* prop,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmCacheManager::CacheEntry::AppendProperty(const char* prop, void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop,
const char* value, const char* value,
bool asString) bool asString)
{ {
if(strcmp(prop, "TYPE") == 0) if(prop == "TYPE")
{ {
this->Type = cmCacheManager::StringToType(value? value : "STRING"); this->Type = cmCacheManager::StringToType(value? value : "STRING");
} }
else if(strcmp(prop, "VALUE") == 0) else if(prop == "VALUE")
{ {
if(value) if(value)
{ {
@ -867,7 +867,8 @@ void cmCacheManager::CacheEntry::AppendProperty(const char* prop,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmCacheManager::CacheIterator::GetProperty(const char* prop) const const char* cmCacheManager::CacheIterator::GetProperty(
const std::string& prop) const
{ {
if(!this->IsAtEnd()) if(!this->IsAtEnd())
{ {
@ -877,7 +878,8 @@ const char* cmCacheManager::CacheIterator::GetProperty(const char* prop) const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v) void cmCacheManager::CacheIterator::SetProperty(const std::string& p,
const char* v)
{ {
if(!this->IsAtEnd()) if(!this->IsAtEnd())
{ {
@ -886,7 +888,7 @@ void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmCacheManager::CacheIterator::AppendProperty(const char* p, void cmCacheManager::CacheIterator::AppendProperty(const std::string& p,
const char* v, const char* v,
bool asString) bool asString)
{ {
@ -897,7 +899,8 @@ void cmCacheManager::CacheIterator::AppendProperty(const char* p,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmCacheManager::CacheIterator::GetPropertyAsBool(const char* prop) const bool cmCacheManager::CacheIterator::GetPropertyAsBool(
const std::string& prop) const
{ {
if(const char* value = this->GetProperty(prop)) if(const char* value = this->GetProperty(prop))
{ {
@ -907,13 +910,14 @@ bool cmCacheManager::CacheIterator::GetPropertyAsBool(const char* prop) const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmCacheManager::CacheIterator::SetProperty(const char* p, bool v) void cmCacheManager::CacheIterator::SetProperty(const std::string& p, bool v)
{ {
this->SetProperty(p, v ? "ON" : "OFF"); this->SetProperty(p, v ? "ON" : "OFF");
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmCacheManager::CacheIterator::PropertyExists(const char* prop) const bool cmCacheManager::CacheIterator::PropertyExists(
const std::string& prop) const
{ {
return this->GetProperty(prop)? true:false; return this->GetProperty(prop)? true:false;
} }

View File

@ -39,9 +39,9 @@ private:
std::string Value; std::string Value;
CacheEntryType Type; CacheEntryType Type;
cmPropertyMap Properties; cmPropertyMap Properties;
const char* GetProperty(const char*) const; const char* GetProperty(const std::string&) const;
void SetProperty(const char* property, const char* value); void SetProperty(const std::string& property, const char* value);
void AppendProperty(const char* property, const char* value, void AppendProperty(const std::string& property, const char* value,
bool asString=false); bool asString=false);
bool Initialized; bool Initialized;
CacheEntry() : Value(""), Type(UNINITIALIZED), Initialized(false) CacheEntry() : Value(""), Type(UNINITIALIZED), Initialized(false)
@ -58,13 +58,13 @@ public:
void Next(); void Next();
const char *GetName() const { const char *GetName() const {
return this->Position->first.c_str(); } return this->Position->first.c_str(); }
const char* GetProperty(const char*) const ; const char* GetProperty(const std::string&) const ;
bool GetPropertyAsBool(const char*) const ; bool GetPropertyAsBool(const std::string&) const ;
bool PropertyExists(const char*) const; bool PropertyExists(const std::string&) const;
void SetProperty(const char* property, const char* value); void SetProperty(const std::string& property, const char* value);
void AppendProperty(const char* property, const char* value, void AppendProperty(const std::string& property, const char* value,
bool asString=false); bool asString=false);
void SetProperty(const char* property, bool value); void SetProperty(const std::string& property, bool value);
const char* GetValue() const { return this->GetEntry().Value.c_str(); } const char* GetValue() const { return this->GetEntry().Value.c_str(); }
bool GetValueAsBool() const; bool GetValueAsBool() const;
void SetValue(const char*); void SetValue(const char*);

View File

@ -136,7 +136,8 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, void cmExportFileGenerator::PopulateInterfaceProperty(
const std::string& propName,
cmTarget *target, cmTarget *target,
ImportPropertyMap &properties) ImportPropertyMap &properties)
{ {
@ -148,8 +149,9 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, void cmExportFileGenerator::PopulateInterfaceProperty(
const char *outputName, const std::string& propName,
const cmStdString& outputName,
cmTarget *target, cmTarget *target,
cmGeneratorExpression::PreprocessContext preprocessRule, cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties, ImportPropertyMap &properties,
@ -391,7 +393,8 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, void cmExportFileGenerator::PopulateInterfaceProperty(
const std::string& propName,
cmTarget *target, cmTarget *target,
cmGeneratorExpression::PreprocessContext preprocessRule, cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties, ImportPropertyMap &properties,
@ -403,7 +406,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void getPropertyContents(cmTarget const* tgt, const char *prop, void getPropertyContents(cmTarget const* tgt, const std::string& prop,
std::set<std::string> &ifaceProperties) std::set<std::string> &ifaceProperties)
{ {
const char *p = tgt->GetProperty(prop); const char *p = tgt->GetProperty(prop);
@ -825,7 +828,7 @@ void
cmExportFileGenerator cmExportFileGenerator
::SetImportLinkProperty(std::string const& suffix, ::SetImportLinkProperty(std::string const& suffix,
cmTarget* target, cmTarget* target,
const char* propName, const std::string& propName,
std::vector<std::string> const& entries, std::vector<std::string> const& entries,
ImportPropertyMap& properties, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets std::vector<std::string>& missingTargets

View File

@ -95,7 +95,7 @@ protected:
ImportPropertyMap& properties, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets); std::vector<std::string>& missingTargets);
void SetImportLinkProperty(std::string const& suffix, void SetImportLinkProperty(std::string const& suffix,
cmTarget* target, const char* propName, cmTarget* target, const std::string& propName,
std::vector<std::string> const& entries, std::vector<std::string> const& entries,
ImportPropertyMap& properties, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets); std::vector<std::string>& missingTargets);
@ -116,7 +116,7 @@ protected:
cmMakefile* mf, cmMakefile* mf,
cmTarget* depender, cmTarget* depender,
cmTarget* dependee) = 0; cmTarget* dependee) = 0;
void PopulateInterfaceProperty(const char *, void PopulateInterfaceProperty(const std::string&,
cmTarget *target, cmTarget *target,
cmGeneratorExpression::PreprocessContext, cmGeneratorExpression::PreprocessContext,
ImportPropertyMap &properties, ImportPropertyMap &properties,
@ -125,7 +125,7 @@ protected:
cmGeneratorExpression::PreprocessContext, cmGeneratorExpression::PreprocessContext,
ImportPropertyMap &properties, ImportPropertyMap &properties,
std::vector<std::string> &missingTargets); std::vector<std::string> &missingTargets);
void PopulateInterfaceProperty(const char *propName, cmTarget *target, void PopulateInterfaceProperty(const std::string& propName, cmTarget *target,
ImportPropertyMap &properties); ImportPropertyMap &properties);
void PopulateCompatibleInterfaceProperties(cmTarget *target, void PopulateCompatibleInterfaceProperties(cmTarget *target,
ImportPropertyMap &properties); ImportPropertyMap &properties);
@ -174,7 +174,7 @@ protected:
std::set<cmTarget*> ExportedTargets; std::set<cmTarget*> ExportedTargets;
private: private:
void PopulateInterfaceProperty(const char *, const char *, void PopulateInterfaceProperty(const std::string&, const cmStdString&,
cmTarget *target, cmTarget *target,
cmGeneratorExpression::PreprocessContext, cmGeneratorExpression::PreprocessContext,
ImportPropertyMap &properties, ImportPropertyMap &properties,

View File

@ -46,7 +46,8 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
return true; return true;
} }
std::string cmExportTryCompileFileGenerator::FindTargets(const char *propName, std::string cmExportTryCompileFileGenerator::FindTargets(
const std::string& propName,
cmTarget const* tgt, cmTarget const* tgt,
std::set<cmTarget const*> &emitted) std::set<cmTarget const*> &emitted)
{ {

View File

@ -46,7 +46,7 @@ protected:
std::string InstallNameDir(cmTarget* target, std::string InstallNameDir(cmTarget* target,
const std::string& config); const std::string& config);
private: private:
std::string FindTargets(const char *prop, cmTarget const* tgt, std::string FindTargets(const std::string& prop, cmTarget const* tgt,
std::set<cmTarget const*> &emitted); std::set<cmTarget const*> &emitted);

View File

@ -234,7 +234,7 @@ const char *cmGeneratorTarget::GetName() const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char *cmGeneratorTarget::GetProperty(const char *prop) const const char *cmGeneratorTarget::GetProperty(const std::string& prop) const
{ {
return this->Target->GetProperty(prop); return this->Target->GetProperty(prop);
} }
@ -486,7 +486,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGeneratorTarget::GetPropertyAsBool(const char *prop) const bool cmGeneratorTarget::GetPropertyAsBool(const std::string& prop) const
{ {
return this->Target->GetPropertyAsBool(prop); return this->Target->GetPropertyAsBool(prop);
} }

View File

@ -28,8 +28,8 @@ public:
int GetType() const; int GetType() const;
const char *GetName() const; const char *GetName() const;
const char *GetProperty(const char *prop) const; const char *GetProperty(const std::string& prop) const;
bool GetPropertyAsBool(const char *prop) const; bool GetPropertyAsBool(const std::string& prop) const;
void GetSourceFiles(std::vector<cmSourceFile*>& files) const; void GetSourceFiles(std::vector<cmSourceFile*>& files) const;
void GetObjectSources(std::vector<cmSourceFile*> &) const; void GetObjectSources(std::vector<cmSourceFile*> &) const;

View File

@ -22,7 +22,7 @@ bool cmGetTargetPropertyCommand
} }
std::string var = args[0].c_str(); std::string var = args[0].c_str();
const std::string& targetName = args[1]; const std::string& targetName = args[1];
const char *prop = 0; std::string prop;
if(args[2] == "ALIASED_TARGET") if(args[2] == "ALIASED_TARGET")
{ {
@ -38,7 +38,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;
prop = target.GetProperty(args[2].c_str()); const char* prop_cstr = target.GetProperty(args[2].c_str());
if(prop_cstr)
{
prop = prop_cstr;
}
} }
else else
{ {
@ -70,9 +74,9 @@ bool cmGetTargetPropertyCommand
} }
} }
} }
if (prop) if (!prop.empty())
{ {
this->Makefile->AddDefinition(var.c_str(), prop); this->Makefile->AddDefinition(var.c_str(), prop.c_str());
return true; return true;
} }
this->Makefile->AddDefinition(var.c_str(), (var+"-NOTFOUND").c_str()); this->Makefile->AddDefinition(var.c_str(), (var+"-NOTFOUND").c_str());

View File

@ -1155,9 +1155,12 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
void void
cmLocalGenerator::ExpandRuleVariables(std::string& s, cmLocalGenerator::ExpandRuleVariables(std::string& s,
const RuleVariables& replaceValues) const RuleVariables& replaceValues)
{
if(replaceValues.RuleLauncher)
{ {
this->InsertRuleLauncher(s, replaceValues.CMTarget, this->InsertRuleLauncher(s, replaceValues.CMTarget,
replaceValues.RuleLauncher); replaceValues.RuleLauncher);
}
std::string::size_type start = s.find('<'); std::string::size_type start = s.find('<');
// no variables to expand // no variables to expand
if(start == s.npos) if(start == s.npos)
@ -1201,7 +1204,7 @@ cmLocalGenerator::ExpandRuleVariables(std::string& s,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmLocalGenerator::GetRuleLauncher(cmTarget* target, const char* cmLocalGenerator::GetRuleLauncher(cmTarget* target,
const char* prop) const std::string& prop)
{ {
if(target) if(target)
{ {
@ -1215,7 +1218,7 @@ const char* cmLocalGenerator::GetRuleLauncher(cmTarget* target,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target, void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target,
const char* prop) const std::string& prop)
{ {
if(const char* val = this->GetRuleLauncher(target, prop)) if(const char* val = this->GetRuleLauncher(target, prop))
{ {
@ -3455,11 +3458,12 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static void cmLGInfoProp(cmMakefile* mf, cmTarget* target, const char* prop) static void cmLGInfoProp(cmMakefile* mf, cmTarget* target,
const std::string& prop)
{ {
if(const char* val = target->GetProperty(prop)) if(const char* val = target->GetProperty(prop))
{ {
mf->AddDefinition(prop, val); mf->AddDefinition(prop.c_str(), val);
} }
} }

View File

@ -382,9 +382,9 @@ protected:
std::string ExpandRuleVariable(std::string const& variable, std::string ExpandRuleVariable(std::string const& variable,
const RuleVariables& replaceValues); const RuleVariables& replaceValues);
const char* GetRuleLauncher(cmTarget* target, const char* prop); const char* GetRuleLauncher(cmTarget* target, const std::string& prop);
void InsertRuleLauncher(std::string& s, cmTarget* target, void InsertRuleLauncher(std::string& s, cmTarget* target,
const char* prop); const std::string& prop);
/** Convert a target to a utility target for unsupported /** Convert a target to a utility target for unsupported

View File

@ -3548,17 +3548,9 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
return res; return res;
} }
void cmMakefile::SetProperty(const char* prop, const char* value) void cmMakefile::SetProperty(const std::string& prop, const char* value)
{ {
if (!prop) if ( prop == "LINK_DIRECTORIES" )
{
return;
}
// handle special props
std::string propname = prop;
if ( propname == "LINK_DIRECTORIES" )
{ {
std::vector<std::string> varArgsExpanded; std::vector<std::string> varArgsExpanded;
if(value) if(value)
@ -3568,7 +3560,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
this->SetLinkDirectories(varArgsExpanded); this->SetLinkDirectories(varArgsExpanded);
return; return;
} }
if (propname == "INCLUDE_DIRECTORIES") if (prop == "INCLUDE_DIRECTORIES")
{ {
this->IncludeDirectoriesEntries.clear(); this->IncludeDirectoriesEntries.clear();
if (!value) if (!value)
@ -3581,7 +3573,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
cmValueWithOrigin(value, lfbt)); cmValueWithOrigin(value, lfbt));
return; return;
} }
if (propname == "COMPILE_OPTIONS") if (prop == "COMPILE_OPTIONS")
{ {
this->CompileOptionsEntries.clear(); this->CompileOptionsEntries.clear();
if (!value) if (!value)
@ -3593,7 +3585,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt)); this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt));
return; return;
} }
if (propname == "COMPILE_DEFINITIONS") if (prop == "COMPILE_DEFINITIONS")
{ {
this->CompileDefinitionsEntries.clear(); this->CompileDefinitionsEntries.clear();
if (!value) if (!value)
@ -3607,13 +3599,13 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
return; return;
} }
if ( propname == "INCLUDE_REGULAR_EXPRESSION" ) if ( prop == "INCLUDE_REGULAR_EXPRESSION" )
{ {
this->SetIncludeRegularExpression(value); this->SetIncludeRegularExpression(value);
return; return;
} }
if ( propname == "ADDITIONAL_MAKE_CLEAN_FILES" ) if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" )
{ {
// This property is not inherrited // This property is not inherrited
if ( strcmp(this->GetCurrentDirectory(), if ( strcmp(this->GetCurrentDirectory(),
@ -3626,18 +3618,11 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
this->Properties.SetProperty(prop,value,cmProperty::DIRECTORY); this->Properties.SetProperty(prop,value,cmProperty::DIRECTORY);
} }
void cmMakefile::AppendProperty(const char* prop, const char* value, void cmMakefile::AppendProperty(const std::string& prop,
const char* value,
bool asString) bool asString)
{ {
if (!prop) if (prop == "INCLUDE_DIRECTORIES")
{
return;
}
// handle special props
std::string propname = prop;
if (propname == "INCLUDE_DIRECTORIES")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->GetBacktrace(lfbt); this->GetBacktrace(lfbt);
@ -3645,7 +3630,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
cmValueWithOrigin(value, lfbt)); cmValueWithOrigin(value, lfbt));
return; return;
} }
if (propname == "COMPILE_OPTIONS") if (prop == "COMPILE_OPTIONS")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->GetBacktrace(lfbt); this->GetBacktrace(lfbt);
@ -3653,7 +3638,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
cmValueWithOrigin(value, lfbt)); cmValueWithOrigin(value, lfbt));
return; return;
} }
if (propname == "COMPILE_DEFINITIONS") if (prop == "COMPILE_DEFINITIONS")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->GetBacktrace(lfbt); this->GetBacktrace(lfbt);
@ -3661,7 +3646,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
cmValueWithOrigin(value, lfbt)); cmValueWithOrigin(value, lfbt));
return; return;
} }
if ( propname == "LINK_DIRECTORIES" ) if ( prop == "LINK_DIRECTORIES" )
{ {
std::vector<std::string> varArgsExpanded; std::vector<std::string> varArgsExpanded;
cmSystemTools::ExpandListArgument(value, varArgsExpanded); cmSystemTools::ExpandListArgument(value, varArgsExpanded);
@ -3676,32 +3661,28 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString); this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString);
} }
const char *cmMakefile::GetPropertyOrDefinition(const char* prop) const const char *cmMakefile::GetPropertyOrDefinition(const std::string& prop) const
{ {
const char *ret = this->GetProperty(prop, cmProperty::DIRECTORY); const char *ret = this->GetProperty(prop, cmProperty::DIRECTORY);
if (!ret) if (!ret)
{ {
ret = this->GetDefinition(prop); ret = this->GetDefinition(prop.c_str());
} }
return ret; return ret;
} }
const char *cmMakefile::GetProperty(const char* prop) const const char *cmMakefile::GetProperty(const std::string& prop) const
{ {
return this->GetProperty(prop, cmProperty::DIRECTORY); return this->GetProperty(prop, cmProperty::DIRECTORY);
} }
const char *cmMakefile::GetProperty(const char* prop, const char *cmMakefile::GetProperty(const std::string& prop,
cmProperty::ScopeType scope) const cmProperty::ScopeType scope) const
{ {
if(!prop)
{
return 0;
}
// watch for specific properties // watch for specific properties
static std::string output; static std::string output;
output = ""; output = "";
if (!strcmp("PARENT_DIRECTORY",prop)) if (prop == "PARENT_DIRECTORY")
{ {
if(cmLocalGenerator* plg = this->LocalGenerator->GetParent()) if(cmLocalGenerator* plg = this->LocalGenerator->GetParent())
{ {
@ -3709,12 +3690,12 @@ const char *cmMakefile::GetProperty(const char* prop,
} }
return output.c_str(); return output.c_str();
} }
else if (!strcmp("INCLUDE_REGULAR_EXPRESSION",prop) ) else if (prop == "INCLUDE_REGULAR_EXPRESSION" )
{ {
output = this->GetIncludeRegularExpression(); output = this->GetIncludeRegularExpression();
return output.c_str(); return output.c_str();
} }
else if (!strcmp("LISTFILE_STACK",prop)) else if (prop == "LISTFILE_STACK")
{ {
for (std::deque<cmStdString>::const_iterator for (std::deque<cmStdString>::const_iterator
i = this->ListFileStack.begin(); i = this->ListFileStack.begin();
@ -3728,10 +3709,10 @@ const char *cmMakefile::GetProperty(const char* prop,
} }
return output.c_str(); return output.c_str();
} }
else if (!strcmp("VARIABLES",prop) || !strcmp("CACHE_VARIABLES",prop)) else if (prop == "VARIABLES" || prop == "CACHE_VARIABLES")
{ {
int cacheonly = 0; int cacheonly = 0;
if ( !strcmp("CACHE_VARIABLES",prop) ) if ( prop == "CACHE_VARIABLES" )
{ {
cacheonly = 1; cacheonly = 1;
} }
@ -3746,17 +3727,17 @@ const char *cmMakefile::GetProperty(const char* prop,
} }
return output.c_str(); return output.c_str();
} }
else if (!strcmp("MACROS",prop)) else if (prop == "MACROS")
{ {
this->GetListOfMacros(output); this->GetListOfMacros(output);
return output.c_str(); return output.c_str();
} }
else if (!strcmp("DEFINITIONS",prop)) else if (prop == "DEFINITIONS")
{ {
output += this->DefineFlagsOrig; output += this->DefineFlagsOrig;
return output.c_str(); return output.c_str();
} }
else if (!strcmp("LINK_DIRECTORIES",prop)) else if (prop == "LINK_DIRECTORIES")
{ {
cmOStringStream str; cmOStringStream str;
for (std::vector<std::string>::const_iterator for (std::vector<std::string>::const_iterator
@ -3773,7 +3754,7 @@ const char *cmMakefile::GetProperty(const char* prop,
output = str.str(); output = str.str();
return output.c_str(); return output.c_str();
} }
else if (!strcmp("INCLUDE_DIRECTORIES",prop)) else if (prop == "INCLUDE_DIRECTORIES")
{ {
std::string sep; std::string sep;
for (std::vector<cmValueWithOrigin>::const_iterator for (std::vector<cmValueWithOrigin>::const_iterator
@ -3787,7 +3768,7 @@ const char *cmMakefile::GetProperty(const char* prop,
} }
return output.c_str(); return output.c_str();
} }
else if (!strcmp("COMPILE_OPTIONS",prop)) else if (prop == "COMPILE_OPTIONS")
{ {
std::string sep; std::string sep;
for (std::vector<cmValueWithOrigin>::const_iterator for (std::vector<cmValueWithOrigin>::const_iterator
@ -3801,7 +3782,7 @@ const char *cmMakefile::GetProperty(const char* prop,
} }
return output.c_str(); return output.c_str();
} }
else if (!strcmp("COMPILE_DEFINITIONS",prop)) else if (prop == "COMPILE_DEFINITIONS")
{ {
std::string sep; std::string sep;
for (std::vector<cmValueWithOrigin>::const_iterator for (std::vector<cmValueWithOrigin>::const_iterator
@ -3832,7 +3813,7 @@ const char *cmMakefile::GetProperty(const char* prop,
return retVal; return retVal;
} }
bool cmMakefile::GetPropertyAsBool(const char* prop) const bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
{ {
return cmSystemTools::IsOn(this->GetProperty(prop)); return cmSystemTools::IsOn(this->GetProperty(prop));
} }
@ -4014,9 +3995,9 @@ void cmMakefile::PopScope()
} }
} }
void cmMakefile::RaiseScope(const char *var, const char *varDef) void cmMakefile::RaiseScope(const cmStdString& var, const char *varDef)
{ {
if (!var || !strlen(var)) if (var.empty())
{ {
return; return;
} }
@ -4025,10 +4006,10 @@ void cmMakefile::RaiseScope(const char *var, const char *varDef)
if(cmDefinitions* up = cur.GetParent()) if(cmDefinitions* up = cur.GetParent())
{ {
// First localize the definition in the current scope. // First localize the definition in the current scope.
cur.Get(var); cur.Get(var.c_str());
// Now update the definition in the parent scope. // Now update the definition in the parent scope.
up->Set(var, varDef); up->Set(var.c_str(), varDef);
} }
else if(cmLocalGenerator* plg = this->LocalGenerator->GetParent()) else if(cmLocalGenerator* plg = this->LocalGenerator->GetParent())
{ {
@ -4038,11 +4019,11 @@ void cmMakefile::RaiseScope(const char *var, const char *varDef)
cmMakefile* parent = plg->GetMakefile(); cmMakefile* parent = plg->GetMakefile();
if (varDef) if (varDef)
{ {
parent->AddDefinition(var, varDef); parent->AddDefinition(var.c_str(), varDef);
} }
else else
{ {
parent->RemoveDefinition(var); parent->RemoveDefinition(var.c_str());
} }
} }
else else

View File

@ -800,12 +800,14 @@ public:
std::string GetModulesFile(const char* name) const; std::string GetModulesFile(const char* name) const;
///! Set/Get a property of this directory ///! Set/Get a property of this directory
void SetProperty(const char *prop, const char *value); void SetProperty(const std::string& prop, const char *value);
void AppendProperty(const char *prop, const char *value,bool asString=false); void AppendProperty(const std::string& prop, const char *value,
const char *GetProperty(const char *prop) const; bool asString=false);
const char *GetPropertyOrDefinition(const char *prop) const; const char *GetProperty(const std::string& prop) const;
const char *GetProperty(const char *prop, cmProperty::ScopeType scope) const; const char *GetPropertyOrDefinition(const std::string& prop) const;
bool GetPropertyAsBool(const char *prop) const; const char *GetProperty(const std::string& prop,
cmProperty::ScopeType scope) const;
bool GetPropertyAsBool(const std::string& prop) const;
const char* GetFeature(const char* feature, const char* config); const char* GetFeature(const char* feature, const char* config);
@ -835,7 +837,7 @@ public:
// push and pop variable scopes // push and pop variable scopes
void PushScope(); void PushScope();
void PopScope(); void PopScope();
void RaiseScope(const char *var, const char *value); void RaiseScope(const cmStdString& var, const char *value);
/** Helper class to push and pop scopes automatically. */ /** Helper class to push and pop scopes automatically. */
class ScopePushPop class ScopePushPop

View File

@ -12,14 +12,15 @@
#include "cmProperty.h" #include "cmProperty.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
void cmProperty::Set(const char *name, const char *value) void cmProperty::Set(const std::string& name, const char *value)
{ {
this->Name = name; this->Name = name;
this->Value = value; this->Value = value;
this->ValueHasBeenSet = true; this->ValueHasBeenSet = true;
} }
void cmProperty::Append(const char *name, const char *value, bool asString) void cmProperty::Append(const std::string& name, const char *value,
bool asString)
{ {
this->Name = name; this->Name = name;
if(!this->Value.empty() && *value && !asString) if(!this->Value.empty() && *value && !asString)

View File

@ -21,10 +21,11 @@ public:
TEST, VARIABLE, CACHED_VARIABLE }; TEST, VARIABLE, CACHED_VARIABLE };
// set this property // set this property
void Set(const char *name, const char *value); void Set(const std::string& name, const char *value);
// append to this property // append to this property
void Append(const char *name, const char *value, bool asString = false); void Append(const std::string& name, const char *value,
bool asString = false);
// get the value // get the value
const char *GetValue() const; const char *GetValue() const;

View File

@ -13,7 +13,7 @@
#include "cmSystemTools.h" #include "cmSystemTools.h"
void cmPropertyDefinition void cmPropertyDefinition
::DefineProperty(const char *name, cmProperty::ScopeType scope, ::DefineProperty(const std::string& name, cmProperty::ScopeType scope,
const char *shortDescription, const char *shortDescription,
const char *fullDescription, const char *fullDescription,
bool chain) bool chain)

View File

@ -27,7 +27,7 @@ class cmPropertyDefinition
{ {
public: public:
/// Define this property /// Define this property
void DefineProperty(const char *name, cmProperty::ScopeType scope, void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
const char *ShortDescription, const char *ShortDescription,
const char *FullDescription, const char *FullDescription,
bool chained); bool chained);

View File

@ -14,16 +14,11 @@
#include "cmDocumentationSection.h" #include "cmDocumentationSection.h"
void cmPropertyDefinitionMap void cmPropertyDefinitionMap
::DefineProperty(const char *name, cmProperty::ScopeType scope, ::DefineProperty(const cmStdString& name, cmProperty::ScopeType scope,
const char *ShortDescription, const char *ShortDescription,
const char *FullDescription, const char *FullDescription,
bool chain) bool chain)
{ {
if (!name)
{
return;
}
cmPropertyDefinitionMap::iterator it = this->find(name); cmPropertyDefinitionMap::iterator it = this->find(name);
cmPropertyDefinition *prop; cmPropertyDefinition *prop;
if (it == this->end()) if (it == this->end())
@ -34,13 +29,8 @@ void cmPropertyDefinitionMap
} }
} }
bool cmPropertyDefinitionMap::IsPropertyDefined(const char *name) bool cmPropertyDefinitionMap::IsPropertyDefined(const cmStdString& name)
{ {
if (!name)
{
return false;
}
cmPropertyDefinitionMap::iterator it = this->find(name); cmPropertyDefinitionMap::iterator it = this->find(name);
if (it == this->end()) if (it == this->end())
{ {
@ -50,13 +40,8 @@ bool cmPropertyDefinitionMap::IsPropertyDefined(const char *name)
return true; return true;
} }
bool cmPropertyDefinitionMap::IsPropertyChained(const char *name) bool cmPropertyDefinitionMap::IsPropertyChained(const cmStdString& name)
{ {
if (!name)
{
return false;
}
cmPropertyDefinitionMap::iterator it = this->find(name); cmPropertyDefinitionMap::iterator it = this->find(name);
if (it == this->end()) if (it == this->end())
{ {

View File

@ -21,16 +21,16 @@ public std::map<cmStdString,cmPropertyDefinition>
{ {
public: public:
// define the property // define the property
void DefineProperty(const char *name, cmProperty::ScopeType scope, void DefineProperty(const cmStdString& name, cmProperty::ScopeType scope,
const char *ShortDescription, const char *ShortDescription,
const char *FullDescription, const char *FullDescription,
bool chain); bool chain);
// has a named property been defined // has a named property been defined
bool IsPropertyDefined(const char *name); bool IsPropertyDefined(const cmStdString& name);
// is a named property set to chain // is a named property set to chain
bool IsPropertyChained(const char *name); bool IsPropertyChained(const cmStdString& name);
}; };
#endif #endif

View File

@ -13,7 +13,7 @@
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmake.h" #include "cmake.h"
cmProperty *cmPropertyMap::GetOrCreateProperty(const char *name) cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name)
{ {
cmPropertyMap::iterator it = this->find(name); cmPropertyMap::iterator it = this->find(name);
cmProperty *prop; cmProperty *prop;
@ -28,13 +28,9 @@ cmProperty *cmPropertyMap::GetOrCreateProperty(const char *name)
return prop; return prop;
} }
void cmPropertyMap::SetProperty(const char *name, const char *value, void cmPropertyMap::SetProperty(const std::string& name, const char *value,
cmProperty::ScopeType scope) cmProperty::ScopeType scope)
{ {
if (!name)
{
return;
}
if(!value) if(!value)
{ {
this->erase(name); this->erase(name);
@ -46,11 +42,11 @@ void cmPropertyMap::SetProperty(const char *name, const char *value,
prop->Set(name,value); prop->Set(name,value);
} }
void cmPropertyMap::AppendProperty(const char* name, const char* value, void cmPropertyMap::AppendProperty(const std::string& name, const char* value,
cmProperty::ScopeType scope, bool asString) cmProperty::ScopeType scope, bool asString)
{ {
// Skip if nothing to append. // Skip if nothing to append.
if(!name || !value || !*value) if(!value || !*value)
{ {
return; return;
} }
@ -61,12 +57,12 @@ void cmPropertyMap::AppendProperty(const char* name, const char* value,
} }
const char *cmPropertyMap const char *cmPropertyMap
::GetPropertyValue(const char *name, ::GetPropertyValue(const std::string& name,
cmProperty::ScopeType scope, cmProperty::ScopeType scope,
bool &chain) const bool &chain) const
{ {
chain = false; chain = false;
if (!name) if (name.empty())
{ {
return 0; return 0;
} }

View File

@ -19,15 +19,15 @@ class cmake;
class cmPropertyMap : public std::map<cmStdString,cmProperty> class cmPropertyMap : public std::map<cmStdString,cmProperty>
{ {
public: public:
cmProperty *GetOrCreateProperty(const char *name); cmProperty *GetOrCreateProperty(const std::string& name);
void SetProperty(const char *name, const char *value, void SetProperty(const std::string& name, const char *value,
cmProperty::ScopeType scope); cmProperty::ScopeType scope);
void AppendProperty(const char* name, const char* value, void AppendProperty(const std::string& name, const char* value,
cmProperty::ScopeType scope, bool asString=false); cmProperty::ScopeType scope, bool asString=false);
const char *GetPropertyValue(const char *name, const char *GetPropertyValue(const std::string& name,
cmProperty::ScopeType scope, cmProperty::ScopeType scope,
bool &chain) const; bool &chain) const;

View File

@ -105,7 +105,7 @@ static std::string extractSubDir(const std::string& absPath,
static void copyTargetProperty(cmTarget* destinationTarget, static void copyTargetProperty(cmTarget* destinationTarget,
cmTarget* sourceTarget, cmTarget* sourceTarget,
const char* propertyName) const std::string& propertyName)
{ {
const char* propertyValue = sourceTarget->GetProperty(propertyName); const char* propertyValue = sourceTarget->GetProperty(propertyName);
if (propertyValue) if (propertyValue)

View File

@ -279,13 +279,8 @@ bool cmSourceFile::Matches(cmSourceFileLocation const& loc)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmSourceFile::SetProperty(const char* prop, const char* value) void cmSourceFile::SetProperty(const std::string& prop, const char* value)
{ {
if (!prop)
{
return;
}
this->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE); this->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE);
std::string ext = std::string ext =
@ -293,7 +288,7 @@ void cmSourceFile::SetProperty(const char* prop, const char* value)
if (ext == ".ui") if (ext == ".ui")
{ {
cmMakefile const* mf = this->Location.GetMakefile(); cmMakefile const* mf = this->Location.GetMakefile();
if (strcmp(prop, "AUTOUIC_OPTIONS") == 0) if (prop == "AUTOUIC_OPTIONS")
{ {
const_cast<cmMakefile*>(mf)->AddQtUiFileWithOptions(this); const_cast<cmMakefile*>(mf)->AddQtUiFileWithOptions(this);
} }
@ -301,19 +296,15 @@ void cmSourceFile::SetProperty(const char* prop, const char* value)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmSourceFile::AppendProperty(const char* prop, const char* value, void cmSourceFile::AppendProperty(const std::string& prop, const char* value,
bool asString) bool asString)
{ {
if (!prop)
{
return;
}
this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE, this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE,
asString); asString);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmSourceFile::GetPropertyForUser(const char *prop) const char* cmSourceFile::GetPropertyForUser(const std::string& prop)
{ {
// This method is a consequence of design history and backwards // This method is a consequence of design history and backwards
// compatibility. GetProperty is (and should be) a const method. // compatibility. GetProperty is (and should be) a const method.
@ -329,7 +320,7 @@ const char* cmSourceFile::GetPropertyForUser(const char *prop)
// cmSourceFileLocation class to commit to a particular full path to // cmSourceFileLocation class to commit to a particular full path to
// the source file as late as possible. If the users requests the // the source file as late as possible. If the users requests the
// LOCATION property we must commit now. // LOCATION property we must commit now.
if(strcmp(prop, "LOCATION") == 0) if(prop == "LOCATION")
{ {
// Commit to a location. // Commit to a location.
this->GetFullPath(); this->GetFullPath();
@ -340,10 +331,10 @@ const char* cmSourceFile::GetPropertyForUser(const char *prop)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmSourceFile::GetProperty(const char* prop) const const char* cmSourceFile::GetProperty(const std::string& prop) const
{ {
// Check for computed properties. // Check for computed properties.
if(strcmp(prop, "LOCATION") == 0) if(prop == "LOCATION")
{ {
if(this->FullPath.empty()) if(this->FullPath.empty())
{ {
@ -368,7 +359,7 @@ const char* cmSourceFile::GetProperty(const char* prop) const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmSourceFile::GetPropertyAsBool(const char* prop) const bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const
{ {
return cmSystemTools::IsOn(this->GetProperty(prop)); return cmSystemTools::IsOn(this->GetProperty(prop));
} }

View File

@ -43,14 +43,15 @@ public:
void SetCustomCommand(cmCustomCommand *cc); void SetCustomCommand(cmCustomCommand *cc);
///! Set/Get a property of this source file ///! Set/Get a property of this source file
void SetProperty(const char *prop, const char *value); void SetProperty(const std::string& prop, const char *value);
void AppendProperty(const char* prop, const char* value,bool asString=false); void AppendProperty(const std::string& prop,
const char *GetProperty(const char *prop) const; const char* value,bool asString=false);
bool GetPropertyAsBool(const char *prop) const; const char *GetProperty(const std::string& prop) const;
bool GetPropertyAsBool(const std::string& prop) const;
/** Implement getting a property when called from a CMake language /** Implement getting a property when called from a CMake language
command like get_property or get_source_file_property. */ command like get_property or get_source_file_property. */
const char* GetPropertyForUser(const char *prop); const char* GetPropertyForUser(const std::string& prop);
/** /**
* The full path to the file. The non-const version of this method * The full path to the file. The non-const version of this method

View File

@ -1293,7 +1293,7 @@ void cmTarget::GatherDependencies( const cmMakefile& mf,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static bool whiteListedInterfaceProperty(const char *prop) static bool whiteListedInterfaceProperty(const std::string& prop)
{ {
if(cmHasLiteralPrefix(prop, "INTERFACE_")) if(cmHasLiteralPrefix(prop, "INTERFACE_"))
{ {
@ -1313,8 +1313,8 @@ static bool whiteListedInterfaceProperty(const char *prop)
if (std::binary_search(cmArrayBegin(builtIns), if (std::binary_search(cmArrayBegin(builtIns),
cmArrayEnd(builtIns), cmArrayEnd(builtIns),
prop, prop.c_str(),
cmStrCmp(prop))) cmStrCmp(prop.c_str())))
{ {
return true; return true;
} }
@ -1328,12 +1328,8 @@ static bool whiteListedInterfaceProperty(const char *prop)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::SetProperty(const char* prop, const char* value) void cmTarget::SetProperty(const std::string& prop, const char* value)
{ {
if (!prop)
{
return;
}
if (this->GetType() == INTERFACE_LIBRARY if (this->GetType() == INTERFACE_LIBRARY
&& !whiteListedInterfaceProperty(prop)) && !whiteListedInterfaceProperty(prop))
{ {
@ -1344,14 +1340,14 @@ void cmTarget::SetProperty(const char* prop, const char* value)
return; return;
} }
if (strcmp(prop, "NAME") == 0) if (prop == "NAME")
{ {
cmOStringStream e; cmOStringStream e;
e << "NAME property is read-only\n"; e << "NAME property is read-only\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
return; return;
} }
if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0) if(prop == "INCLUDE_DIRECTORIES")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt); this->Makefile->GetBacktrace(lfbt);
@ -1362,7 +1358,7 @@ void cmTarget::SetProperty(const char* prop, const char* value)
new cmTargetInternals::TargetPropertyEntry(cge)); new cmTargetInternals::TargetPropertyEntry(cge));
return; return;
} }
if(strcmp(prop,"COMPILE_OPTIONS") == 0) if(prop == "COMPILE_OPTIONS")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt); this->Makefile->GetBacktrace(lfbt);
@ -1373,7 +1369,7 @@ void cmTarget::SetProperty(const char* prop, const char* value)
new cmTargetInternals::TargetPropertyEntry(cge)); new cmTargetInternals::TargetPropertyEntry(cge));
return; return;
} }
if(strcmp(prop,"COMPILE_DEFINITIONS") == 0) if(prop == "COMPILE_DEFINITIONS")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt); this->Makefile->GetBacktrace(lfbt);
@ -1384,7 +1380,7 @@ void cmTarget::SetProperty(const char* prop, const char* value)
new cmTargetInternals::TargetPropertyEntry(cge)); new cmTargetInternals::TargetPropertyEntry(cge));
return; return;
} }
if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported()) if(prop == "EXPORT_NAME" && this->IsImported())
{ {
cmOStringStream e; cmOStringStream e;
e << "EXPORT_NAME property can't be set on imported targets (\"" e << "EXPORT_NAME property can't be set on imported targets (\""
@ -1392,7 +1388,7 @@ void cmTarget::SetProperty(const char* prop, const char* value)
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
return; return;
} }
if (strcmp(prop, "LINK_LIBRARIES") == 0) if (prop == "LINK_LIBRARIES")
{ {
this->Internal->LinkImplementationPropertyEntries.clear(); this->Internal->LinkImplementationPropertyEntries.clear();
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
@ -1406,13 +1402,9 @@ void cmTarget::SetProperty(const char* prop, const char* value)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::AppendProperty(const char* prop, const char* value, void cmTarget::AppendProperty(const std::string& prop, const char* value,
bool asString) bool asString)
{ {
if (!prop)
{
return;
}
if (this->GetType() == INTERFACE_LIBRARY if (this->GetType() == INTERFACE_LIBRARY
&& !whiteListedInterfaceProperty(prop)) && !whiteListedInterfaceProperty(prop))
{ {
@ -1422,14 +1414,14 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
return; return;
} }
if (strcmp(prop, "NAME") == 0) if (prop == "NAME")
{ {
cmOStringStream e; cmOStringStream e;
e << "NAME property is read-only\n"; e << "NAME property is read-only\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
return; return;
} }
if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0) if(prop == "INCLUDE_DIRECTORIES")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt); this->Makefile->GetBacktrace(lfbt);
@ -1438,7 +1430,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
return; return;
} }
if(strcmp(prop,"COMPILE_OPTIONS") == 0) if(prop == "COMPILE_OPTIONS")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt); this->Makefile->GetBacktrace(lfbt);
@ -1447,7 +1439,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
return; return;
} }
if(strcmp(prop,"COMPILE_DEFINITIONS") == 0) if(prop == "COMPILE_DEFINITIONS")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt); this->Makefile->GetBacktrace(lfbt);
@ -1456,7 +1448,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
return; return;
} }
if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported()) if(prop == "EXPORT_NAME" && this->IsImported())
{ {
cmOStringStream e; cmOStringStream e;
e << "EXPORT_NAME property can't be set on imported targets (\"" e << "EXPORT_NAME property can't be set on imported targets (\""
@ -1464,7 +1456,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
return; return;
} }
if (strcmp(prop, "LINK_LIBRARIES") == 0) if (prop == "LINK_LIBRARIES")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt); this->Makefile->GetBacktrace(lfbt);
@ -2215,7 +2207,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::MaybeInvalidatePropertyCache(const char* prop) void cmTarget::MaybeInvalidatePropertyCache(const std::string& prop)
{ {
// Wipe out maps caching information affected by this property. // Wipe out maps caching information affected by this property.
if(this->IsImported() && cmHasLiteralPrefix(prop, "IMPORTED")) if(this->IsImported() && cmHasLiteralPrefix(prop, "IMPORTED"))
@ -2230,8 +2222,8 @@ void cmTarget::MaybeInvalidatePropertyCache(const char* prop)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static void cmTargetCheckLINK_INTERFACE_LIBRARIES( static void cmTargetCheckLINK_INTERFACE_LIBRARIES(
const char* prop, const char* value, cmMakefile* context, bool imported const std::string& prop, const char* value, cmMakefile* context,
) bool imported)
{ {
// Look for link-type keywords in the value. // Look for link-type keywords in the value.
static cmsys::RegularExpression static cmsys::RegularExpression
@ -2295,7 +2287,8 @@ static void cmTargetCheckINTERFACE_LINK_LIBRARIES(const char* value,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::CheckProperty(const char* prop, cmMakefile* context) const void cmTarget::CheckProperty(const std::string& prop,
cmMakefile* context) const
{ {
// Certain properties need checking. // Certain properties need checking.
if(cmHasLiteralPrefix(prop, "LINK_INTERFACE_LIBRARIES")) if(cmHasLiteralPrefix(prop, "LINK_INTERFACE_LIBRARIES"))
@ -2579,7 +2572,7 @@ const char* cmTarget::GetFeature(const char* feature, const char* config) const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char *cmTarget::GetProperty(const char* prop) const const char *cmTarget::GetProperty(const std::string& prop) const
{ {
return this->GetProperty(prop, cmProperty::TARGET); return this->GetProperty(prop, cmProperty::TARGET);
} }
@ -2622,14 +2615,9 @@ bool cmTarget::HandleLocationPropertyPolicy() const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char *cmTarget::GetProperty(const char* prop, const char *cmTarget::GetProperty(const std::string& prop,
cmProperty::ScopeType scope) const cmProperty::ScopeType scope) const
{ {
if(!prop)
{
return 0;
}
if (this->GetType() == INTERFACE_LIBRARY if (this->GetType() == INTERFACE_LIBRARY
&& !whiteListedInterfaceProperty(prop)) && !whiteListedInterfaceProperty(prop))
{ {
@ -2640,7 +2628,7 @@ const char *cmTarget::GetProperty(const char* prop,
return 0; return 0;
} }
if (strcmp(prop, "NAME") == 0) if (prop == "NAME")
{ {
return this->GetName(); return this->GetName();
} }
@ -2653,7 +2641,7 @@ const char *cmTarget::GetProperty(const char* prop,
this->GetType() == cmTarget::MODULE_LIBRARY || this->GetType() == cmTarget::MODULE_LIBRARY ||
this->GetType() == cmTarget::UNKNOWN_LIBRARY) this->GetType() == cmTarget::UNKNOWN_LIBRARY)
{ {
if(strcmp(prop,"LOCATION") == 0) if(prop == "LOCATION")
{ {
if (!this->HandleLocationPropertyPolicy()) if (!this->HandleLocationPropertyPolicy())
{ {
@ -2680,13 +2668,13 @@ const char *cmTarget::GetProperty(const char* prop,
{ {
return 0; return 0;
} }
std::string configName = prop+9; const char* configName = prop.c_str() + 9;
this->Properties.SetProperty(prop, this->Properties.SetProperty(prop,
this->GetLocation(configName.c_str()), this->GetLocation(configName),
cmProperty::TARGET); cmProperty::TARGET);
} }
} }
if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0) if(prop == "INCLUDE_DIRECTORIES")
{ {
static std::string output; static std::string output;
output = ""; output = "";
@ -2704,7 +2692,7 @@ const char *cmTarget::GetProperty(const char* prop,
} }
return output.c_str(); return output.c_str();
} }
if(strcmp(prop,"COMPILE_OPTIONS") == 0) if(prop == "COMPILE_OPTIONS")
{ {
static std::string output; static std::string output;
output = ""; output = "";
@ -2722,7 +2710,7 @@ const char *cmTarget::GetProperty(const char* prop,
} }
return output.c_str(); return output.c_str();
} }
if(strcmp(prop,"COMPILE_DEFINITIONS") == 0) if(prop == "COMPILE_DEFINITIONS")
{ {
static std::string output; static std::string output;
output = ""; output = "";
@ -2740,7 +2728,7 @@ const char *cmTarget::GetProperty(const char* prop,
} }
return output.c_str(); return output.c_str();
} }
if(strcmp(prop,"LINK_LIBRARIES") == 0) if(prop == "LINK_LIBRARIES")
{ {
static std::string output; static std::string output;
output = ""; output = "";
@ -2757,12 +2745,12 @@ const char *cmTarget::GetProperty(const char* prop,
return output.c_str(); return output.c_str();
} }
if (strcmp(prop,"IMPORTED") == 0) if (prop == "IMPORTED")
{ {
return this->IsImported()?"TRUE":"FALSE"; return this->IsImported()?"TRUE":"FALSE";
} }
if(!strcmp(prop,"SOURCES")) if(prop == "SOURCES")
{ {
cmOStringStream ss; cmOStringStream ss;
const char* sep = ""; const char* sep = "";
@ -2791,7 +2779,7 @@ const char *cmTarget::GetProperty(const char* prop,
} }
// the type property returns what type the target is // the type property returns what type the target is
if (!strcmp(prop,"TYPE")) if (prop == "TYPE")
{ {
return cmTarget::GetTargetTypeName(this->GetType()); return cmTarget::GetTargetTypeName(this->GetType());
} }
@ -2806,7 +2794,7 @@ const char *cmTarget::GetProperty(const char* prop,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmTarget::GetPropertyAsBool(const char* prop) const bool cmTarget::GetPropertyAsBool(const std::string& prop) const
{ {
return cmSystemTools::IsOn(this->GetProperty(prop)); return cmSystemTools::IsOn(this->GetProperty(prop));
} }
@ -3804,7 +3792,7 @@ bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::SetPropertyDefault(const char* property, void cmTarget::SetPropertyDefault(const std::string& property,
const char* default_value) const char* default_value)
{ {
// Compute the name of the variable holding the default value. // Compute the name of the variable holding the default value.
@ -4740,7 +4728,7 @@ const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p, bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p,
const char *interfaceProperty, const std::string& interfaceProperty,
const char *config) const char *config)
{ {
std::vector<cmTarget*> deps; std::vector<cmTarget*> deps;
@ -5984,14 +5972,14 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const
template<typename PropertyType> template<typename PropertyType>
PropertyType getLinkInterfaceDependentProperty(cmTarget const* tgt, PropertyType getLinkInterfaceDependentProperty(cmTarget const* tgt,
const std::string prop, const std::string& prop,
const char *config, const char *config,
CompatibleType, CompatibleType,
PropertyType *); PropertyType *);
template<> template<>
bool getLinkInterfaceDependentProperty(cmTarget const* tgt, bool getLinkInterfaceDependentProperty(cmTarget const* tgt,
const std::string prop, const std::string& prop,
const char *config, const char *config,
CompatibleType, bool *) CompatibleType, bool *)
{ {
@ -6000,7 +5988,7 @@ bool getLinkInterfaceDependentProperty(cmTarget const* tgt,
template<> template<>
const char * getLinkInterfaceDependentProperty(cmTarget const* tgt, const char * getLinkInterfaceDependentProperty(cmTarget const* tgt,
const std::string prop, const std::string& prop,
const char *config, const char *config,
CompatibleType t, CompatibleType t,
const char **) const char **)
@ -6025,7 +6013,7 @@ const char * getLinkInterfaceDependentProperty(cmTarget const* tgt,
template<typename PropertyType> template<typename PropertyType>
void checkPropertyConsistency(cmTarget const* depender, void checkPropertyConsistency(cmTarget const* depender,
cmTarget const* dependee, cmTarget const* dependee,
const char *propName, const cmStdString& propName,
std::set<cmStdString> &emitted, std::set<cmStdString> &emitted,
const char *config, const char *config,
CompatibleType t, CompatibleType t,
@ -6135,14 +6123,14 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
} }
checkPropertyConsistency<bool>(this, li->Target, checkPropertyConsistency<bool>(this, li->Target,
"COMPATIBLE_INTERFACE_BOOL", std::string("COMPATIBLE_INTERFACE_BOOL"),
emittedBools, config, BoolType, 0); emittedBools, config, BoolType, 0);
if (cmSystemTools::GetErrorOccuredFlag()) if (cmSystemTools::GetErrorOccuredFlag())
{ {
return; return;
} }
checkPropertyConsistency<const char *>(this, li->Target, checkPropertyConsistency<const char *>(this, li->Target,
"COMPATIBLE_INTERFACE_STRING", std::string("COMPATIBLE_INTERFACE_STRING"),
emittedStrings, config, emittedStrings, config,
StringType, 0); StringType, 0);
if (cmSystemTools::GetErrorOccuredFlag()) if (cmSystemTools::GetErrorOccuredFlag())
@ -6150,7 +6138,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
return; return;
} }
checkPropertyConsistency<const char *>(this, li->Target, checkPropertyConsistency<const char *>(this, li->Target,
"COMPATIBLE_INTERFACE_NUMBER_MIN", std::string("COMPATIBLE_INTERFACE_NUMBER_MIN"),
emittedMinNumbers, config, emittedMinNumbers, config,
NumberMinType, 0); NumberMinType, 0);
if (cmSystemTools::GetErrorOccuredFlag()) if (cmSystemTools::GetErrorOccuredFlag())
@ -6158,7 +6146,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
return; return;
} }
checkPropertyConsistency<const char *>(this, li->Target, checkPropertyConsistency<const char *>(this, li->Target,
"COMPATIBLE_INTERFACE_NUMBER_MAX", std::string("COMPATIBLE_INTERFACE_NUMBER_MAX"),
emittedMaxNumbers, config, emittedMaxNumbers, config,
NumberMaxType, 0); NumberMaxType, 0);
if (cmSystemTools::GetErrorOccuredFlag()) if (cmSystemTools::GetErrorOccuredFlag())

View File

@ -223,12 +223,14 @@ public:
void FinishConfigure(); void FinishConfigure();
///! Set/Get a property of this target file ///! Set/Get a property of this target file
void SetProperty(const char *prop, const char *value); void SetProperty(const std::string& prop, const char *value);
void AppendProperty(const char* prop, const char* value,bool asString=false); void AppendProperty(const std::string& prop, const char* value,
const char *GetProperty(const char *prop) const; bool asString=false);
const char *GetProperty(const char *prop, cmProperty::ScopeType scope) const; const char *GetProperty(const std::string& prop) const;
bool GetPropertyAsBool(const char *prop) const; const char *GetProperty(const std::string& prop,
void CheckProperty(const char* prop, cmMakefile* context) const; cmProperty::ScopeType scope) const;
bool GetPropertyAsBool(const std::string& prop) const;
void CheckProperty(const std::string& prop, cmMakefile* context) const;
const char* GetFeature(const char* feature, const char* config) const; const char* GetFeature(const char* feature, const char* config) const;
@ -632,7 +634,8 @@ private:
// Use a makefile variable to set a default for the given property. // Use a makefile variable to set a default for the given property.
// If the variable is not defined use the given default instead. // If the variable is not defined use the given default instead.
void SetPropertyDefault(const char* property, const char* default_value); void SetPropertyDefault(const std::string& property,
const char* default_value);
// Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type. // Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type.
const char* GetOutputTargetType(bool implib) const; const char* GetOutputTargetType(bool implib) const;
@ -729,7 +732,7 @@ private:
void ClearLinkMaps(); void ClearLinkMaps();
void MaybeInvalidatePropertyCache(const char* prop); void MaybeInvalidatePropertyCache(const std::string& prop);
void ProcessSourceExpression(std::string const& expr); void ProcessSourceExpression(std::string const& expr);

View File

@ -16,7 +16,8 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmTargetPropCommandBase bool cmTargetPropCommandBase
::HandleArguments(std::vector<std::string> const& args, const char *prop, ::HandleArguments(std::vector<std::string> const& args,
const std::string& prop,
ArgumentFlags flags) ArgumentFlags flags)
{ {
if(args.size() < 2) if(args.size() < 2)

View File

@ -29,7 +29,8 @@ public:
}; };
bool HandleArguments(std::vector<std::string> const& args, bool HandleArguments(std::vector<std::string> const& args,
const char *prop, ArgumentFlags flags = NO_FLAGS); const std::string& prop,
ArgumentFlags flags = NO_FLAGS);
cmTypeMacro(cmTargetPropCommandBase, cmCommand); cmTypeMacro(cmTargetPropCommandBase, cmCommand);
protected: protected:

View File

@ -54,7 +54,7 @@ void cmTest::SetCommand(std::vector<std::string> const& command)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char *cmTest::GetProperty(const char* prop) const const char *cmTest::GetProperty(const std::string& prop) const
{ {
bool chain = false; bool chain = false;
const char *retVal = const char *retVal =
@ -67,28 +67,20 @@ const char *cmTest::GetProperty(const char* prop) const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmTest::GetPropertyAsBool(const char* prop) const bool cmTest::GetPropertyAsBool(const std::string& prop) const
{ {
return cmSystemTools::IsOn(this->GetProperty(prop)); return cmSystemTools::IsOn(this->GetProperty(prop));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTest::SetProperty(const char* prop, const char* value) void cmTest::SetProperty(const std::string& prop, const char* value)
{ {
if (!prop)
{
return;
}
this->Properties.SetProperty(prop, value, cmProperty::TEST); this->Properties.SetProperty(prop, value, cmProperty::TEST);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTest::AppendProperty(const char* prop, const char* value, bool asString) void cmTest::AppendProperty(const std::string& prop,
const char* value, bool asString)
{ {
if (!prop)
{
return;
}
this->Properties.AppendProperty(prop, value, cmProperty::TEST, asString); this->Properties.AppendProperty(prop, value, cmProperty::TEST, asString);
} }

View File

@ -46,10 +46,11 @@ public:
void Print() const; void Print() const;
///! Set/Get a property of this source file ///! Set/Get a property of this source file
void SetProperty(const char *prop, const char *value); void SetProperty(const std::string& prop, const char *value);
void AppendProperty(const char* prop, const char* value,bool asString=false); void AppendProperty(const std::string& prop,
const char *GetProperty(const char *prop) const; const char* value,bool asString=false);
bool GetPropertyAsBool(const char *prop) const; const char *GetProperty(const std::string& prop) const;
bool GetPropertyAsBool(const std::string& prop) const;
cmPropertyMap &GetProperties() { return this->Properties; }; cmPropertyMap &GetProperties() { return this->Properties; };
/** Get the cmMakefile instance that owns this test. */ /** Get the cmMakefile instance that owns this test. */

View File

@ -2144,7 +2144,8 @@ void cmake::GenerateGraphViz(const char* fileName) const
#endif #endif
} }
void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope, void cmake::DefineProperty(const std::string& name,
cmProperty::ScopeType scope,
const char *ShortDescription, const char *ShortDescription,
const char *FullDescription, const char *FullDescription,
bool chained) bool chained)
@ -2155,7 +2156,7 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope,
} }
cmPropertyDefinition *cmake cmPropertyDefinition *cmake
::GetPropertyDefinition(const char *name, ::GetPropertyDefinition(const std::string& name,
cmProperty::ScopeType scope) cmProperty::ScopeType scope)
{ {
if (this->IsPropertyDefined(name,scope)) if (this->IsPropertyDefined(name,scope))
@ -2165,25 +2166,22 @@ cmPropertyDefinition *cmake
return 0; return 0;
} }
bool cmake::IsPropertyDefined(const char *name, cmProperty::ScopeType scope) bool cmake::IsPropertyDefined(const std::string& name,
cmProperty::ScopeType scope)
{ {
return this->PropertyDefinitions[scope].IsPropertyDefined(name); return this->PropertyDefinitions[scope].IsPropertyDefined(name);
} }
bool cmake::IsPropertyChained(const char *name, cmProperty::ScopeType scope) bool cmake::IsPropertyChained(const std::string& name,
cmProperty::ScopeType scope)
{ {
return this->PropertyDefinitions[scope].IsPropertyChained(name); return this->PropertyDefinitions[scope].IsPropertyChained(name);
} }
void cmake::SetProperty(const char* prop, const char* value) void cmake::SetProperty(const std::string& prop, const char* value)
{ {
if (!prop)
{
return;
}
// Special hook to invalidate cached value. // Special hook to invalidate cached value.
if(strcmp(prop, "DEBUG_CONFIGURATIONS") == 0) if(prop == "DEBUG_CONFIGURATIONS")
{ {
this->DebugConfigs.clear(); this->DebugConfigs.clear();
} }
@ -2191,15 +2189,11 @@ void cmake::SetProperty(const char* prop, const char* value)
this->Properties.SetProperty(prop, value, cmProperty::GLOBAL); this->Properties.SetProperty(prop, value, cmProperty::GLOBAL);
} }
void cmake::AppendProperty(const char* prop, const char* value, bool asString) void cmake::AppendProperty(const std::string& prop,
const char* value, bool asString)
{ {
if (!prop)
{
return;
}
// Special hook to invalidate cached value. // Special hook to invalidate cached value.
if(strcmp(prop, "DEBUG_CONFIGURATIONS") == 0) if(prop == "DEBUG_CONFIGURATIONS")
{ {
this->DebugConfigs.clear(); this->DebugConfigs.clear();
} }
@ -2207,23 +2201,19 @@ void cmake::AppendProperty(const char* prop, const char* value, bool asString)
this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString); this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString);
} }
const char *cmake::GetProperty(const char* prop) const char *cmake::GetProperty(const std::string& prop)
{ {
return this->GetProperty(prop, cmProperty::GLOBAL); return this->GetProperty(prop, cmProperty::GLOBAL);
} }
const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope) const char *cmake::GetProperty(const std::string& prop,
cmProperty::ScopeType scope)
{ {
if(!prop)
{
return 0;
}
bool chain = false; bool chain = false;
// watch for special properties // watch for special properties
std::string propname = prop;
std::string output = ""; std::string output = "";
if ( propname == "CACHE_VARIABLES" ) if ( prop == "CACHE_VARIABLES" )
{ {
cmCacheManager::CacheIterator cit = cmCacheManager::CacheIterator cit =
this->GetCacheManager()->GetCacheIterator(); this->GetCacheManager()->GetCacheIterator();
@ -2237,7 +2227,7 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope)
} }
this->SetProperty("CACHE_VARIABLES", output.c_str()); this->SetProperty("CACHE_VARIABLES", output.c_str());
} }
else if ( propname == "COMMANDS" ) else if ( prop == "COMMANDS" )
{ {
cmake::RegisteredCommandsMap::iterator cmds cmake::RegisteredCommandsMap::iterator cmds
= this->GetCommands()->begin(); = this->GetCommands()->begin();
@ -2252,12 +2242,12 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope)
} }
this->SetProperty("COMMANDS",output.c_str()); this->SetProperty("COMMANDS",output.c_str());
} }
else if ( propname == "IN_TRY_COMPILE" ) else if ( prop == "IN_TRY_COMPILE" )
{ {
this->SetProperty("IN_TRY_COMPILE", this->SetProperty("IN_TRY_COMPILE",
this->GetIsInTryCompile()? "1":"0"); this->GetIsInTryCompile()? "1":"0");
} }
else if ( propname == "ENABLED_LANGUAGES" ) else if ( prop == "ENABLED_LANGUAGES" )
{ {
std::string lang; std::string lang;
if(this->GlobalGenerator) if(this->GlobalGenerator)
@ -2278,7 +2268,7 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope)
return this->Properties.GetPropertyValue(prop, scope, chain); return this->Properties.GetPropertyValue(prop, scope, chain);
} }
bool cmake::GetPropertyAsBool(const char* prop) bool cmake::GetPropertyAsBool(const std::string& prop)
{ {
return cmSystemTools::IsOn(this->GetProperty(prop)); return cmSystemTools::IsOn(this->GetProperty(prop));
} }

View File

@ -269,11 +269,13 @@ class cmake
void GetGeneratorDocumentation(std::vector<cmDocumentationEntry>&); void GetGeneratorDocumentation(std::vector<cmDocumentationEntry>&);
///! Set/Get a property of this target file ///! Set/Get a property of this target file
void SetProperty(const char *prop, const char *value); void SetProperty(const std::string& prop, const char *value);
void AppendProperty(const char *prop, const char *value,bool asString=false); void AppendProperty(const std::string& prop,
const char *GetProperty(const char *prop); const char *value,bool asString=false);
const char *GetProperty(const char *prop, cmProperty::ScopeType scope); const char *GetProperty(const std::string& prop);
bool GetPropertyAsBool(const char *prop); const char *GetProperty(const std::string& prop,
cmProperty::ScopeType scope);
bool GetPropertyAsBool(const std::string& prop);
// Get the properties // Get the properties
cmPropertyMap &GetProperties() { return this->Properties; }; cmPropertyMap &GetProperties() { return this->Properties; };
@ -317,18 +319,18 @@ class cmake
void MarkCliAsUsed(const std::string& variable); void MarkCliAsUsed(const std::string& variable);
// Define a property // Define a property
void DefineProperty(const char *name, cmProperty::ScopeType scope, void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
const char *ShortDescription, const char *ShortDescription,
const char *FullDescription, const char *FullDescription,
bool chain = false); bool chain = false);
// get property definition // get property definition
cmPropertyDefinition *GetPropertyDefinition cmPropertyDefinition *GetPropertyDefinition
(const char *name, cmProperty::ScopeType scope); (const std::string& name, cmProperty::ScopeType scope);
// Is a property defined? // Is a property defined?
bool IsPropertyDefined(const char *name, cmProperty::ScopeType scope); bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope);
bool IsPropertyChained(const char *name, cmProperty::ScopeType scope); bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope);
/** Get the list of configurations (in upper case) considered to be /** Get the list of configurations (in upper case) considered to be
debugging configurations.*/ debugging configurations.*/