From ec97ed7d0c67b635caf3ada65541b2eaf0818a93 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 2 Sep 2013 16:27:32 -0400 Subject: stringapi: Use strings for property names Property names are always generated by CMake and should never be NULL. --- Source/cmCacheManager.cxx | 34 +++++---- Source/cmCacheManager.h | 18 ++--- Source/cmExportFileGenerator.cxx | 15 ++-- Source/cmExportFileGenerator.h | 8 +- Source/cmExportTryCompileFileGenerator.cxx | 5 +- Source/cmExportTryCompileFileGenerator.h | 2 +- Source/cmGeneratorTarget.cxx | 4 +- Source/cmGeneratorTarget.h | 4 +- Source/cmGetTargetPropertyCommand.cxx | 12 ++- Source/cmLocalGenerator.cxx | 16 ++-- Source/cmLocalGenerator.h | 4 +- Source/cmMakefile.cxx | 89 +++++++++------------- Source/cmMakefile.h | 16 ++-- Source/cmProperty.cxx | 5 +- Source/cmProperty.h | 5 +- Source/cmPropertyDefinition.cxx | 2 +- Source/cmPropertyDefinition.h | 2 +- Source/cmPropertyDefinitionMap.cxx | 21 +---- Source/cmPropertyDefinitionMap.h | 6 +- Source/cmPropertyMap.cxx | 16 ++-- Source/cmPropertyMap.h | 8 +- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmSourceFile.cxx | 25 ++---- Source/cmSourceFile.h | 11 +-- Source/cmTarget.cxx | 118 +++++++++++++---------------- Source/cmTarget.h | 19 +++-- Source/cmTargetPropCommandBase.cxx | 5 +- Source/cmTargetPropCommandBase.h | 3 +- Source/cmTest.cxx | 18 ++--- Source/cmTest.h | 9 ++- Source/cmake.cxx | 50 +++++------- Source/cmake.h | 20 ++--- 32 files changed, 262 insertions(+), 310 deletions(-) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 9e0064e..04542d8 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -807,13 +807,13 @@ bool cmCacheManager::CacheIterator::GetValueAsBool() const //---------------------------------------------------------------------------- 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]; } - else if(strcmp(prop, "VALUE") == 0) + else if(prop == "VALUE") { 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) { - if(strcmp(prop, "TYPE") == 0) + if(prop == "TYPE") { this->Type = cmCacheManager::StringToType(value? value : "STRING"); } - else if(strcmp(prop, "VALUE") == 0) + else if(prop == "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, bool asString) { - if(strcmp(prop, "TYPE") == 0) + if(prop == "TYPE") { this->Type = cmCacheManager::StringToType(value? value : "STRING"); } - else if(strcmp(prop, "VALUE") == 0) + else if(prop == "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()) { @@ -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()) { @@ -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, 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)) { @@ -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"); } //---------------------------------------------------------------------------- -bool cmCacheManager::CacheIterator::PropertyExists(const char* prop) const +bool cmCacheManager::CacheIterator::PropertyExists( + const std::string& prop) const { return this->GetProperty(prop)? true:false; } diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index f487e8e..ac6187b 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -39,9 +39,9 @@ private: std::string Value; CacheEntryType Type; cmPropertyMap Properties; - const char* GetProperty(const char*) const; - void SetProperty(const char* property, const char* value); - void AppendProperty(const char* property, const char* value, + const char* GetProperty(const std::string&) const; + void SetProperty(const std::string& property, const char* value); + void AppendProperty(const std::string& property, const char* value, bool asString=false); bool Initialized; CacheEntry() : Value(""), Type(UNINITIALIZED), Initialized(false) @@ -58,13 +58,13 @@ public: void Next(); const char *GetName() const { return this->Position->first.c_str(); } - const char* GetProperty(const char*) const ; - bool GetPropertyAsBool(const char*) const ; - bool PropertyExists(const char*) const; - void SetProperty(const char* property, const char* value); - void AppendProperty(const char* property, const char* value, + const char* GetProperty(const std::string&) const ; + bool GetPropertyAsBool(const std::string&) const ; + bool PropertyExists(const std::string&) const; + void SetProperty(const std::string& property, const char* value); + void AppendProperty(const std::string& property, const char* value, 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(); } bool GetValueAsBool() const; void SetValue(const char*); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 4a161ee..79566a9 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -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, ImportPropertyMap &properties) { @@ -148,8 +149,9 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, } //---------------------------------------------------------------------------- -void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, - const char *outputName, +void cmExportFileGenerator::PopulateInterfaceProperty( + const std::string& propName, + const cmStdString& outputName, cmTarget *target, cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap &properties, @@ -391,7 +393,8 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( } //---------------------------------------------------------------------------- -void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, +void cmExportFileGenerator::PopulateInterfaceProperty( + const std::string& propName, cmTarget *target, cmGeneratorExpression::PreprocessContext preprocessRule, 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 &ifaceProperties) { const char *p = tgt->GetProperty(prop); @@ -825,7 +828,7 @@ void cmExportFileGenerator ::SetImportLinkProperty(std::string const& suffix, cmTarget* target, - const char* propName, + const std::string& propName, std::vector const& entries, ImportPropertyMap& properties, std::vector& missingTargets diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 57ab378..326fe36 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -95,7 +95,7 @@ protected: ImportPropertyMap& properties, std::vector& missingTargets); void SetImportLinkProperty(std::string const& suffix, - cmTarget* target, const char* propName, + cmTarget* target, const std::string& propName, std::vector const& entries, ImportPropertyMap& properties, std::vector& missingTargets); @@ -116,7 +116,7 @@ protected: cmMakefile* mf, cmTarget* depender, cmTarget* dependee) = 0; - void PopulateInterfaceProperty(const char *, + void PopulateInterfaceProperty(const std::string&, cmTarget *target, cmGeneratorExpression::PreprocessContext, ImportPropertyMap &properties, @@ -125,7 +125,7 @@ protected: cmGeneratorExpression::PreprocessContext, ImportPropertyMap &properties, std::vector &missingTargets); - void PopulateInterfaceProperty(const char *propName, cmTarget *target, + void PopulateInterfaceProperty(const std::string& propName, cmTarget *target, ImportPropertyMap &properties); void PopulateCompatibleInterfaceProperties(cmTarget *target, ImportPropertyMap &properties); @@ -174,7 +174,7 @@ protected: std::set ExportedTargets; private: - void PopulateInterfaceProperty(const char *, const char *, + void PopulateInterfaceProperty(const std::string&, const cmStdString&, cmTarget *target, cmGeneratorExpression::PreprocessContext, ImportPropertyMap &properties, diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index a8a91d6..fe8c8ec 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -46,8 +46,9 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os) return true; } -std::string cmExportTryCompileFileGenerator::FindTargets(const char *propName, - cmTarget const* tgt, +std::string cmExportTryCompileFileGenerator::FindTargets( + const std::string& propName, + cmTarget const* tgt, std::set &emitted) { const char *prop = tgt->GetProperty(propName); diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h index 71ac0dd..a16fe6b 100644 --- a/Source/cmExportTryCompileFileGenerator.h +++ b/Source/cmExportTryCompileFileGenerator.h @@ -46,7 +46,7 @@ protected: std::string InstallNameDir(cmTarget* target, const std::string& config); private: - std::string FindTargets(const char *prop, cmTarget const* tgt, + std::string FindTargets(const std::string& prop, cmTarget const* tgt, std::set &emitted); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index a7b2fb6..d9885b9 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -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); } @@ -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); } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 1e6ce64..6e19f7d 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -28,8 +28,8 @@ public: int GetType() const; const char *GetName() const; - const char *GetProperty(const char *prop) const; - bool GetPropertyAsBool(const char *prop) const; + const char *GetProperty(const std::string& prop) const; + bool GetPropertyAsBool(const std::string& prop) const; void GetSourceFiles(std::vector& files) const; void GetObjectSources(std::vector &) const; diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 4aa49fe..b64f847 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -22,7 +22,7 @@ bool cmGetTargetPropertyCommand } std::string var = args[0].c_str(); const std::string& targetName = args[1]; - const char *prop = 0; + std::string prop; if(args[2] == "ALIASED_TARGET") { @@ -38,7 +38,11 @@ bool cmGetTargetPropertyCommand else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) { 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 { @@ -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; } this->Makefile->AddDefinition(var.c_str(), (var+"-NOTFOUND").c_str()); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index b86a956..5bfd9da 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1156,8 +1156,11 @@ void cmLocalGenerator::ExpandRuleVariables(std::string& s, const RuleVariables& replaceValues) { - this->InsertRuleLauncher(s, replaceValues.CMTarget, - replaceValues.RuleLauncher); + if(replaceValues.RuleLauncher) + { + this->InsertRuleLauncher(s, replaceValues.CMTarget, + replaceValues.RuleLauncher); + } std::string::size_type start = s.find('<'); // no variables to expand if(start == s.npos) @@ -1201,7 +1204,7 @@ cmLocalGenerator::ExpandRuleVariables(std::string& s, //---------------------------------------------------------------------------- const char* cmLocalGenerator::GetRuleLauncher(cmTarget* target, - const char* prop) + const std::string& prop) { if(target) { @@ -1215,7 +1218,7 @@ const char* cmLocalGenerator::GetRuleLauncher(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)) { @@ -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)) { - mf->AddDefinition(prop, val); + mf->AddDefinition(prop.c_str(), val); } } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 2e05804..888611d 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -382,9 +382,9 @@ protected: std::string ExpandRuleVariable(std::string const& variable, 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, - const char* prop); + const std::string& prop); /** Convert a target to a utility target for unsupported diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 556e7a4..0fce1f4 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3548,17 +3548,9 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, return res; } -void cmMakefile::SetProperty(const char* prop, const char* value) +void cmMakefile::SetProperty(const std::string& prop, const char* value) { - if (!prop) - { - return; - } - - // handle special props - std::string propname = prop; - - if ( propname == "LINK_DIRECTORIES" ) + if ( prop == "LINK_DIRECTORIES" ) { std::vector varArgsExpanded; if(value) @@ -3568,7 +3560,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value) this->SetLinkDirectories(varArgsExpanded); return; } - if (propname == "INCLUDE_DIRECTORIES") + if (prop == "INCLUDE_DIRECTORIES") { this->IncludeDirectoriesEntries.clear(); if (!value) @@ -3581,7 +3573,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value) cmValueWithOrigin(value, lfbt)); return; } - if (propname == "COMPILE_OPTIONS") + if (prop == "COMPILE_OPTIONS") { this->CompileOptionsEntries.clear(); if (!value) @@ -3593,7 +3585,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value) this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt)); return; } - if (propname == "COMPILE_DEFINITIONS") + if (prop == "COMPILE_DEFINITIONS") { this->CompileDefinitionsEntries.clear(); if (!value) @@ -3607,13 +3599,13 @@ void cmMakefile::SetProperty(const char* prop, const char* value) return; } - if ( propname == "INCLUDE_REGULAR_EXPRESSION" ) + if ( prop == "INCLUDE_REGULAR_EXPRESSION" ) { this->SetIncludeRegularExpression(value); return; } - if ( propname == "ADDITIONAL_MAKE_CLEAN_FILES" ) + if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" ) { // This property is not inherrited if ( strcmp(this->GetCurrentDirectory(), @@ -3626,18 +3618,11 @@ void cmMakefile::SetProperty(const char* prop, const char* value) 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) { - if (!prop) - { - return; - } - - // handle special props - std::string propname = prop; - - if (propname == "INCLUDE_DIRECTORIES") + if (prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt; this->GetBacktrace(lfbt); @@ -3645,7 +3630,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value, cmValueWithOrigin(value, lfbt)); return; } - if (propname == "COMPILE_OPTIONS") + if (prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt; this->GetBacktrace(lfbt); @@ -3653,7 +3638,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value, cmValueWithOrigin(value, lfbt)); return; } - if (propname == "COMPILE_DEFINITIONS") + if (prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt; this->GetBacktrace(lfbt); @@ -3661,7 +3646,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value, cmValueWithOrigin(value, lfbt)); return; } - if ( propname == "LINK_DIRECTORIES" ) + if ( prop == "LINK_DIRECTORIES" ) { std::vector 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); } -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); if (!ret) { - ret = this->GetDefinition(prop); + ret = this->GetDefinition(prop.c_str()); } 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); } -const char *cmMakefile::GetProperty(const char* prop, +const char *cmMakefile::GetProperty(const std::string& prop, cmProperty::ScopeType scope) const { - if(!prop) - { - return 0; - } // watch for specific properties static std::string output; output = ""; - if (!strcmp("PARENT_DIRECTORY",prop)) + if (prop == "PARENT_DIRECTORY") { if(cmLocalGenerator* plg = this->LocalGenerator->GetParent()) { @@ -3709,12 +3690,12 @@ const char *cmMakefile::GetProperty(const char* prop, } return output.c_str(); } - else if (!strcmp("INCLUDE_REGULAR_EXPRESSION",prop) ) + else if (prop == "INCLUDE_REGULAR_EXPRESSION" ) { output = this->GetIncludeRegularExpression(); return output.c_str(); } - else if (!strcmp("LISTFILE_STACK",prop)) + else if (prop == "LISTFILE_STACK") { for (std::deque::const_iterator i = this->ListFileStack.begin(); @@ -3728,10 +3709,10 @@ const char *cmMakefile::GetProperty(const char* prop, } return output.c_str(); } - else if (!strcmp("VARIABLES",prop) || !strcmp("CACHE_VARIABLES",prop)) + else if (prop == "VARIABLES" || prop == "CACHE_VARIABLES") { int cacheonly = 0; - if ( !strcmp("CACHE_VARIABLES",prop) ) + if ( prop == "CACHE_VARIABLES" ) { cacheonly = 1; } @@ -3746,17 +3727,17 @@ const char *cmMakefile::GetProperty(const char* prop, } return output.c_str(); } - else if (!strcmp("MACROS",prop)) + else if (prop == "MACROS") { this->GetListOfMacros(output); return output.c_str(); } - else if (!strcmp("DEFINITIONS",prop)) + else if (prop == "DEFINITIONS") { output += this->DefineFlagsOrig; return output.c_str(); } - else if (!strcmp("LINK_DIRECTORIES",prop)) + else if (prop == "LINK_DIRECTORIES") { cmOStringStream str; for (std::vector::const_iterator @@ -3773,7 +3754,7 @@ const char *cmMakefile::GetProperty(const char* prop, output = str.str(); return output.c_str(); } - else if (!strcmp("INCLUDE_DIRECTORIES",prop)) + else if (prop == "INCLUDE_DIRECTORIES") { std::string sep; for (std::vector::const_iterator @@ -3787,7 +3768,7 @@ const char *cmMakefile::GetProperty(const char* prop, } return output.c_str(); } - else if (!strcmp("COMPILE_OPTIONS",prop)) + else if (prop == "COMPILE_OPTIONS") { std::string sep; for (std::vector::const_iterator @@ -3801,7 +3782,7 @@ const char *cmMakefile::GetProperty(const char* prop, } return output.c_str(); } - else if (!strcmp("COMPILE_DEFINITIONS",prop)) + else if (prop == "COMPILE_DEFINITIONS") { std::string sep; for (std::vector::const_iterator @@ -3832,7 +3813,7 @@ const char *cmMakefile::GetProperty(const char* prop, return retVal; } -bool cmMakefile::GetPropertyAsBool(const char* prop) const +bool cmMakefile::GetPropertyAsBool(const std::string& prop) const { 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; } @@ -4025,10 +4006,10 @@ void cmMakefile::RaiseScope(const char *var, const char *varDef) if(cmDefinitions* up = cur.GetParent()) { // First localize the definition in the current scope. - cur.Get(var); + cur.Get(var.c_str()); // 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()) { @@ -4038,11 +4019,11 @@ void cmMakefile::RaiseScope(const char *var, const char *varDef) cmMakefile* parent = plg->GetMakefile(); if (varDef) { - parent->AddDefinition(var, varDef); + parent->AddDefinition(var.c_str(), varDef); } else { - parent->RemoveDefinition(var); + parent->RemoveDefinition(var.c_str()); } } else diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 45f3b9f..5f4b803 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -800,12 +800,14 @@ public: std::string GetModulesFile(const char* name) const; ///! Set/Get a property of this directory - void SetProperty(const char *prop, const char *value); - void AppendProperty(const char *prop, const char *value,bool asString=false); - const char *GetProperty(const char *prop) const; - const char *GetPropertyOrDefinition(const char *prop) const; - const char *GetProperty(const char *prop, cmProperty::ScopeType scope) const; - bool GetPropertyAsBool(const char *prop) const; + void SetProperty(const std::string& prop, const char *value); + void AppendProperty(const std::string& prop, const char *value, + bool asString=false); + const char *GetProperty(const std::string& prop) const; + const char *GetPropertyOrDefinition(const std::string& 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); @@ -835,7 +837,7 @@ public: // push and pop variable scopes void PushScope(); 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. */ class ScopePushPop diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx index 3b37cf3..40976db 100644 --- a/Source/cmProperty.cxx +++ b/Source/cmProperty.cxx @@ -12,14 +12,15 @@ #include "cmProperty.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->Value = value; 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; if(!this->Value.empty() && *value && !asString) diff --git a/Source/cmProperty.h b/Source/cmProperty.h index bb75bb0..789be1d 100644 --- a/Source/cmProperty.h +++ b/Source/cmProperty.h @@ -21,10 +21,11 @@ public: TEST, VARIABLE, CACHED_VARIABLE }; // set this property - void Set(const char *name, const char *value); + void Set(const std::string& name, const char *value); // 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 const char *GetValue() const; diff --git a/Source/cmPropertyDefinition.cxx b/Source/cmPropertyDefinition.cxx index abc57ce..1af967c 100644 --- a/Source/cmPropertyDefinition.cxx +++ b/Source/cmPropertyDefinition.cxx @@ -13,7 +13,7 @@ #include "cmSystemTools.h" void cmPropertyDefinition -::DefineProperty(const char *name, cmProperty::ScopeType scope, +::DefineProperty(const std::string& name, cmProperty::ScopeType scope, const char *shortDescription, const char *fullDescription, bool chain) diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h index 1b6a7a6..9ca8222 100644 --- a/Source/cmPropertyDefinition.h +++ b/Source/cmPropertyDefinition.h @@ -27,7 +27,7 @@ class cmPropertyDefinition { public: /// 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 *FullDescription, bool chained); diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx index db29504..9ebbaa4 100644 --- a/Source/cmPropertyDefinitionMap.cxx +++ b/Source/cmPropertyDefinitionMap.cxx @@ -14,16 +14,11 @@ #include "cmDocumentationSection.h" void cmPropertyDefinitionMap -::DefineProperty(const char *name, cmProperty::ScopeType scope, +::DefineProperty(const cmStdString& name, cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, bool chain) { - if (!name) - { - return; - } - cmPropertyDefinitionMap::iterator it = this->find(name); cmPropertyDefinition *prop; 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); if (it == this->end()) { @@ -50,13 +40,8 @@ bool cmPropertyDefinitionMap::IsPropertyDefined(const char *name) return true; } -bool cmPropertyDefinitionMap::IsPropertyChained(const char *name) +bool cmPropertyDefinitionMap::IsPropertyChained(const cmStdString& name) { - if (!name) - { - return false; - } - cmPropertyDefinitionMap::iterator it = this->find(name); if (it == this->end()) { diff --git a/Source/cmPropertyDefinitionMap.h b/Source/cmPropertyDefinitionMap.h index 736e243..68c3ff3 100644 --- a/Source/cmPropertyDefinitionMap.h +++ b/Source/cmPropertyDefinitionMap.h @@ -21,16 +21,16 @@ public std::map { public: // define the property - void DefineProperty(const char *name, cmProperty::ScopeType scope, + void DefineProperty(const cmStdString& name, cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, bool chain); // has a named property been defined - bool IsPropertyDefined(const char *name); + bool IsPropertyDefined(const cmStdString& name); // is a named property set to chain - bool IsPropertyChained(const char *name); + bool IsPropertyChained(const cmStdString& name); }; #endif diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index e94e3e9..e335b3b 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -13,7 +13,7 @@ #include "cmSystemTools.h" #include "cmake.h" -cmProperty *cmPropertyMap::GetOrCreateProperty(const char *name) +cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name) { cmPropertyMap::iterator it = this->find(name); cmProperty *prop; @@ -28,13 +28,9 @@ cmProperty *cmPropertyMap::GetOrCreateProperty(const char *name) return prop; } -void cmPropertyMap::SetProperty(const char *name, const char *value, +void cmPropertyMap::SetProperty(const std::string& name, const char *value, cmProperty::ScopeType scope) { - if (!name) - { - return; - } if(!value) { this->erase(name); @@ -46,11 +42,11 @@ void cmPropertyMap::SetProperty(const char *name, const char *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) { // Skip if nothing to append. - if(!name || !value || !*value) + if(!value || !*value) { return; } @@ -61,12 +57,12 @@ void cmPropertyMap::AppendProperty(const char* name, const char* value, } const char *cmPropertyMap -::GetPropertyValue(const char *name, +::GetPropertyValue(const std::string& name, cmProperty::ScopeType scope, bool &chain) const { chain = false; - if (!name) + if (name.empty()) { return 0; } diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index 0c3aad4..a13ac35 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -19,15 +19,15 @@ class cmake; class cmPropertyMap : public std::map { 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); - void AppendProperty(const char* name, const char* value, + void AppendProperty(const std::string& name, const char* value, cmProperty::ScopeType scope, bool asString=false); - const char *GetPropertyValue(const char *name, + const char *GetPropertyValue(const std::string& name, cmProperty::ScopeType scope, bool &chain) const; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index dfb310e..7d0ce5f 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -105,7 +105,7 @@ static std::string extractSubDir(const std::string& absPath, static void copyTargetProperty(cmTarget* destinationTarget, cmTarget* sourceTarget, - const char* propertyName) + const std::string& propertyName) { const char* propertyValue = sourceTarget->GetProperty(propertyName); if (propertyValue) diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 23422a2..dd95f23 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -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); std::string ext = @@ -293,7 +288,7 @@ void cmSourceFile::SetProperty(const char* prop, const char* value) if (ext == ".ui") { cmMakefile const* mf = this->Location.GetMakefile(); - if (strcmp(prop, "AUTOUIC_OPTIONS") == 0) + if (prop == "AUTOUIC_OPTIONS") { const_cast(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) { - if (!prop) - { - return; - } this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE, 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 // 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 // the source file as late as possible. If the users requests the // LOCATION property we must commit now. - if(strcmp(prop, "LOCATION") == 0) + if(prop == "LOCATION") { // Commit to a location. 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. - if(strcmp(prop, "LOCATION") == 0) + if(prop == "LOCATION") { 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)); } diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 4440b05..85d6332 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -43,14 +43,15 @@ public: void SetCustomCommand(cmCustomCommand *cc); ///! Set/Get a property of this source file - void SetProperty(const char *prop, const char *value); - void AppendProperty(const char* prop, const char* value,bool asString=false); - const char *GetProperty(const char *prop) const; - bool GetPropertyAsBool(const char *prop) const; + void SetProperty(const std::string& prop, const char *value); + void AppendProperty(const std::string& prop, + const char* value,bool asString=false); + 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 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 diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1c2b27a..fc2ab25 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -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_")) { @@ -1313,8 +1313,8 @@ static bool whiteListedInterfaceProperty(const char *prop) if (std::binary_search(cmArrayBegin(builtIns), cmArrayEnd(builtIns), - prop, - cmStrCmp(prop))) + prop.c_str(), + cmStrCmp(prop.c_str()))) { 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 && !whiteListedInterfaceProperty(prop)) { @@ -1344,14 +1340,14 @@ void cmTarget::SetProperty(const char* prop, const char* value) return; } - if (strcmp(prop, "NAME") == 0) + if (prop == "NAME") { cmOStringStream e; e << "NAME property is read-only\n"; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); return; } - if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0) + if(prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -1362,7 +1358,7 @@ void cmTarget::SetProperty(const char* prop, const char* value) new cmTargetInternals::TargetPropertyEntry(cge)); return; } - if(strcmp(prop,"COMPILE_OPTIONS") == 0) + if(prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -1373,7 +1369,7 @@ void cmTarget::SetProperty(const char* prop, const char* value) new cmTargetInternals::TargetPropertyEntry(cge)); return; } - if(strcmp(prop,"COMPILE_DEFINITIONS") == 0) + if(prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -1384,7 +1380,7 @@ void cmTarget::SetProperty(const char* prop, const char* value) new cmTargetInternals::TargetPropertyEntry(cge)); return; } - if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported()) + if(prop == "EXPORT_NAME" && this->IsImported()) { cmOStringStream e; 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()); return; } - if (strcmp(prop, "LINK_LIBRARIES") == 0) + if (prop == "LINK_LIBRARIES") { this->Internal->LinkImplementationPropertyEntries.clear(); 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) { - if (!prop) - { - return; - } if (this->GetType() == INTERFACE_LIBRARY && !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()); return; } - if (strcmp(prop, "NAME") == 0) + if (prop == "NAME") { cmOStringStream e; e << "NAME property is read-only\n"; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); return; } - if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0) + if(prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -1438,7 +1430,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value, new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); return; } - if(strcmp(prop,"COMPILE_OPTIONS") == 0) + if(prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -1447,7 +1439,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value, new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); return; } - if(strcmp(prop,"COMPILE_DEFINITIONS") == 0) + if(prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -1456,7 +1448,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value, new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); return; } - if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported()) + if(prop == "EXPORT_NAME" && this->IsImported()) { cmOStringStream e; 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()); return; } - if (strcmp(prop, "LINK_LIBRARIES") == 0) + if (prop == "LINK_LIBRARIES") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -2215,7 +2207,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, } //---------------------------------------------------------------------------- -void cmTarget::MaybeInvalidatePropertyCache(const char* prop) +void cmTarget::MaybeInvalidatePropertyCache(const std::string& prop) { // Wipe out maps caching information affected by this property. if(this->IsImported() && cmHasLiteralPrefix(prop, "IMPORTED")) @@ -2230,8 +2222,8 @@ void cmTarget::MaybeInvalidatePropertyCache(const char* prop) //---------------------------------------------------------------------------- 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. 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. 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); } @@ -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 { - if(!prop) - { - return 0; - } - if (this->GetType() == INTERFACE_LIBRARY && !whiteListedInterfaceProperty(prop)) { @@ -2640,7 +2628,7 @@ const char *cmTarget::GetProperty(const char* prop, return 0; } - if (strcmp(prop, "NAME") == 0) + if (prop == "NAME") { return this->GetName(); } @@ -2653,7 +2641,7 @@ const char *cmTarget::GetProperty(const char* prop, this->GetType() == cmTarget::MODULE_LIBRARY || this->GetType() == cmTarget::UNKNOWN_LIBRARY) { - if(strcmp(prop,"LOCATION") == 0) + if(prop == "LOCATION") { if (!this->HandleLocationPropertyPolicy()) { @@ -2680,13 +2668,13 @@ const char *cmTarget::GetProperty(const char* prop, { return 0; } - std::string configName = prop+9; + const char* configName = prop.c_str() + 9; this->Properties.SetProperty(prop, - this->GetLocation(configName.c_str()), + this->GetLocation(configName), cmProperty::TARGET); } } - if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0) + if(prop == "INCLUDE_DIRECTORIES") { static std::string output; output = ""; @@ -2704,7 +2692,7 @@ const char *cmTarget::GetProperty(const char* prop, } return output.c_str(); } - if(strcmp(prop,"COMPILE_OPTIONS") == 0) + if(prop == "COMPILE_OPTIONS") { static std::string output; output = ""; @@ -2722,7 +2710,7 @@ const char *cmTarget::GetProperty(const char* prop, } return output.c_str(); } - if(strcmp(prop,"COMPILE_DEFINITIONS") == 0) + if(prop == "COMPILE_DEFINITIONS") { static std::string output; output = ""; @@ -2740,7 +2728,7 @@ const char *cmTarget::GetProperty(const char* prop, } return output.c_str(); } - if(strcmp(prop,"LINK_LIBRARIES") == 0) + if(prop == "LINK_LIBRARIES") { static std::string output; output = ""; @@ -2757,12 +2745,12 @@ const char *cmTarget::GetProperty(const char* prop, return output.c_str(); } - if (strcmp(prop,"IMPORTED") == 0) + if (prop == "IMPORTED") { return this->IsImported()?"TRUE":"FALSE"; } - if(!strcmp(prop,"SOURCES")) + if(prop == "SOURCES") { cmOStringStream ss; const char* sep = ""; @@ -2791,7 +2779,7 @@ const char *cmTarget::GetProperty(const char* prop, } // the type property returns what type the target is - if (!strcmp(prop,"TYPE")) + if (prop == "TYPE") { 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)); } @@ -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) { // 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, - const char *interfaceProperty, + const std::string& interfaceProperty, const char *config) { std::vector deps; @@ -5984,14 +5972,14 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const template PropertyType getLinkInterfaceDependentProperty(cmTarget const* tgt, - const std::string prop, + const std::string& prop, const char *config, CompatibleType, PropertyType *); template<> bool getLinkInterfaceDependentProperty(cmTarget const* tgt, - const std::string prop, + const std::string& prop, const char *config, CompatibleType, bool *) { @@ -6000,7 +5988,7 @@ bool getLinkInterfaceDependentProperty(cmTarget const* tgt, template<> const char * getLinkInterfaceDependentProperty(cmTarget const* tgt, - const std::string prop, + const std::string& prop, const char *config, CompatibleType t, const char **) @@ -6025,7 +6013,7 @@ const char * getLinkInterfaceDependentProperty(cmTarget const* tgt, template void checkPropertyConsistency(cmTarget const* depender, cmTarget const* dependee, - const char *propName, + const cmStdString& propName, std::set &emitted, const char *config, CompatibleType t, @@ -6135,32 +6123,32 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, } checkPropertyConsistency(this, li->Target, - "COMPATIBLE_INTERFACE_BOOL", - emittedBools, config, BoolType, 0); + std::string("COMPATIBLE_INTERFACE_BOOL"), + emittedBools, config, BoolType, 0); if (cmSystemTools::GetErrorOccuredFlag()) { return; } checkPropertyConsistency(this, li->Target, - "COMPATIBLE_INTERFACE_STRING", - emittedStrings, config, - StringType, 0); + std::string("COMPATIBLE_INTERFACE_STRING"), + emittedStrings, config, + StringType, 0); if (cmSystemTools::GetErrorOccuredFlag()) { return; } checkPropertyConsistency(this, li->Target, - "COMPATIBLE_INTERFACE_NUMBER_MIN", - emittedMinNumbers, config, - NumberMinType, 0); + std::string("COMPATIBLE_INTERFACE_NUMBER_MIN"), + emittedMinNumbers, config, + NumberMinType, 0); if (cmSystemTools::GetErrorOccuredFlag()) { return; } checkPropertyConsistency(this, li->Target, - "COMPATIBLE_INTERFACE_NUMBER_MAX", - emittedMaxNumbers, config, - NumberMaxType, 0); + std::string("COMPATIBLE_INTERFACE_NUMBER_MAX"), + emittedMaxNumbers, config, + NumberMaxType, 0); if (cmSystemTools::GetErrorOccuredFlag()) { return; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 471ea94..f0dd708 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -223,12 +223,14 @@ public: void FinishConfigure(); ///! Set/Get a property of this target file - void SetProperty(const char *prop, const char *value); - void AppendProperty(const char* prop, const char* value,bool asString=false); - const char *GetProperty(const char *prop) const; - const char *GetProperty(const char *prop, cmProperty::ScopeType scope) const; - bool GetPropertyAsBool(const char *prop) const; - void CheckProperty(const char* prop, cmMakefile* context) const; + void SetProperty(const std::string& prop, const char *value); + void AppendProperty(const std::string& prop, const char* value, + bool asString=false); + const char *GetProperty(const std::string& prop) const; + const char *GetProperty(const std::string& prop, + 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; @@ -632,7 +634,8 @@ private: // Use a makefile variable to set a default for the given property. // 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. const char* GetOutputTargetType(bool implib) const; @@ -729,7 +732,7 @@ private: void ClearLinkMaps(); - void MaybeInvalidatePropertyCache(const char* prop); + void MaybeInvalidatePropertyCache(const std::string& prop); void ProcessSourceExpression(std::string const& expr); diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index 195690e..2a20516 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -16,8 +16,9 @@ //---------------------------------------------------------------------------- bool cmTargetPropCommandBase -::HandleArguments(std::vector const& args, const char *prop, - ArgumentFlags flags) +::HandleArguments(std::vector const& args, + const std::string& prop, + ArgumentFlags flags) { if(args.size() < 2) { diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h index c402836..555a08a 100644 --- a/Source/cmTargetPropCommandBase.h +++ b/Source/cmTargetPropCommandBase.h @@ -29,7 +29,8 @@ public: }; bool HandleArguments(std::vector const& args, - const char *prop, ArgumentFlags flags = NO_FLAGS); + const std::string& prop, + ArgumentFlags flags = NO_FLAGS); cmTypeMacro(cmTargetPropCommandBase, cmCommand); protected: diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index 9cda978..4ff71ac 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -54,7 +54,7 @@ void cmTest::SetCommand(std::vector const& command) } //---------------------------------------------------------------------------- -const char *cmTest::GetProperty(const char* prop) const +const char *cmTest::GetProperty(const std::string& prop) const { bool chain = false; 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)); } //---------------------------------------------------------------------------- -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); } //---------------------------------------------------------------------------- -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); } diff --git a/Source/cmTest.h b/Source/cmTest.h index 1fe8fc0..1becbf7 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -46,10 +46,11 @@ public: void Print() const; ///! Set/Get a property of this source file - void SetProperty(const char *prop, const char *value); - void AppendProperty(const char* prop, const char* value,bool asString=false); - const char *GetProperty(const char *prop) const; - bool GetPropertyAsBool(const char *prop) const; + void SetProperty(const std::string& prop, const char *value); + void AppendProperty(const std::string& prop, + const char* value,bool asString=false); + const char *GetProperty(const std::string& prop) const; + bool GetPropertyAsBool(const std::string& prop) const; cmPropertyMap &GetProperties() { return this->Properties; }; /** Get the cmMakefile instance that owns this test. */ diff --git a/Source/cmake.cxx b/Source/cmake.cxx index abbabe7..149e299 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2144,7 +2144,8 @@ void cmake::GenerateGraphViz(const char* fileName) const #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 *FullDescription, bool chained) @@ -2155,7 +2156,7 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope, } cmPropertyDefinition *cmake -::GetPropertyDefinition(const char *name, +::GetPropertyDefinition(const std::string& name, cmProperty::ScopeType scope) { if (this->IsPropertyDefined(name,scope)) @@ -2165,25 +2166,22 @@ cmPropertyDefinition *cmake 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); } -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); } -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. - if(strcmp(prop, "DEBUG_CONFIGURATIONS") == 0) + if(prop == "DEBUG_CONFIGURATIONS") { this->DebugConfigs.clear(); } @@ -2191,15 +2189,11 @@ void cmake::SetProperty(const char* prop, const char* value) 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. - if(strcmp(prop, "DEBUG_CONFIGURATIONS") == 0) + if(prop == "DEBUG_CONFIGURATIONS") { 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); } -const char *cmake::GetProperty(const char* prop) +const char *cmake::GetProperty(const std::string& prop) { 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; // watch for special properties - std::string propname = prop; std::string output = ""; - if ( propname == "CACHE_VARIABLES" ) + if ( prop == "CACHE_VARIABLES" ) { cmCacheManager::CacheIterator cit = this->GetCacheManager()->GetCacheIterator(); @@ -2237,7 +2227,7 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope) } this->SetProperty("CACHE_VARIABLES", output.c_str()); } - else if ( propname == "COMMANDS" ) + else if ( prop == "COMMANDS" ) { cmake::RegisteredCommandsMap::iterator cmds = this->GetCommands()->begin(); @@ -2252,12 +2242,12 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope) } this->SetProperty("COMMANDS",output.c_str()); } - else if ( propname == "IN_TRY_COMPILE" ) + else if ( prop == "IN_TRY_COMPILE" ) { this->SetProperty("IN_TRY_COMPILE", this->GetIsInTryCompile()? "1":"0"); } - else if ( propname == "ENABLED_LANGUAGES" ) + else if ( prop == "ENABLED_LANGUAGES" ) { std::string lang; if(this->GlobalGenerator) @@ -2278,7 +2268,7 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope) 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)); } diff --git a/Source/cmake.h b/Source/cmake.h index dfec55c..e89868c 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -269,11 +269,13 @@ class cmake void GetGeneratorDocumentation(std::vector&); ///! Set/Get a property of this target file - void SetProperty(const char *prop, const char *value); - void AppendProperty(const char *prop, const char *value,bool asString=false); - const char *GetProperty(const char *prop); - const char *GetProperty(const char *prop, cmProperty::ScopeType scope); - bool GetPropertyAsBool(const char *prop); + void SetProperty(const std::string& prop, const char *value); + void AppendProperty(const std::string& prop, + const char *value,bool asString=false); + const char *GetProperty(const std::string& prop); + const char *GetProperty(const std::string& prop, + cmProperty::ScopeType scope); + bool GetPropertyAsBool(const std::string& prop); // Get the properties cmPropertyMap &GetProperties() { return this->Properties; }; @@ -317,18 +319,18 @@ class cmake void MarkCliAsUsed(const std::string& variable); // 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 *FullDescription, bool chain = false); // get property definition cmPropertyDefinition *GetPropertyDefinition - (const char *name, cmProperty::ScopeType scope); + (const std::string& name, cmProperty::ScopeType scope); // Is a property defined? - bool IsPropertyDefined(const char *name, cmProperty::ScopeType scope); - bool IsPropertyChained(const char *name, cmProperty::ScopeType scope); + bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope); + bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope); /** Get the list of configurations (in upper case) considered to be debugging configurations.*/ -- cgit v0.12 From 3742bb0d324b971f63cc7e557b1cb8a9d08c5cdd Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 4 Feb 2014 16:06:56 -0500 Subject: stringapi: Use strings for variable names Variable names are always generated by CMake and should never be NULL. --- Source/CPack/cmCPackGenerator.cxx | 14 +++----- Source/CPack/cmCPackGenerator.h | 10 +++--- Source/CTest/cmCTestGenericHandler.cxx | 14 ++------ Source/CTest/cmCTestGenericHandler.h | 6 ++-- .../CursesDialog/cmCursesCacheEntryComposite.cxx | 9 +++--- Source/CursesDialog/cmCursesCacheEntryComposite.h | 5 +-- Source/CursesDialog/cmCursesMainForm.cxx | 10 +++--- Source/CursesDialog/cmCursesMainForm.h | 2 +- Source/cmCTest.cxx | 17 +++------- Source/cmCTest.h | 8 ++--- Source/cmCacheManager.cxx | 11 ++++--- Source/cmCacheManager.h | 10 +++--- Source/cmDefinitions.cxx | 8 ++--- Source/cmDefinitions.h | 8 ++--- Source/cmExportFileGenerator.cxx | 2 +- Source/cmExportFileGenerator.h | 2 +- Source/cmFindBase.cxx | 6 ++-- Source/cmFindBase.h | 4 +-- Source/cmFindCommon.cxx | 2 +- Source/cmFindCommon.h | 2 +- Source/cmFindPackageCommand.cxx | 3 +- Source/cmFindPackageCommand.h | 2 +- Source/cmIfCommand.cxx | 18 +++++------ Source/cmIfCommand.h | 2 +- Source/cmListCommand.cxx | 10 +++--- Source/cmListCommand.h | 4 +-- Source/cmLocalGenerator.cxx | 2 +- Source/cmLocalGenerator.h | 2 +- Source/cmMakefile.cxx | 37 +++++++++++----------- Source/cmMakefile.h | 32 +++++++++---------- Source/cmMakefileLibraryTargetGenerator.cxx | 4 +-- Source/cmMakefileLibraryTargetGenerator.h | 3 +- Source/cmMakefileTargetGenerator.cxx | 3 +- Source/cmMakefileTargetGenerator.h | 2 +- Source/cmScriptGenerator.cxx | 2 +- Source/cmScriptGenerator.h | 2 +- Source/cmake.cxx | 10 +++--- Source/cmake.h | 10 +++--- 38 files changed, 142 insertions(+), 156 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index e1dd4e9..b46fd86 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -972,7 +972,7 @@ bool cmCPackGenerator::ReadListFile(const char* moduleName) } //---------------------------------------------------------------------- -void cmCPackGenerator::SetOptionIfNotSet(const char* op, +void cmCPackGenerator::SetOptionIfNotSet(const std::string& op, const char* value) { const char* def = this->MakefileMap->GetDefinition(op); @@ -984,12 +984,8 @@ void cmCPackGenerator::SetOptionIfNotSet(const char* op, } //---------------------------------------------------------------------- -void cmCPackGenerator::SetOption(const char* op, const char* value) +void cmCPackGenerator::SetOption(const std::string& op, const char* value) { - if ( !op ) - { - return; - } if ( !value ) { this->MakefileMap->RemoveDefinition(op); @@ -1176,19 +1172,19 @@ int cmCPackGenerator::InitializeInternal() } //---------------------------------------------------------------------- -bool cmCPackGenerator::IsSet(const char* name) const +bool cmCPackGenerator::IsSet(const std::string& name) const { return this->MakefileMap->IsSet(name); } //---------------------------------------------------------------------- -bool cmCPackGenerator::IsOn(const char* name) const +bool cmCPackGenerator::IsOn(const std::string& name) const { return cmSystemTools::IsOn(GetOption(name)); } //---------------------------------------------------------------------- -const char* cmCPackGenerator::GetOption(const char* op) const +const char* cmCPackGenerator::GetOption(const std::string& op) const { const char* ret = this->MakefileMap->GetDefinition(op); if(!ret) diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index b1a7840..39ef64d 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -99,12 +99,12 @@ public: virtual ~cmCPackGenerator(); //! Set and get the options - void SetOption(const char* op, const char* value); - void SetOptionIfNotSet(const char* op, const char* value); - const char* GetOption(const char* op) const; + void SetOption(const std::string& op, const char* value); + void SetOptionIfNotSet(const std::string& op, const char* value); + const char* GetOption(const std::string& op) const; std::vector GetOptions() const; - bool IsSet(const char* name) const; - bool IsOn(const char* name) const; + bool IsSet(const std::string& name) const; + bool IsOn(const std::string& name) const; //! Set the logger void SetLogger(cmCPackLog* log) { this->Logger = log; } diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 5338f30..ae498ea 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -30,12 +30,8 @@ cmCTestGenericHandler::~cmCTestGenericHandler() } //---------------------------------------------------------------------- -void cmCTestGenericHandler::SetOption(const char* op, const char* value) +void cmCTestGenericHandler::SetOption(const std::string& op, const char* value) { - if ( !op ) - { - return; - } if ( !value ) { cmCTestGenericHandler::t_StringToString::iterator remit @@ -51,14 +47,10 @@ void cmCTestGenericHandler::SetOption(const char* op, const char* value) } //---------------------------------------------------------------------- -void cmCTestGenericHandler::SetPersistentOption(const char* op, +void cmCTestGenericHandler::SetPersistentOption(const std::string& op, const char* value) { this->SetOption(op, value); - if ( !op ) - { - return; - } if ( !value ) { cmCTestGenericHandler::t_StringToString::iterator remit @@ -88,7 +80,7 @@ void cmCTestGenericHandler::Initialize() } //---------------------------------------------------------------------- -const char* cmCTestGenericHandler::GetOption(const char* op) +const char* cmCTestGenericHandler::GetOption(const std::string& op) { cmCTestGenericHandler::t_StringToString::iterator remit = this->Options.find(op); diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index ba8febb..d05e230 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -74,9 +74,9 @@ public: typedef std::map t_StringToString; - void SetPersistentOption(const char* op, const char* value); - void SetOption(const char* op, const char* value); - const char* GetOption(const char* op); + void SetPersistentOption(const std::string& op, const char* value); + void SetOption(const std::string& op, const char* value); + const char* GetOption(const std::string& op); void SetCommand(cmCTestCommand* command) { diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 249137f..7929ce7 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -19,9 +19,10 @@ #include "cmCursesDummyWidget.h" #include "../cmSystemTools.h" -cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(const char* key, - int labelwidth, - int entrywidth) : +cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( + const std::string& key, + int labelwidth, + int entrywidth) : Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth) { this->Label = new cmCursesLabelWidget(this->LabelWidth, 1, 1, 1, key); @@ -31,7 +32,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(const char* key, } cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( - const char* key, const cmCacheManager::CacheIterator& it, bool isNew, + const std::string& key, const cmCacheManager::CacheIterator& it, bool isNew, int labelwidth, int entrywidth) : Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth) { diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index 1357a02..98107cc 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -18,8 +18,9 @@ class cmCursesCacheEntryComposite { public: - cmCursesCacheEntryComposite(const char* key, int labelwidth, int entrywidth); - cmCursesCacheEntryComposite(const char* key, + cmCursesCacheEntryComposite(const std::string& key, int labelwidth, + int entrywidth); + cmCursesCacheEntryComposite(const std::string& key, const cmCacheManager::CacheIterator& it, bool isNew, int labelwidth, int entrywidth); ~cmCursesCacheEntryComposite(); diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index d94cd37..0734927 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -84,9 +84,9 @@ cmCursesMainForm::~cmCursesMainForm() } // See if a cache entry is in the list of entries in the ui. -bool cmCursesMainForm::LookForCacheEntry(const char* key) +bool cmCursesMainForm::LookForCacheEntry(const std::string& key) { - if (!key || !this->Entries) + if (!this->Entries) { return false; } @@ -94,7 +94,7 @@ bool cmCursesMainForm::LookForCacheEntry(const char* key) std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - if (!strcmp(key, (*it)->Key.c_str())) + if (key == (*it)->Key) { return true; } @@ -146,7 +146,7 @@ void cmCursesMainForm::InitializeUI() this->CMakeInstance->GetCacheManager()->NewIterator(); !i.IsAtEnd(); i.Next()) { - const char* key = i.GetName(); + std::string key = i.GetName(); if ( i.GetType() == cmCacheManager::INTERNAL || i.GetType() == cmCacheManager::STATIC || i.GetType() == cmCacheManager::UNINITIALIZED ) @@ -168,7 +168,7 @@ void cmCursesMainForm::InitializeUI() this->CMakeInstance->GetCacheManager()->NewIterator(); !i.IsAtEnd(); i.Next()) { - const char* key = i.GetName(); + std::string key = i.GetName(); if ( i.GetType() == cmCacheManager::INTERNAL || i.GetType() == cmCacheManager::STATIC || i.GetType() == cmCacheManager::UNINITIALIZED ) diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 883a2b3..fba9bc5 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -51,7 +51,7 @@ public: * Returns true if an entry with the given key is in the * list of current composites. */ - bool LookForCacheEntry(const char* key); + bool LookForCacheEntry(const std::string& key); enum { MIN_WIDTH = 65, diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index acedc1a..39b623d 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2593,13 +2593,9 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) } //---------------------------------------------------------------------- -void cmCTest::PopulateCustomVector(cmMakefile* mf, const char* def, +void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def, VectorOfStrings& vec) { - if ( !def) - { - return; - } const char* dval = mf->GetDefinition(def); if ( !dval ) { @@ -2620,12 +2616,9 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const char* def, } //---------------------------------------------------------------------- -void cmCTest::PopulateCustomInteger(cmMakefile* mf, const char* def, int& val) +void cmCTest::PopulateCustomInteger(cmMakefile* mf, const std::string& def, + int& val) { - if ( !def) - { - return; - } const char* dval = mf->GetDefinition(def); if ( !dval ) { @@ -2702,7 +2695,7 @@ std::string cmCTest::GetShortPathToFile(const char* cfname) } //---------------------------------------------------------------------- -std::string cmCTest::GetCTestConfiguration(const char *name) +std::string cmCTest::GetCTestConfiguration(const std::string& name) { if ( this->CTestConfigurationOverwrites.find(name) != this->CTestConfigurationOverwrites.end() ) @@ -2877,7 +2870,7 @@ void cmCTest::SetConfigType(const char* ct) //---------------------------------------------------------------------- bool cmCTest::SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, - const char* dconfig, const char* cmake_var) + const char* dconfig, const std::string& cmake_var) { const char* ctvar; ctvar = mf->GetDefinition(cmake_var); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index becb0f5..6418f09 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -172,7 +172,7 @@ public: std::string GetTestModelString(); static int GetTestModelFromString(const char* str); static std::string CleanString(const std::string& str); - std::string GetCTestConfiguration(const char *name); + std::string GetCTestConfiguration(const std::string& name); void SetCTestConfiguration(const char *name, const char* value); void EmptyCTestConfiguration(); @@ -185,9 +185,9 @@ public: //! Set the notes files to be created. void SetNotesFiles(const char* notes); - void PopulateCustomVector(cmMakefile* mf, const char* definition, + void PopulateCustomVector(cmMakefile* mf, const std::string& definition, VectorOfStrings& vec); - void PopulateCustomInteger(cmMakefile* mf, const char* def, + void PopulateCustomInteger(cmMakefile* mf, const std::string& def, int& val); ///! Get the current time as string @@ -332,7 +332,7 @@ public: * Set the CTest variable from CMake variable */ bool SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, - const char* dconfig, const char* cmake_var); + const char* dconfig, const std::string& cmake_var); //! Make string safe to be send as an URL static std::string MakeURLSafe(const std::string&); diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 04542d8..7a71482 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -650,7 +650,7 @@ void cmCacheManager::OutputHelpString(std::ostream& fout, } } -void cmCacheManager::RemoveCacheEntry(const char* key) +void cmCacheManager::RemoveCacheEntry(const std::string& key) { CacheEntryMap::iterator i = this->Cache.find(key); if(i != this->Cache.end()) @@ -660,7 +660,8 @@ void cmCacheManager::RemoveCacheEntry(const char* key) } -cmCacheManager::CacheEntry *cmCacheManager::GetCacheEntry(const char* key) +cmCacheManager::CacheEntry *cmCacheManager::GetCacheEntry( + const std::string& key) { CacheEntryMap::iterator i = this->Cache.find(key); if(i != this->Cache.end()) @@ -676,7 +677,7 @@ cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator( return CacheIterator(*this, key); } -const char* cmCacheManager::GetCacheValue(const char* key) const +const char* cmCacheManager::GetCacheValue(const std::string& key) const { CacheEntryMap::const_iterator i = this->Cache.find(key); if(i != this->Cache.end() && @@ -708,7 +709,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const } -void cmCacheManager::AddCacheEntry(const char* key, +void cmCacheManager::AddCacheEntry(const std::string& key, const char* value, const char* helpString, CacheEntryType type) @@ -767,7 +768,7 @@ void cmCacheManager::CacheIterator::Begin() this->Position = this->Container.Cache.begin(); } -bool cmCacheManager::CacheIterator::Find(const char* key) +bool cmCacheManager::CacheIterator::Find(const std::string& key) { this->Position = this->Container.Cache.find(key); return !this->IsAtEnd(); diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index ac6187b..7a61394 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -53,7 +53,7 @@ public: { public: void Begin(); - bool Find(const char*); + bool Find(const std::string&); bool IsAtEnd() const; void Next(); const char *GetName() const { @@ -129,7 +129,7 @@ public: cmCacheManager::CacheIterator GetCacheIterator(const char *key=0); ///! Remove an entry from the cache - void RemoveCacheEntry(const char* key); + void RemoveCacheEntry(const std::string& key); ///! Get the number of entries in the cache int GetSize() { @@ -142,7 +142,7 @@ public: CacheEntryType& type); ///! Get a value from the cache given a key - const char* GetCacheValue(const char* key) const; + const char* GetCacheValue(const std::string& key) const; /** Get the version of CMake that wrote the cache. */ unsigned int GetCacheMajorVersion() const @@ -153,11 +153,11 @@ public: protected: ///! Add an entry into the cache - void AddCacheEntry(const char* key, const char* value, + void AddCacheEntry(const std::string& key, const char* value, const char* helpString, CacheEntryType type); ///! Get a cache entry object for a key - CacheEntry *GetCacheEntry(const char *key); + CacheEntry *GetCacheEntry(const std::string& key); ///! Clean out the CMakeFiles directory if no CMakeCache.txt void CleanCMakeFiles(const char* path); diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 9d28700..5fa3877 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -28,7 +28,7 @@ void cmDefinitions::Reset(cmDefinitions* parent) //---------------------------------------------------------------------------- cmDefinitions::Def const& -cmDefinitions::GetInternal(const char* key) +cmDefinitions::GetInternal(const std::string& key) { MapType::const_iterator i = this->Map.find(key); if(i != this->Map.end()) @@ -46,7 +46,7 @@ cmDefinitions::GetInternal(const char* key) //---------------------------------------------------------------------------- cmDefinitions::Def const& -cmDefinitions::SetInternal(const char* key, Def const& def) +cmDefinitions::SetInternal(const std::string& key, Def const& def) { if(this->Up || def.Exists) { @@ -71,14 +71,14 @@ cmDefinitions::SetInternal(const char* key, Def const& def) } //---------------------------------------------------------------------------- -const char* cmDefinitions::Get(const char* key) +const char* cmDefinitions::Get(const std::string& key) { Def const& def = this->GetInternal(key); return def.Exists? def.c_str() : 0; } //---------------------------------------------------------------------------- -const char* cmDefinitions::Set(const char* key, const char* value) +const char* cmDefinitions::Set(const std::string& key, const char* value) { Def const& def = this->SetInternal(key, Def(value)); return def.Exists? def.c_str() : 0; diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 4834d84..24dad29 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -35,10 +35,10 @@ public: /** Get the value associated with a key; null if none. Store the result locally if it came from a parent. */ - const char* Get(const char* key); + const char* Get(const std::string& key); /** Set (or unset if null) a value associated with a key. */ - const char* Set(const char* key, const char* value); + const char* Set(const std::string& key, const char* value); /** Get the set of all local keys. */ std::set LocalKeys() const; @@ -69,8 +69,8 @@ private: MapType Map; // Internal query and update methods. - Def const& GetInternal(const char* key); - Def const& SetInternal(const char* key, Def const& def); + Def const& GetInternal(const std::string& key); + Def const& SetInternal(const std::string& key, Def const& def); // Implementation of Closure() method. struct ClosureTag {}; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 79566a9..c06f889 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -151,7 +151,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty( //---------------------------------------------------------------------------- void cmExportFileGenerator::PopulateInterfaceProperty( const std::string& propName, - const cmStdString& outputName, + const std::string& outputName, cmTarget *target, cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap &properties, diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 326fe36..f93e72a 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -174,7 +174,7 @@ protected: std::set ExportedTargets; private: - void PopulateInterfaceProperty(const std::string&, const cmStdString&, + void PopulateInterfaceProperty(const std::string&, const std::string&, cmTarget *target, cmGeneratorExpression::PreprocessContext, ImportPropertyMap &properties, diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index ae15ee7..86fd54b 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -268,7 +268,7 @@ void cmFindBase::AddPrefixPaths(std::vector const& in_paths, } //---------------------------------------------------------------------------- -void cmFindBase::AddCMakePrefixPath(const char* variable) +void cmFindBase::AddCMakePrefixPath(const std::string& variable) { // Get a path from a CMake variable. if(const char* varPath = this->Makefile->GetDefinition(variable)) @@ -280,11 +280,11 @@ void cmFindBase::AddCMakePrefixPath(const char* variable) } //---------------------------------------------------------------------------- -void cmFindBase::AddEnvPrefixPath(const char* variable) +void cmFindBase::AddEnvPrefixPath(const std::string& variable) { // Get a path from the environment. std::vector tmp; - cmSystemTools::GetPath(tmp, variable); + cmSystemTools::GetPath(tmp, variable.c_str()); this->AddPrefixPaths(tmp, EnvPath); } diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h index 0562b1b..e590d6e 100644 --- a/Source/cmFindBase.h +++ b/Source/cmFindBase.h @@ -63,8 +63,8 @@ private: void AddUserGuessPath(); // Helpers. - void AddCMakePrefixPath(const char* variable); - void AddEnvPrefixPath(const char* variable); + void AddCMakePrefixPath(const std::string& variable); + void AddEnvPrefixPath(const std::string& variable); void AddPrefixPaths(std::vector const& in_paths, PathType pathType); }; diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index e8c8da3..bd75e10 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -374,7 +374,7 @@ void cmFindCommon::AddUserPath(std::string const& p, } //---------------------------------------------------------------------------- -void cmFindCommon::AddCMakePath(const char* variable) +void cmFindCommon::AddCMakePath(const std::string& variable) { // Get a path from a CMake variable. if(const char* varPath = this->Makefile->GetDefinition(variable)) diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index 6109a9f..ba90a84 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -63,7 +63,7 @@ protected: void AddPathSuffix(std::string const& arg); void AddUserPath(std::string const& p, std::vector& paths); - void AddCMakePath(const char* variable); + void AddCMakePath(const std::string& variable); void AddEnvPath(const char* variable); void AddPathsInternal(std::vector const& in_paths, PathType pathType); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 73eba51..d557fba 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -535,7 +535,8 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) } //---------------------------------------------------------------------------- -void cmFindPackageCommand::AddFindDefinition(const char* var, const char* val) +void cmFindPackageCommand::AddFindDefinition(const std::string& var, + const char* val) { if(const char* old = this->Makefile->GetDefinition(var)) { diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 0d80e48..9819d4f 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -57,7 +57,7 @@ private: void AppendToFoundProperty(bool found); void SetModuleVariables(const std::string& components); bool FindModule(bool& found); - void AddFindDefinition(const char* var, const char* val); + void AddFindDefinition(const std::string& var, const char* val); void RestoreFindDefinitions(); bool HandlePackageMode(); bool FindConfig(); diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index ee95c05..bd12327 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -593,7 +593,7 @@ namespace if (argP1 != newArgs.end() && argP2 != newArgs.end() && *(argP1) == "MATCHES") { - def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile); + def = cmIfCommand::GetVariableOrString(*arg, makefile); const char* rex = (argP2)->c_str(); cmStringCommand::ClearMatches(makefile); cmsys::RegularExpression regEntry; @@ -634,8 +634,8 @@ namespace (*(argP1) == "LESS" || *(argP1) == "GREATER" || *(argP1) == "EQUAL")) { - def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile); - def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile); + def = cmIfCommand::GetVariableOrString(*arg, makefile); + def2 = cmIfCommand::GetVariableOrString(*argP2, makefile); double lhs; double rhs; bool result; @@ -665,8 +665,8 @@ namespace *(argP1) == "STREQUAL" || *(argP1) == "STRGREATER")) { - def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile); - def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile); + def = cmIfCommand::GetVariableOrString(*arg, makefile); + def2 = cmIfCommand::GetVariableOrString(*argP2, makefile); int val = strcmp(def,def2); bool result; if (*(argP1) == "STRLESS") @@ -689,8 +689,8 @@ namespace (*(argP1) == "VERSION_LESS" || *(argP1) == "VERSION_GREATER" || *(argP1) == "VERSION_EQUAL")) { - def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile); - def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile); + def = cmIfCommand::GetVariableOrString(*arg, makefile); + def2 = cmIfCommand::GetVariableOrString(*argP2, makefile); cmSystemTools::CompareOp op = cmSystemTools::OP_EQUAL; if(*argP1 == "VERSION_LESS") { @@ -907,13 +907,13 @@ bool cmIfCommand::IsTrue(const std::vector &args, } //========================================================================= -const char* cmIfCommand::GetVariableOrString(const char* str, +const char* cmIfCommand::GetVariableOrString(const std::string& str, const cmMakefile* mf) { const char* def = mf->GetDefinition(str); if(!def) { - def = str; + def = str.c_str(); } return def; } diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index f2633ad..02d87ed 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -79,7 +79,7 @@ public: // Get a definition from the makefile. If it doesn't exist, // return the original string. - static const char* GetVariableOrString(const char* str, + static const char* GetVariableOrString(const std::string& str, const cmMakefile* mf); cmTypeMacro(cmIfCommand, cmCommand); diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index df64695..20e760a 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -74,12 +74,9 @@ bool cmListCommand } //---------------------------------------------------------------------------- -bool cmListCommand::GetListString(std::string& listString, const char* var) +bool cmListCommand::GetListString(std::string& listString, + const std::string& var) { - if ( !var ) - { - return false; - } // get the old value const char* cacheValue = this->Makefile->GetDefinition(var); @@ -92,7 +89,8 @@ bool cmListCommand::GetListString(std::string& listString, const char* var) } //---------------------------------------------------------------------------- -bool cmListCommand::GetList(std::vector& list, const char* var) +bool cmListCommand::GetList(std::vector& list, + const std::string& var) { std::string listString; if ( !this->GetListString(listString, var) ) diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index 0cb5da2..b79ff0d 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -60,8 +60,8 @@ protected: bool HandleReverseCommand(std::vector const& args); - bool GetList(std::vector& list, const char* var); - bool GetListString(std::string& listString, const char* var); + bool GetList(std::vector& list, const std::string& var); + bool GetListString(std::string& listString, const std::string& var); }; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 5bfd9da..476c95d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2324,7 +2324,7 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags, //---------------------------------------------------------------------------- void cmLocalGenerator::AddConfigVariableFlags(std::string& flags, - const char* var, + const std::string& var, const char* config) { // Add the flags from the variable itself. diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 888611d..80a1421 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -145,7 +145,7 @@ public: std::string const& lang, const char *config); void AddVisibilityPresetFlags(std::string &flags, cmTarget* target, const char *lang); - void AddConfigVariableFlags(std::string& flags, const char* var, + void AddConfigVariableFlags(std::string& flags, const std::string& var, const char* config); ///! Append flags to a string. virtual void AppendFlags(std::string& flags, const char* newFlags); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0fce1f4..edf33c1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1769,7 +1769,7 @@ cmMakefile::AddSystemIncludeDirectories(const std::set &incs) } } -void cmMakefile::AddDefinition(const char* name, const char* value) +void cmMakefile::AddDefinition(const std::string& name, const char* value) { if (!value ) { @@ -1798,14 +1798,14 @@ void cmMakefile::AddDefinition(const char* name, const char* value) } -void cmMakefile::AddCacheDefinition(const char* name, const char* value, +void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, const char* doc, cmCacheManager::CacheEntryType type, bool force) { const char* val = value; cmCacheManager::CacheIterator it = - this->GetCacheManager()->GetCacheIterator(name); + this->GetCacheManager()->GetCacheIterator(name.c_str()); if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) && it.Initialized()) { @@ -1845,7 +1845,7 @@ void cmMakefile::AddCacheDefinition(const char* name, const char* value, } -void cmMakefile::AddDefinition(const char* name, bool value) +void cmMakefile::AddDefinition(const std::string& name, bool value) { this->Internal->VarStack.top().Set(name, value? "ON" : "OFF"); if (this->Internal->VarUsageStack.size() && @@ -1880,12 +1880,12 @@ void cmMakefile::CheckForUnusedVariables() const } } -void cmMakefile::MarkVariableAsUsed(const char* var) +void cmMakefile::MarkVariableAsUsed(const std::string& var) { this->Internal->VarUsageStack.top().insert(var); } -bool cmMakefile::VariableInitialized(const char* var) const +bool cmMakefile::VariableInitialized(const std::string& var) const { if(this->Internal->VarInitStack.top().find(var) != this->Internal->VarInitStack.top().end()) @@ -1895,7 +1895,7 @@ bool cmMakefile::VariableInitialized(const char* var) const return false; } -bool cmMakefile::VariableUsed(const char* var) const +bool cmMakefile::VariableUsed(const std::string& var) const { if(this->Internal->VarUsageStack.top().find(var) != this->Internal->VarUsageStack.top().end()) @@ -1905,7 +1905,8 @@ bool cmMakefile::VariableUsed(const char* var) const return false; } -void cmMakefile::CheckForUnused(const char* reason, const char* name) const +void cmMakefile::CheckForUnused(const char* reason, + const std::string& name) const { if (this->WarnUnused && !this->VariableUsed(name)) { @@ -1943,7 +1944,7 @@ void cmMakefile::CheckForUnused(const char* reason, const char* name) const } } -void cmMakefile::RemoveDefinition(const char* name) +void cmMakefile::RemoveDefinition(const std::string& name) { this->Internal->VarStack.top().Set(name, 0); if (this->Internal->VarUsageStack.size() && @@ -1963,7 +1964,7 @@ void cmMakefile::RemoveDefinition(const char* name) #endif } -void cmMakefile::RemoveCacheDefinition(const char* name) +void cmMakefile::RemoveCacheDefinition(const std::string& name) { this->GetCacheManager()->RemoveCacheEntry(name); } @@ -2329,13 +2330,13 @@ void cmMakefile::ExpandVariablesCMP0019() } } -bool cmMakefile::IsOn(const char* name) const +bool cmMakefile::IsOn(const std::string& name) const { const char* value = this->GetDefinition(name); return cmSystemTools::IsOn(value); } -bool cmMakefile::IsSet(const char* name) const +bool cmMakefile::IsSet(const std::string& name) const { const char* value = this->GetDefinition(name); if ( !value ) @@ -2406,7 +2407,7 @@ bool cmMakefile::CanIWriteThisFile(const char* fileName) const return true; } -const char* cmMakefile::GetRequiredDefinition(const char* name) const +const char* cmMakefile::GetRequiredDefinition(const std::string& name) const { const char* ret = this->GetDefinition(name); if(!ret) @@ -2414,13 +2415,13 @@ const char* cmMakefile::GetRequiredDefinition(const char* name) const cmSystemTools::Error("Error required internal CMake variable not " "set, cmake may be not be built correctly.\n", "Missing variable is:\n", - name); + name.c_str()); return ""; } return ret; } -bool cmMakefile::IsDefinitionSet(const char* name) const +bool cmMakefile::IsDefinitionSet(const std::string& name) const { const char* def = this->Internal->VarStack.top().Get(name); this->Internal->VarUsageStack.top().insert(name); @@ -2442,7 +2443,7 @@ bool cmMakefile::IsDefinitionSet(const char* name) const return def?true:false; } -const char* cmMakefile::GetDefinition(const char* name) const +const char* cmMakefile::GetDefinition(const std::string& name) const { if (this->WarnUnused) { @@ -2483,7 +2484,7 @@ const char* cmMakefile::GetDefinition(const char* name) const return def; } -const char* cmMakefile::GetSafeDefinition(const char* def) const +const char* cmMakefile::GetSafeDefinition(const std::string& def) const { const char* ret = this->GetDefinition(def); if(!ret) @@ -3995,7 +3996,7 @@ void cmMakefile::PopScope() } } -void cmMakefile::RaiseScope(const cmStdString& var, const char *varDef) +void cmMakefile::RaiseScope(const std::string& var, const char *varDef) { if (var.empty()) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 5f4b803..fc71ab7 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -69,11 +69,11 @@ public: /* Check for unused variables in this scope */ void CheckForUnusedVariables() const; /* Mark a variable as used */ - void MarkVariableAsUsed(const char* var); + void MarkVariableAsUsed(const std::string& var); /* return true if a variable has been initialized */ - bool VariableInitialized(const char* ) const; + bool VariableInitialized(const std::string& ) const; /* return true if a variable has been used */ - bool VariableUsed(const char* ) const; + bool VariableUsed(const std::string& ) const; /** Return whether compatibility features needed for a version of the cache or lower should be enabled. */ bool NeedCacheCompatibility(int major, int minor) const; @@ -283,9 +283,9 @@ public: * Add a variable definition to the build. This variable * can be used in CMake to refer to lists, directories, etc. */ - void AddDefinition(const char* name, const char* value); + void AddDefinition(const std::string& name, const char* value); ///! Add a definition to this makefile and the global cmake cache. - void AddCacheDefinition(const char* name, const char* value, + void AddCacheDefinition(const std::string& name, const char* value, const char* doc, cmCacheManager::CacheEntryType type, bool force = false); @@ -293,15 +293,15 @@ public: /** * Add bool variable definition to the build. */ - void AddDefinition(const char* name, bool); + void AddDefinition(const std::string& name, bool); /** * Remove a variable definition from the build. This is not valid * for cache entries, and will only affect the current makefile. */ - void RemoveDefinition(const char* name); + void RemoveDefinition(const std::string& name); ///! Remove a definition from the cache. - void RemoveCacheDefinition(const char* name); + void RemoveCacheDefinition(const std::string& name); /** * Specify the name of the project for this build. @@ -587,10 +587,10 @@ public: * If the variable is not found in this makefile instance, the * cache is then queried. */ - const char* GetDefinition(const char*) const; - const char* GetSafeDefinition(const char*) const; - const char* GetRequiredDefinition(const char* name) const; - bool IsDefinitionSet(const char*) const; + const char* GetDefinition(const std::string&) const; + const char* GetSafeDefinition(const std::string&) const; + const char* GetRequiredDefinition(const std::string& name) const; + bool IsDefinitionSet(const std::string&) const; /** * Get the list of all variables in the current space. If argument * cacheonly is specified and is greater than 0, then only cache @@ -601,8 +601,8 @@ public: /** Test a boolean cache entry to see if it is true or false, * returns false if no entry defined. */ - bool IsOn(const char* name) const; - bool IsSet(const char* name) const; + bool IsOn(const std::string& name) const; + bool IsSet(const std::string& name) const; /** Return whether the target platform is 64-bit. */ bool PlatformIs64Bit() const; @@ -837,7 +837,7 @@ public: // push and pop variable scopes void PushScope(); void PopScope(); - void RaiseScope(const cmStdString& var, const char *value); + void RaiseScope(const std::string& var, const char *value); /** Helper class to push and pop scopes automatically. */ class ScopePushPop @@ -882,7 +882,7 @@ protected: void AddGlobalLinkInformation(const char* name, cmTarget& target); // Check for a an unused variable - void CheckForUnused(const char* reason, const char* name) const; + void CheckForUnused(const char* reason, const std::string& name) const; std::string Prefix; std::vector AuxSourceDirectories; // diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 39e00b2..10418d0 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -237,7 +237,7 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteLibraryRules -(const char* linkRuleVar, const char* extraFlags, bool relink) +(const std::string& linkRuleVar, const std::string& extraFlags, bool relink) { // TODO: Merge the methods that call this method to avoid // code duplication. @@ -261,7 +261,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Create set of linking flags. std::string linkFlags; - this->LocalGenerator->AppendFlags(linkFlags, extraFlags); + this->LocalGenerator->AppendFlags(linkFlags, extraFlags.c_str()); // Add OSX version flags, if any. if(this->Target->GetType() == cmTarget::SHARED_LIBRARY || diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h index 1487b56..4873516 100644 --- a/Source/cmMakefileLibraryTargetGenerator.h +++ b/Source/cmMakefileLibraryTargetGenerator.h @@ -30,7 +30,8 @@ protected: void WriteStaticLibraryRules(); void WriteSharedLibraryRules(bool relink); void WriteModuleLibraryRules(bool relink); - void WriteLibraryRules(const char *linkRule, const char *extraFlags, + void WriteLibraryRules(const std::string& linkRule, + const std::string& extraFlags, bool relink); // MacOSX Framework support methods void WriteFrameworkRules(bool relink); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index facbcc6..bf0dc51 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1682,7 +1682,8 @@ void cmMakefileTargetGenerator } //---------------------------------------------------------------------------- -std::string cmMakefileTargetGenerator::GetLinkRule(const char* linkRuleVar) +std::string cmMakefileTargetGenerator::GetLinkRule( + const cmStdString& linkRuleVar) { std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar); if(this->Target->HasImplibGNUtoMS()) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 72dc6bc..f960afc 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -138,7 +138,7 @@ protected: void AppendLinkDepends(std::vector& depends); // Lookup the link rule for this target. - std::string GetLinkRule(const char* linkRuleVar); + std::string GetLinkRule(const cmStdString& linkRuleVar); /** In order to support parallel builds for custom commands with multiple outputs the outputs are given a serial order, and only diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 3b6a49b..7a8efc1 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -15,7 +15,7 @@ //---------------------------------------------------------------------------- cmScriptGenerator -::cmScriptGenerator(const char* config_var, +::cmScriptGenerator(const std::string& config_var, std::vector const& configurations): RuntimeConfigVariable(config_var), Configurations(configurations), diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index 8b2ca33..3515e20 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -47,7 +47,7 @@ inline std::ostream& operator<<(std::ostream& os, class cmScriptGenerator { public: - cmScriptGenerator(const char* config_var, + cmScriptGenerator(const std::string& config_var, std::vector const& configurations); virtual ~cmScriptGenerator(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 149e299..ad1d0fa 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1202,7 +1202,7 @@ struct SaveCacheEntry cmCacheManager::CacheEntryType type; }; -int cmake::HandleDeleteCacheVariables(const char* var) +int cmake::HandleDeleteCacheVariables(const std::string& var) { std::vector argsSplit; cmSystemTools::ExpandListArgument(std::string(var), argsSplit, true); @@ -1725,7 +1725,7 @@ int cmake::Generate() return 0; } -void cmake::AddCacheEntry(const char* key, const char* value, +void cmake::AddCacheEntry(const std::string& key, const char* value, const char* helpString, int type) { @@ -1734,7 +1734,7 @@ void cmake::AddCacheEntry(const char* key, const char* value, cmCacheManager::CacheEntryType(type)); } -const char* cmake::GetCacheDefinition(const char* name) const +const char* cmake::GetCacheDefinition(const std::string& name) const { return this->CacheManager->GetCacheValue(name); } @@ -2676,7 +2676,7 @@ int cmake::Build(const std::string& dir, nativeOptions); } -void cmake::WatchUnusedCli(const char* var) +void cmake::WatchUnusedCli(const std::string& var) { #ifdef CMAKE_BUILD_WITH_CMAKE this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this); @@ -2687,7 +2687,7 @@ void cmake::WatchUnusedCli(const char* var) #endif } -void cmake::UnwatchUnusedCli(const char* var) +void cmake::UnwatchUnusedCli(const std::string& var) { #ifdef CMAKE_BUILD_WITH_CMAKE this->VariableWatch->RemoveWatch(var, cmWarnUnusedCliWarning); diff --git a/Source/cmake.h b/Source/cmake.h index e89868c..2d78e8f 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -203,9 +203,9 @@ class cmake /** * Given a variable name, return its value (as a string). */ - const char* GetCacheDefinition(const char*) const; + const char* GetCacheDefinition(const std::string&) const; ///! Add an entry into the cache - void AddCacheEntry(const char* key, const char* value, + void AddCacheEntry(const std::string& key, const char* value, const char* helpString, int type); @@ -357,12 +357,12 @@ class cmake const std::vector& nativeOptions, bool clean); - void UnwatchUnusedCli(const char* var); - void WatchUnusedCli(const char* var); + void UnwatchUnusedCli(const std::string& var); + void WatchUnusedCli(const std::string& var); protected: void RunCheckForUnusedVariables(); void InitializeProperties(); - int HandleDeleteCacheVariables(const char* var); + int HandleDeleteCacheVariables(const std::string& var); cmPropertyMap Properties; std::set > AccessedProperties; -- cgit v0.12 From 381d50c149183183378b446fd789b1bd18c7524c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Jan 2014 13:38:27 -0500 Subject: stringapi: Accept strings in cmStrCmp --- Source/cmQtAutoGenerators.cxx | 4 ++-- Source/cmStandardIncludes.h | 11 ++++++++--- Source/cmTarget.cxx | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 7d0ce5f..d940fe2 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -660,7 +660,7 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector &opts, ++o; } if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions), - cmStrCmp(o)) != cmArrayEnd(valueOptions)) + cmStrCmp(*it)) != cmArrayEnd(valueOptions)) { assert(existingIt + 1 != opts.end()); *(existingIt + 1) = *(it + 1); @@ -831,7 +831,7 @@ void cmQtAutoGenerators::MergeRccOptions(std::vector &opts, ++o; } if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions), - cmStrCmp(o)) != cmArrayEnd(valueOptions)) + cmStrCmp(*it)) != cmArrayEnd(valueOptions)) { assert(existingIt + 1 != opts.end()); *(existingIt + 1) = *(it + 1); diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index b4ae657..04e1bc8 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -449,11 +449,16 @@ bool cmHasLiteralSuffix(T str1, const char (&str2)[N]) struct cmStrCmp { cmStrCmp(const char *test) : m_test(test) {} - cmStrCmp(std::string &test) : m_test(test.c_str()) {} + cmStrCmp(const std::string &test) : m_test(test) {} + + bool operator()(const std::string& input) const + { + return m_test == input; + } bool operator()(const char * input) const { - return strcmp(input, m_test) == 0; + return strcmp(input, m_test.c_str()) == 0; } // For use with binary_search @@ -463,7 +468,7 @@ struct cmStrCmp { } private: - const char * const m_test; + const cmStdString m_test; }; #endif diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index fc2ab25..d5cd140 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1314,7 +1314,7 @@ static bool whiteListedInterfaceProperty(const std::string& prop) if (std::binary_search(cmArrayBegin(builtIns), cmArrayEnd(builtIns), prop.c_str(), - cmStrCmp(prop.c_str()))) + cmStrCmp(prop))) { return true; } -- cgit v0.12 From f29754573d2b2a199f17be80eb01ae309699bb23 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 3 Feb 2014 21:06:17 -0500 Subject: stringapi: Accept string parameters in methods which store to strings --- Source/cmMakefile.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index fc71ab7..79931ad 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -494,7 +494,7 @@ public: * Set a regular expression that include files that are not found * must match in order to be considered a problem. */ - void SetComplainRegularExpression(const char* regex) + void SetComplainRegularExpression(const std::string& regex) { this->ComplainFileRegularExpression = regex; } -- cgit v0.12 From 22c54a109050d026269f57dddc0ce0f146fc149d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 31 Jan 2014 10:45:30 -0500 Subject: makefile: Remove an unused method --- Source/cmMakefile.cxx | 10 ---------- Source/cmMakefile.h | 1 - 2 files changed, 11 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index edf33c1..76b3b09 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3662,16 +3662,6 @@ void cmMakefile::AppendProperty(const std::string& prop, this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString); } -const char *cmMakefile::GetPropertyOrDefinition(const std::string& prop) const -{ - const char *ret = this->GetProperty(prop, cmProperty::DIRECTORY); - if (!ret) - { - ret = this->GetDefinition(prop.c_str()); - } - return ret; -} - const char *cmMakefile::GetProperty(const std::string& prop) const { return this->GetProperty(prop, cmProperty::DIRECTORY); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 79931ad..559d49c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -804,7 +804,6 @@ public: void AppendProperty(const std::string& prop, const char *value, bool asString=false); const char *GetProperty(const std::string& prop) const; - const char *GetPropertyOrDefinition(const std::string& prop) const; const char *GetProperty(const std::string& prop, cmProperty::ScopeType scope) const; bool GetPropertyAsBool(const std::string& prop) const; -- cgit v0.12 From 24e8b929eef74098d4ddf4581619322e0f4b5108 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 6 Feb 2014 13:59:50 -0500 Subject: genex: Store predicates as a map for faster searching May warrant a fast path for predicates which more frequently. --- Source/cmGeneratorExpressionEvaluator.cxx | 135 ++++++++++++------------------ 1 file changed, 52 insertions(+), 83 deletions(-) diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index bdefcfb..c27c03f 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1555,89 +1555,58 @@ TargetFilesystemArtifact targetSoNameFileDirNode; static const cmGeneratorExpressionNode* GetNode(const std::string &identifier) { - if (identifier == "0") - return &zeroNode; - else if (identifier == "1") - return &oneNode; - else if (identifier == "AND") - return &andNode; - else if (identifier == "OR") - return &orNode; - else if (identifier == "NOT") - return ¬Node; - else if (identifier == "C_COMPILER_ID") - return &cCompilerIdNode; - else if (identifier == "CXX_COMPILER_ID") - return &cxxCompilerIdNode; - else if (identifier == "VERSION_GREATER") - return &versionGreaterNode; - else if (identifier == "VERSION_LESS") - return &versionLessNode; - else if (identifier == "VERSION_EQUAL") - return &versionEqualNode; - else if (identifier == "C_COMPILER_VERSION") - return &cCompilerVersionNode; - else if (identifier == "CXX_COMPILER_VERSION") - return &cxxCompilerVersionNode; - else if (identifier == "PLATFORM_ID") - return &platformIdNode; - else if (identifier == "CONFIGURATION") - return &configurationNode; - else if (identifier == "CONFIG") - return &configurationTestNode; - else if (identifier == "TARGET_FILE") - return &targetFileNode; - else if (identifier == "TARGET_LINKER_FILE") - return &targetLinkerFileNode; - else if (identifier == "TARGET_SONAME_FILE") - return &targetSoNameFileNode; - else if (identifier == "TARGET_FILE_NAME") - return &targetFileNameNode; - else if (identifier == "TARGET_LINKER_FILE_NAME") - return &targetLinkerFileNameNode; - else if (identifier == "TARGET_SONAME_FILE_NAME") - return &targetSoNameFileNameNode; - else if (identifier == "TARGET_FILE_DIR") - return &targetFileDirNode; - else if (identifier == "TARGET_LINKER_FILE_DIR") - return &targetLinkerFileDirNode; - else if (identifier == "TARGET_SONAME_FILE_DIR") - return &targetSoNameFileDirNode; - else if (identifier == "STREQUAL") - return &strEqualNode; - else if (identifier == "EQUAL") - return &equalNode; - else if (identifier == "LOWER_CASE") - return &lowerCaseNode; - else if (identifier == "UPPER_CASE") - return &upperCaseNode; - else if (identifier == "MAKE_C_IDENTIFIER") - return &makeCIdentifierNode; - else if (identifier == "BOOL") - return &boolNode; - else if (identifier == "ANGLE-R") - return &angle_rNode; - else if (identifier == "COMMA") - return &commaNode; - else if (identifier == "SEMICOLON") - return &semicolonNode; - else if (identifier == "TARGET_PROPERTY") - return &targetPropertyNode; - else if (identifier == "TARGET_NAME") - return &targetNameNode; - else if (identifier == "TARGET_POLICY") - return &targetPolicyNode; - else if (identifier == "BUILD_INTERFACE") - return &buildInterfaceNode; - else if (identifier == "INSTALL_INTERFACE") - return &installInterfaceNode; - else if (identifier == "INSTALL_PREFIX") - return &installPrefixNode; - else if (identifier == "JOIN") - return &joinNode; - else if (identifier == "LINK_ONLY") - return &linkOnlyNode; - return 0; + typedef std::map NodeMap; + static NodeMap nodeMap; + if (nodeMap.empty()) + { + nodeMap["0"] = &zeroNode; + nodeMap["1"] = &oneNode; + nodeMap["AND"] = &andNode; + nodeMap["OR"] = &orNode; + nodeMap["NOT"] = ¬Node; + nodeMap["C_COMPILER_ID"] = &cCompilerIdNode; + nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode; + nodeMap["VERSION_GREATER"] = &versionGreaterNode; + nodeMap["VERSION_LESS"] = &versionLessNode; + nodeMap["VERSION_EQUAL"] = &versionEqualNode; + nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode; + nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode; + nodeMap["PLATFORM_ID"] = &platformIdNode; + nodeMap["CONFIGURATION"] = &configurationNode; + nodeMap["CONFIG"] = &configurationTestNode; + nodeMap["TARGET_FILE"] = &targetFileNode; + nodeMap["TARGET_LINKER_FILE"] = &targetLinkerFileNode; + nodeMap["TARGET_SONAME_FILE"] = &targetSoNameFileNode; + nodeMap["TARGET_FILE_NAME"] = &targetFileNameNode; + nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerFileNameNode; + nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameFileNameNode; + nodeMap["TARGET_FILE_DIR"] = &targetFileDirNode; + nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerFileDirNode; + nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameFileDirNode; + nodeMap["STREQUAL"] = &strEqualNode; + nodeMap["EQUAL"] = &equalNode; + nodeMap["LOWER_CASE"] = &lowerCaseNode; + nodeMap["UPPER_CASE"] = &upperCaseNode; + nodeMap["MAKE_C_IDENTIFIER"] = &makeCIdentifierNode; + nodeMap["BOOL"] = &boolNode; + nodeMap["ANGLE-R"] = &angle_rNode; + nodeMap["COMMA"] = &commaNode; + nodeMap["SEMICOLON"] = &semicolonNode; + nodeMap["TARGET_PROPERTY"] = &targetPropertyNode; + nodeMap["TARGET_NAME"] = &targetNameNode; + nodeMap["TARGET_POLICY"] = &targetPolicyNode; + nodeMap["BUILD_INTERFACE"] = &buildInterfaceNode; + nodeMap["INSTALL_INTERFACE"] = &installInterfaceNode; + nodeMap["INSTALL_PREFIX"] = &installPrefixNode; + nodeMap["JOIN"] = &joinNode; + nodeMap["LINK_ONLY"] = &linkOnlyNode; + } + NodeMap::const_iterator i = nodeMap.find(identifier); + if (i == nodeMap.end()) + { + return 0; + } + return i->second; } -- cgit v0.12 From 310ef08fed57b1c60ea8dc8ed98520e2cb0bff4e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 6 Feb 2014 14:05:57 -0500 Subject: stringapi: Use strings for source names --- Source/cmMakefile.cxx | 31 +++++++++++++------------------ Source/cmMakefile.h | 14 +++++++------- Source/cmSourceFile.cxx | 2 +- Source/cmSourceFile.h | 2 +- Source/cmSourceFileLocation.cxx | 13 +++++++------ Source/cmSourceFileLocation.h | 8 ++++---- Source/cmSourceGroup.cxx | 2 +- Source/cmSourceGroup.h | 2 +- Source/cmTarget.cxx | 2 +- Source/cmTarget.h | 2 +- 10 files changed, 37 insertions(+), 41 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 76b3b09..97628f3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2060,9 +2060,8 @@ cmMakefile::AddNewTarget(cmTarget::TargetType type, const char* name) } cmSourceFile* -cmMakefile::LinearGetSourceFileWithOutput(const char *cname) const +cmMakefile::LinearGetSourceFileWithOutput(const std::string& name) const { - std::string name = cname; std::string out; // look through all the source files that have custom commands @@ -2096,15 +2095,14 @@ cmMakefile::LinearGetSourceFileWithOutput(const char *cname) const return 0; } -cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname) const +cmSourceFile *cmMakefile::GetSourceFileWithOutput( + const std::string& name) const { - std::string name = cname; - // If the queried path is not absolute we use the backward compatible // linear-time search for an output with a matching suffix. - if(!cmSystemTools::FileIsFullPath(cname)) + if(!cmSystemTools::FileIsFullPath(name.c_str())) { - return LinearGetSourceFileWithOutput(cname); + return LinearGetSourceFileWithOutput(name.c_str()); } // Otherwise we use an efficient lookup map. OutputToSourceMap::const_iterator o = this->OutputToSource.find(name); @@ -2149,15 +2147,12 @@ cmMakefile::GetSourceGroup(const std::vector&name) const return sg; } - void cmMakefile::AddSourceGroup(const char* name, +void cmMakefile::AddSourceGroup(const std::string& name, const char* regex) { - if (name) - { - std::vector nameVector; - nameVector.push_back(name); - AddSourceGroup(nameVector, regex); - } + std::vector nameVector; + nameVector.push_back(name); + AddSourceGroup(nameVector, regex); } void cmMakefile::AddSourceGroup(const std::vector& name, @@ -3011,9 +3006,9 @@ void cmMakefile::SetArgcArgv(const std::vector& args) } //---------------------------------------------------------------------------- -cmSourceFile* cmMakefile::GetSource(const char* sourceName) const +cmSourceFile* cmMakefile::GetSource(const std::string& sourceName) const { - cmSourceFileLocation sfl(this, sourceName); + cmSourceFileLocation sfl(this, sourceName.c_str()); for(std::vector::const_iterator sfi = this->SourceFiles.begin(); sfi != this->SourceFiles.end(); ++sfi) @@ -3028,7 +3023,7 @@ cmSourceFile* cmMakefile::GetSource(const char* sourceName) const } //---------------------------------------------------------------------------- -cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName, +cmSourceFile* cmMakefile::GetOrCreateSource(const std::string& sourceName, bool generated) { if(cmSourceFile* esf = this->GetSource(sourceName)) @@ -3037,7 +3032,7 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName, } else { - cmSourceFile* sf = new cmSourceFile(this, sourceName); + cmSourceFile* sf = new cmSourceFile(this, sourceName.c_str()); if(generated) { sf->SetProperty("GENERATED", "1"); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 559d49c..a8ad1e2 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -332,7 +332,7 @@ public: /** * Add a root source group for consideration when adding a new source. */ - void AddSourceGroup(const char* name, const char* regex=0); + void AddSourceGroup(const std::string& name, const char* regex=0); /** * Add a source group for consideration when adding a new source. @@ -555,14 +555,14 @@ public: /** Get a cmSourceFile pointer for a given source name, if the name is * not found, then a null pointer is returned. */ - cmSourceFile* GetSource(const char* sourceName) const; + cmSourceFile* GetSource(const std::string& sourceName) const; /** Get a cmSourceFile pointer for a given source name, if the name is * not found, then create the source file and return it. generated * indicates if it is a generated file, this is used in determining * how to create the source file instance e.g. name */ - cmSourceFile* GetOrCreateSource(const char* sourceName, + cmSourceFile* GetOrCreateSource(const std::string& sourceName, bool generated = false); /** @@ -773,7 +773,7 @@ public: * Is there a source file that has the provided source file as an output? * if so then return it */ - cmSourceFile *GetSourceFileWithOutput(const char *outName) const; + cmSourceFile *GetSourceFileWithOutput(const std::string& outName) const; /** * Add a macro to the list of macros. The arguments should be name of the @@ -1030,12 +1030,12 @@ private: bool GeneratingBuildSystem; /** - * Old version of GetSourceFileWithOutput(const char*) kept for + * Old version of GetSourceFileWithOutput(const std::string&) kept for * backward-compatibility. It implements a linear search and support * relative file paths. It is used as a fall back by - * GetSourceFileWithOutput(const char*). + * GetSourceFileWithOutput(const std::string&). */ - cmSourceFile *LinearGetSourceFileWithOutput(const char *cname) const; + cmSourceFile *LinearGetSourceFileWithOutput(const std::string& cname) const; // A map for fast output to input look up. #if defined(CMAKE_BUILD_WITH_CMAKE) diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index dd95f23..9feda6c 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -18,7 +18,7 @@ #include "cmake.h" //---------------------------------------------------------------------------- -cmSourceFile::cmSourceFile(cmMakefile* mf, const char* name): +cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name): Location(mf, name) { this->CustomCommand = 0; diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 85d6332..833a490 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -31,7 +31,7 @@ public: * Construct with the makefile storing the source and the initial * name referencing it. */ - cmSourceFile(cmMakefile* mf, const char* name); + cmSourceFile(cmMakefile* mf, const std::string& name); ~cmSourceFile(); diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index 5a8578b..832a6a7 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -18,9 +18,10 @@ //---------------------------------------------------------------------------- cmSourceFileLocation -::cmSourceFileLocation(cmMakefile const* mf, const char* name): Makefile(mf) +::cmSourceFileLocation(cmMakefile const* mf, const std::string& name) + : Makefile(mf) { - this->AmbiguousDirectory = !cmSystemTools::FileIsFullPath(name); + this->AmbiguousDirectory = !cmSystemTools::FileIsFullPath(name.c_str()); this->AmbiguousExtension = true; this->Directory = cmSystemTools::GetFilenamePath(name); this->Name = cmSystemTools::GetFilenameName(name); @@ -28,7 +29,7 @@ cmSourceFileLocation } //---------------------------------------------------------------------------- -void cmSourceFileLocation::Update(const char* name) +void cmSourceFileLocation::Update(const std::string& name) { if(this->AmbiguousDirectory) { @@ -80,7 +81,7 @@ void cmSourceFileLocation::DirectoryUseBinary() } //---------------------------------------------------------------------------- -void cmSourceFileLocation::UpdateExtension(const char* name) +void cmSourceFileLocation::UpdateExtension(const std::string& name) { // Check the extension. std::string ext = cmSystemTools::GetFilenameLastExtension(name); @@ -136,10 +137,10 @@ void cmSourceFileLocation::UpdateExtension(const char* name) } //---------------------------------------------------------------------------- -void cmSourceFileLocation::UpdateDirectory(const char* name) +void cmSourceFileLocation::UpdateDirectory(const std::string& name) { // If a full path was given we know the directory. - if(cmSystemTools::FileIsFullPath(name)) + if(cmSystemTools::FileIsFullPath(name.c_str())) { this->Directory = cmSystemTools::GetFilenamePath(name); this->AmbiguousDirectory = false; diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h index c03eee7..64b8c1f 100644 --- a/Source/cmSourceFileLocation.h +++ b/Source/cmSourceFileLocation.h @@ -33,7 +33,7 @@ public: * Construct for a source file created in a given cmMakefile * instance with an initial name. */ - cmSourceFileLocation(cmMakefile const* mf, const char* name); + cmSourceFileLocation(cmMakefile const* mf, const std::string& name); /** * Return whether the givne source file location could refers to the @@ -93,9 +93,9 @@ private: // Update the location with additional knowledge. void Update(cmSourceFileLocation const& loc); - void Update(const char* name); - void UpdateExtension(const char* name); - void UpdateDirectory(const char* name); + void Update(const std::string& name); + void UpdateExtension(const std::string& name); + void UpdateDirectory(const std::string& name); }; #endif diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index d272b6c..195feb5 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -73,7 +73,7 @@ void cmSourceGroup::SetGroupRegex(const char* regex) } //---------------------------------------------------------------------------- -void cmSourceGroup::AddGroupFile(const char* name) +void cmSourceGroup::AddGroupFile(const std::string& name) { this->GroupFiles.insert(name); } diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index 3bbdef9..2d891d1 100644 --- a/Source/cmSourceGroup.h +++ b/Source/cmSourceGroup.h @@ -46,7 +46,7 @@ public: /** * Add a file name to the explicit list of files for this group. */ - void AddGroupFile(const char* name); + void AddGroupFile(const std::string& name); /** * Add child to this sourcegroup diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d5cd140..34d92fa 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -592,7 +592,7 @@ void cmTarget::AddSources(std::vector const& srcs) } //---------------------------------------------------------------------------- -cmSourceFile* cmTarget::AddSource(const char* s) +cmSourceFile* cmTarget::AddSource(const std::string& s) { std::string src = s; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f0dd708..9f7b811 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -143,7 +143,7 @@ public: * Add sources to the target. */ void AddSources(std::vector const& srcs); - cmSourceFile* AddSource(const char* src); + cmSourceFile* AddSource(const std::string& src); enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED}; -- cgit v0.12 From 971eb4d56e3d3c9bc11acf6082e21d5388d808bb Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 3 Feb 2014 17:00:21 -0500 Subject: stringapi: Use strings for TryFullPath --- Source/cmSourceFile.cxx | 9 +++++---- Source/cmSourceFile.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 9feda6c..f052044 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -164,7 +164,7 @@ bool cmSourceFile::FindFullPath(std::string* error) } tryPath += this->Location.GetName(); tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str(), *di); - if(this->TryFullPath(tryPath.c_str(), 0)) + if(this->TryFullPath(tryPath.c_str(), "")) { return true; } @@ -217,10 +217,11 @@ bool cmSourceFile::FindFullPath(std::string* error) } //---------------------------------------------------------------------------- -bool cmSourceFile::TryFullPath(const char* tp, const char* ext) +bool cmSourceFile::TryFullPath(const std::string& path, + const std::string& ext) { - std::string tryPath = tp; - if(ext && *ext) + std::string tryPath = path; + if(!ext.empty()) { tryPath += "."; tryPath += ext; diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 833a490..b362c98 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -107,7 +107,7 @@ private: bool FindFullPathFailed; bool FindFullPath(std::string* error); - bool TryFullPath(const char* tryPath, const char* ext); + bool TryFullPath(const std::string& path, const std::string& ext); void CheckExtension(); void CheckLanguage(std::string const& ext); -- cgit v0.12 From 9f48d3bac22118fc1dddbf1eec6da4cb24c585c4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 3 Feb 2014 21:04:22 -0500 Subject: stringapi: Use strings in CPack generator parameters Most of these are turned into strings in the body of the method (multiple times in some cases). Accept strings to simplify the API and keep string construction down. --- Source/CPack/cmCPackGenerator.cxx | 12 +++++++----- Source/CPack/cmCPackGenerator.h | 14 ++++++++------ Source/CPack/cmCPackGeneratorFactory.cxx | 13 +++++-------- Source/CPack/cmCPackGeneratorFactory.h | 6 +++--- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index b46fd86..bed3891 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1482,8 +1482,8 @@ bool cmCPackGenerator::WantsComponentInstallation() const //---------------------------------------------------------------------- cmCPackInstallationType* -cmCPackGenerator::GetInstallationType(const char *projectName, - const char *name) +cmCPackGenerator::GetInstallationType(const std::string& projectName, + const std::string& name) { (void) projectName; bool hasInstallationType = this->InstallationTypes.count(name) != 0; @@ -1514,7 +1514,8 @@ cmCPackGenerator::GetInstallationType(const char *projectName, //---------------------------------------------------------------------- cmCPackComponent* -cmCPackGenerator::GetComponent(const char *projectName, const char *name) +cmCPackGenerator::GetComponent(const std::string& projectName, + const std::string& name) { bool hasComponent = this->Components.count(name) != 0; cmCPackComponent *component = &this->Components[name]; @@ -1582,7 +1583,7 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) ++installTypesIt) { component->InstallationTypes.push_back( - this->GetInstallationType(projectName, installTypesIt->c_str())); + this->GetInstallationType(projectName, *installTypesIt)); } } @@ -1609,7 +1610,8 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) //---------------------------------------------------------------------- cmCPackComponentGroup* -cmCPackGenerator::GetComponentGroup(const char *projectName, const char *name) +cmCPackGenerator::GetComponentGroup(const std::string& projectName, + const std::string& name) { (void) projectName; std::string macroPrefix = "CPACK_COMPONENT_GROUP_" diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 39ef64d..7e7c94f 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -245,12 +245,14 @@ protected: * @return true if component installation is supported and wanted. */ virtual bool WantsComponentInstallation() const; - virtual cmCPackInstallationType* GetInstallationType(const char *projectName, - const char* name); - virtual cmCPackComponent* GetComponent(const char *projectName, - const char* name); - virtual cmCPackComponentGroup* GetComponentGroup(const char *projectName, - const char* name); + virtual cmCPackInstallationType* GetInstallationType( + const std::string& projectName, + const std::string& name); + virtual cmCPackComponent* GetComponent(const std::string& projectName, + const std::string& name); + virtual cmCPackComponentGroup* GetComponentGroup( + const std::string& projectName, + const std::string& name); cmSystemTools::OutputOption GeneratorVerbose; std::string Name; diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index b36c2a2..9faf2b0 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -151,7 +151,8 @@ cmCPackGeneratorFactory::~cmCPackGeneratorFactory() } //---------------------------------------------------------------------- -cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(const char* name) +cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator( + const std::string& name) { cmCPackGenerator* gen = this->NewGeneratorInternal(name); if ( !gen ) @@ -165,12 +166,8 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(const char* name) //---------------------------------------------------------------------- cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal( - const char* name) + const std::string& name) { - if ( !name ) - { - return 0; - } cmCPackGeneratorFactory::t_GeneratorCreatorsMap::iterator it = this->GeneratorCreators.find(name); if ( it == this->GeneratorCreators.end() ) @@ -181,11 +178,11 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal( } //---------------------------------------------------------------------- -void cmCPackGeneratorFactory::RegisterGenerator(const char* name, +void cmCPackGeneratorFactory::RegisterGenerator(const std::string& name, const char* generatorDescription, CreateGeneratorCall* createGenerator) { - if ( !name || !createGenerator ) + if ( !createGenerator ) { cmCPack_Log(this->Logger, cmCPackLog::LOG_ERROR, "Cannot register generator" << std::endl); diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h index dff2e49..e6f74f9 100644 --- a/Source/CPack/cmCPackGeneratorFactory.h +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -31,12 +31,12 @@ public: ~cmCPackGeneratorFactory(); //! Get the generator - cmCPackGenerator* NewGenerator(const char* name); + cmCPackGenerator* NewGenerator(const std::string& name); void DeleteGenerator(cmCPackGenerator* gen); typedef cmCPackGenerator* CreateGeneratorCall(); - void RegisterGenerator(const char* name, + void RegisterGenerator(const std::string& name, const char* generatorDescription, CreateGeneratorCall* createGenerator); @@ -47,7 +47,7 @@ public: { return this->GeneratorDescriptions; } private: - cmCPackGenerator* NewGeneratorInternal(const char* name); + cmCPackGenerator* NewGeneratorInternal(const std::string& name); std::vector Generators; typedef std::map t_GeneratorCreatorsMap; -- cgit v0.12 From b26c70cc9a59de5b8ece8b00b67d571aaf6ee8f0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 3 Feb 2014 21:16:12 -0500 Subject: stringapi: Use strings for AddString methods It gets turned into a string anyways, so pass them in. --- Source/cmCommandArgumentParserHelper.cxx | 12 ++++++------ Source/cmCommandArgumentParserHelper.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmXCodeObject.cxx | 2 +- Source/cmXCodeObject.h | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index dbeeb07..6284cb7 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -49,14 +49,14 @@ void cmCommandArgumentParserHelper::SetLineFile(long line, const char* file) this->FileName = file; } -char* cmCommandArgumentParserHelper::AddString(const char* str) +char* cmCommandArgumentParserHelper::AddString(const std::string& str) { - if ( !str || !*str ) + if ( str.empty() ) { return this->EmptyVariable; } - char* stVal = new char[strlen(str)+1]; - strcpy(stVal, str); + char* stVal = new char[str.size()+1]; + strcpy(stVal, str.c_str()); this->Variables.push_back(stVal); return stVal; } @@ -153,7 +153,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) { return this->AddString(cmSystemTools::EscapeQuotes(value).c_str()); } - return this->AddString(value); + return this->AddString(value ? value : ""); } char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) @@ -166,7 +166,7 @@ char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) // then return an empty string if(!ret && this->RemoveEmpty) { - return this->AddString(ret); + return this->AddString(""); } // if the ret was not 0, then return it if(ret) diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index f8c672f..da00124 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -86,7 +86,7 @@ private: void Print(const char* place, const char* str); void SafePrintMissing(const char* str, int line, int cnt); - char* AddString(const char* str); + char* AddString(const std::string& str); void CleanupParser(); void SetError(std::string const& msg); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 004f7ac..ab92c6e 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -613,7 +613,7 @@ cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::Type type) //---------------------------------------------------------------------------- cmXCodeObject* -cmGlobalXCodeGenerator::CreateString(const char* s) +cmGlobalXCodeGenerator::CreateString(const std::string& s) { cmXCodeObject* obj = this->CreateObject(cmXCodeObject::STRING); obj->SetString(s); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c9d20c2..31c2cfb 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -135,7 +135,7 @@ private: // correctly. All objects created are stored in this->XCodeObjects. cmXCodeObject* CreateObject(cmXCodeObject::PBXType ptype); cmXCodeObject* CreateObject(cmXCodeObject::Type type); - cmXCodeObject* CreateString(const char* s); + cmXCodeObject* CreateString(const std::string& s); cmXCodeObject* CreateObjectReference(cmXCodeObject*); cmXCodeObject* CreateXCodeTarget(cmTarget& target, cmXCodeObject* buildPhases); diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 6abf6bf..3b9035f 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -266,7 +266,7 @@ void cmXCodeObject::PrintString(std::ostream& os) const } //---------------------------------------------------------------------------- -void cmXCodeObject::SetString(const char* s) +void cmXCodeObject::SetString(const std::string& s) { this->String = s; } diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index b89f78c..0761136 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -37,7 +37,7 @@ public: Type GetType() { return this->TypeValue;} PBXType GetIsA() { return this->IsA;} - void SetString(const char* s); + void SetString(const std::string& s); const char* GetString() { return this->String.c_str(); -- cgit v0.12 From 83a5e453f8c0dc0fc9b6bdee9723478aafefd0da Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 3 Feb 2014 21:20:33 -0500 Subject: stringapi: Use strings for test names --- Source/cmCTest.cxx | 5 ++--- Source/cmCTest.h | 6 +++--- Source/cmMakefile.cxx | 21 +++++++-------------- Source/cmMakefile.h | 4 ++-- Source/cmSetTestsPropertiesCommand.cxx | 2 +- Source/cmSetTestsPropertiesCommand.h | 2 +- Source/cmTest.cxx | 6 +----- Source/cmTest.h | 4 ++-- 8 files changed, 19 insertions(+), 31 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 39b623d..72bb7fd 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2126,7 +2126,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i, if(this->CheckArgument(arg, "--overwrite") && i < args.size() - 1) { i++; - this->AddCTestConfigurationOverwrite(args[i].c_str()); + this->AddCTestConfigurationOverwrite(args[i]); } if(this->CheckArgument(arg, "-A", "--add-notes") && i < args.size() - 1) { @@ -2840,9 +2840,8 @@ void cmCTest::AddSubmitFile(Part part, const char* name) } //---------------------------------------------------------------------- -void cmCTest::AddCTestConfigurationOverwrite(const char* encstr) +void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr) { - std::string overStr = encstr; size_t epos = overStr.find("="); if ( epos == overStr.npos ) { diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 6418f09..1eb0e01 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -70,8 +70,8 @@ public: { PartInfo(): Enabled(false) {} - void SetName(const char* name) { this->Name = name; } - const char* GetName() const { return this->Name.c_str(); } + void SetName(const std::string& name) { this->Name = name; } + const std::string& GetName() const { return this->Name; } void Enable() { this->Enabled = true; } operator bool() const { return this->Enabled; } @@ -349,7 +349,7 @@ public: //! Add overwrite to ctest configuration. // The format is key=value - void AddCTestConfigurationOverwrite(const char* encstr); + void AddCTestConfigurationOverwrite(const std::string& encstr); //! Create XML file that contains all the notes specified int GenerateNotesFile(const std::vector &files); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 97628f3..ff0576e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3852,34 +3852,27 @@ cmTarget* cmMakefile::FindTarget(const std::string& name, } //---------------------------------------------------------------------------- -cmTest* cmMakefile::CreateTest(const char* testName) +cmTest* cmMakefile::CreateTest(const std::string& testName) { - if ( !testName ) - { - return 0; - } cmTest* test = this->GetTest(testName); if ( test ) { return test; } test = new cmTest(this); - test->SetName(testName); + test->SetName(testName.c_str()); this->Tests[testName] = test; return test; } //---------------------------------------------------------------------------- -cmTest* cmMakefile::GetTest(const char* testName) const +cmTest* cmMakefile::GetTest(const std::string& testName) const { - if(testName) + std::map::const_iterator + mi = this->Tests.find(testName); + if(mi != this->Tests.end()) { - std::map::const_iterator - mi = this->Tests.find(testName); - if(mi != this->Tests.end()) - { - return mi->second; - } + return mi->second; } return 0; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index a8ad1e2..044324e 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -782,12 +782,12 @@ public: void AddMacro(const char* name, const char* signature); ///! Add a new cmTest to the list of tests for this makefile. - cmTest* CreateTest(const char* testName); + cmTest* CreateTest(const std::string& testName); /** Get a cmTest pointer for a given test name, if the name is * not found, then a null pointer is returned. */ - cmTest* GetTest(const char* testName) const; + cmTest* GetTest(const std::string& testName) const; /** * Get a list of macros as a ; separated string diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index 3d52cf2..c725d35 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -91,7 +91,7 @@ bool cmSetTestsPropertiesCommand bool cmSetTestsPropertiesCommand -::SetOneTest(const char *tname, +::SetOneTest(const std::string& tname, std::vector &propertyPairs, cmMakefile *mf, std::string &errors) { diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index 9e85495..7f8d57d 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -36,7 +36,7 @@ public: cmTypeMacro(cmSetTestsPropertiesCommand, cmCommand); - static bool SetOneTest(const char *tname, + static bool SetOneTest(const std::string& tname, std::vector &propertyPairs, cmMakefile *mf, std::string &errors); diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index 4ff71ac..28a7bb1 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -38,12 +38,8 @@ cmListFileBacktrace const& cmTest::GetBacktrace() const } //---------------------------------------------------------------------------- -void cmTest::SetName(const char* name) +void cmTest::SetName(const std::string& name) { - if ( !name ) - { - name = ""; - } this->Name = name; } diff --git a/Source/cmTest.h b/Source/cmTest.h index 1becbf7..a5795c3 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -31,8 +31,8 @@ public: ~cmTest(); ///! Set the test name - void SetName(const char* name); - const char* GetName() const { return this->Name.c_str(); } + void SetName(const std::string& name); + std::string GetName() const { return this->Name; } void SetCommand(std::vector const& command); std::vector const& GetCommand() const -- cgit v0.12 From ce5114354c357df973e54872ab7abebbff36793b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 3 Feb 2014 21:20:56 -0500 Subject: stringapi: Use strings for the languages --- Source/cmComputeLinkInformation.cxx | 4 +- Source/cmComputeLinkInformation.h | 4 +- Source/cmCoreTryCompile.cxx | 3 +- Source/cmDepends.cxx | 2 +- Source/cmDepends.h | 4 +- Source/cmDependsC.cxx | 2 +- Source/cmDependsC.h | 3 +- Source/cmExtraCodeBlocksGenerator.cxx | 3 +- Source/cmExtraCodeLiteGenerator.cxx | 3 +- Source/cmExtraSublimeTextGenerator.cxx | 10 ++--- Source/cmGeneratorExpressionEvaluator.cxx | 3 +- Source/cmGeneratorTarget.cxx | 2 +- Source/cmGetSourceFilePropertyCommand.cxx | 2 +- Source/cmGlobalGenerator.cxx | 36 +++++++++-------- Source/cmGlobalGenerator.h | 21 +++++----- Source/cmGlobalVisualStudioGenerator.h | 3 +- Source/cmGlobalXCodeGenerator.cxx | 41 ++++++++----------- Source/cmGlobalXCodeGenerator.h | 11 +++--- Source/cmLocalGenerator.cxx | 55 ++++++++++++++------------ Source/cmLocalGenerator.h | 28 +++++++------ Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.h | 4 +- Source/cmLocalVisualStudio6Generator.cxx | 41 +++++++++---------- Source/cmLocalVisualStudio7Generator.cxx | 32 +++++++-------- Source/cmMakefile.cxx | 4 +- Source/cmMakefile.h | 2 +- Source/cmMakefileExecutableTargetGenerator.cxx | 6 +-- Source/cmMakefileLibraryTargetGenerator.cxx | 36 ++++++----------- Source/cmMakefileLibraryTargetGenerator.h | 2 +- Source/cmMakefileTargetGenerator.cxx | 22 +++++------ Source/cmMakefileTargetGenerator.h | 8 ++-- Source/cmNinjaNormalTargetGenerator.cxx | 8 ++-- Source/cmNinjaNormalTargetGenerator.h | 2 +- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.h | 2 +- Source/cmSourceFile.cxx | 11 +++--- Source/cmSourceFile.h | 4 +- Source/cmSourceFileLocation.cxx | 2 +- Source/cmTarget.cxx | 20 +++++----- Source/cmTarget.h | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 39 +++++++++--------- Source/cmVisualStudioGeneratorOptions.cxx | 4 +- Source/cmVisualStudioGeneratorOptions.h | 2 +- Source/cmXCodeObject.h | 2 +- 44 files changed, 246 insertions(+), 253 deletions(-) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 6986965..716eb4d 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -268,7 +268,7 @@ cmComputeLinkInformation // Get the language used for linking this target. this->LinkLanguage = this->Target->GetLinkerLanguage(config, headTarget); - if(!this->LinkLanguage) + if(this->LinkLanguage.empty()) { // The Compute method will do nothing, so skip the rest of the // initialization. @@ -496,7 +496,7 @@ bool cmComputeLinkInformation::Compute() } // We require a link language for the target. - if(!this->LinkLanguage) + if(this->LinkLanguage.empty()) { cmSystemTools:: Error("CMake can not determine linker language for target: ", diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 356e6ed..26ee8f0 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -50,7 +50,7 @@ public: std::vector const& GetDirectories(); std::vector const& GetDepends(); std::vector const& GetFrameworkPaths(); - const char* GetLinkLanguage() const { return this->LinkLanguage; } + std::string GetLinkLanguage() const { return this->LinkLanguage; } std::vector const& GetRuntimeSearchPath(); std::string const& GetRuntimeFlag() const { return this->RuntimeFlag; } std::string const& GetRuntimeSep() const { return this->RuntimeSep; } @@ -83,7 +83,7 @@ private: // Configuration information. const char* Config; - const char* LinkLanguage; + std::string LinkLanguage; bool LinkDependsNoShared; // Modes for dealing with dependent shared libraries. diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 7b52069..1e8e4d0 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -249,7 +249,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) si != sources.end(); ++si) { std::string ext = cmSystemTools::GetFilenameLastExtension(*si); - if(const char* lang = gg->GetLanguageFromExtension(ext.c_str())) + std::string lang = gg->GetLanguageFromExtension(ext.c_str()); + if(!lang.empty()) { testLangs.insert(lang); } diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 1a0e93f..51150f2 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -297,7 +297,7 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, } //---------------------------------------------------------------------------- -void cmDepends::SetIncludePathFromLanguage(const char* lang) +void cmDepends::SetIncludePathFromLanguage(const std::string& lang) { // Look for the new per "TARGET_" variant first: const char * includePath = 0; diff --git a/Source/cmDepends.h b/Source/cmDepends.h index d787edd..b293c5b 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -41,7 +41,7 @@ public: void SetLocalGenerator(cmLocalGenerator* lg) { this->LocalGenerator = lg; } /** Set the specific language to be scanned. */ - void SetLanguage(const char* lang) { this->Language = lang; } + void SetLanguage(const std::string& lang) { this->Language = lang; } /** Set the target build directory. */ void SetTargetDirectory(const char* dir) { this->TargetDirectory = dir; } @@ -114,7 +114,7 @@ protected: // The include file search path. std::vector IncludePath; - void SetIncludePathFromLanguage(const char* lang); + void SetIncludePathFromLanguage(const std::string& lang); private: cmDepends(cmDepends const&); // Purposely not implemented. diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 4fc5efb..585f959 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -37,7 +37,7 @@ cmDependsC::cmDependsC() //---------------------------------------------------------------------------- cmDependsC::cmDependsC(cmLocalGenerator* lg, const char* targetDir, - const char* lang, + const std::string& lang, const std::map* validDeps) : cmDepends(lg, targetDir) , ValidDeps(validDeps) diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index 16dfad7..cd1e7a4 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -25,7 +25,8 @@ public: /** Checking instances need to know the build directory name and the relative path from the build directory to the target file. */ cmDependsC(); - cmDependsC(cmLocalGenerator* lg, const char* targetDir, const char* lang, + cmDependsC(cmLocalGenerator* lg, const char* targetDir, + const std::string& lang, const std::map* validDeps); /** Virtual destructor to cleanup subclasses properly. */ diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 548c88b..8d4cf85 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -411,7 +411,8 @@ void cmExtraCodeBlocksGenerator // check whether it is a C/C++ implementation file bool isCFile = false; - if ((*si)->GetLanguage() && (*(*si)->GetLanguage() == 'C')) + std::string lang = (*si)->GetLanguage(); + if (lang == "C" || lang == "CXX") { for(std::vector::const_iterator ext = mf->GetSourceExtensions().begin(); diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index ff84fb7..028d3d5 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -220,7 +220,8 @@ void cmExtraCodeLiteGenerator { // check whether it is a C/C++ implementation file bool isCFile = false; - if ((*si)->GetLanguage() && (*(*si)->GetLanguage() == 'C')) + std::string lang = (*si)->GetLanguage(); + if (lang == "C" || lang == "CXX") { for(std::vector::const_iterator ext = mf->GetSourceExtensions().begin(); diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 604bfcc..1c9ac02 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -369,8 +369,8 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source, std::string flags; cmMakefile *makefile = lg->GetMakefile(); - const char* language = source->GetLanguage(); - if (language == NULL) + std::string language = source->GetLanguage(); + if (language.empty()) { language = "C"; } @@ -423,11 +423,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, { std::set defines; cmMakefile *makefile = lg->GetMakefile(); - const char* language = source->GetLanguage(); - if (language == NULL) - { - language = ""; - } + const std::string& language = source->GetLanguage(); const char* config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); // Add the export symbol definition for shared library objects. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index c27c03f..d12a66d 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -990,8 +990,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode "link libraries for a static library"); return std::string(); } - const char *lang = target->GetLinkerLanguage(context->Config); - return lang ? lang : ""; + return target->GetLinkerLanguage(context->Config); } cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index d9885b9..4e7c71e 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -168,7 +168,7 @@ struct TagVisitor this->BadObjLibFiles.push_back(sf); } } - else if(sf->GetLanguage()) + else if(!sf->GetLanguage().empty()) { DoAccept::Result>::Do(this->Data, sf); } diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index 3d85e6d..a6e4fcc 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -35,7 +35,7 @@ bool cmGetSourceFilePropertyCommand { if(args[2] == "LANGUAGE") { - this->Makefile->AddDefinition(var, sf->GetLanguage()); + this->Makefile->AddDefinition(var, sf->GetLanguage().c_str()); return true; } const char *prop = sf->GetPropertyForUser(args[2].c_str()); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f76c6d1..7e93676 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -722,7 +722,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, //---------------------------------------------------------------------------- void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os, - std::string lang, + std::string const& lang, const char* envVar) const { // Subclasses override this method if they do not support this advice. @@ -744,7 +744,7 @@ void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os, //---------------------------------------------------------------------------- void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, - std::string lang) const + std::string const& lang) const { std::string compilerIdVar = "CMAKE_" + lang + "_COMPILER_ID"; const char* compilerId = mf->GetDefinition(compilerIdVar.c_str()); @@ -817,17 +817,18 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, } //---------------------------------------------------------------------------- -const char* +std::string cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const { - if(const char* lang = source.GetLanguage()) + const std::string& lang = source.GetLanguage(); + if(!lang.empty()) { std::map::const_iterator it = this->LanguageToOutputExtension.find(lang); if(it != this->LanguageToOutputExtension.end()) { - return it->second.c_str(); + return it->second; } } else @@ -840,7 +841,7 @@ cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const { if(this->OutputExtensions.count(ext)) { - return ext.c_str(); + return ext; } } } @@ -848,7 +849,7 @@ cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const } -const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const +std::string cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const { // if there is an extension and it starts with . then move past the // . because the extensions are not stored with a . in the map @@ -860,9 +861,9 @@ const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const = this->ExtensionToLanguage.find(ext); if(it != this->ExtensionToLanguage.end()) { - return it->second.c_str(); + return it->second; } - return 0; + return ""; } /* SetLanguageEnabled() is now split in two parts: @@ -877,13 +878,15 @@ files could change the object file extension (CMAKE__OUTPUT_EXTENSION) before the CMake variables were copied to the C++ maps. */ -void cmGlobalGenerator::SetLanguageEnabled(const char* l, cmMakefile* mf) +void cmGlobalGenerator::SetLanguageEnabled(const std::string& l, + cmMakefile* mf) { this->SetLanguageEnabledFlag(l, mf); this->SetLanguageEnabledMaps(l, mf); } -void cmGlobalGenerator::SetLanguageEnabledFlag(const char* l, cmMakefile* mf) +void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l, + cmMakefile* mf) { this->LanguageEnabled[l] = true; @@ -895,7 +898,8 @@ void cmGlobalGenerator::SetLanguageEnabledFlag(const char* l, cmMakefile* mf) this->FillExtensionToLanguageMap(l, mf); } -void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf) +void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, + cmMakefile* mf) { // use LanguageToLinkerPreference to detect whether this functions has // run before @@ -969,7 +973,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf) } -void cmGlobalGenerator::FillExtensionToLanguageMap(const char* l, +void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l, cmMakefile* mf) { std::string extensionsVar = std::string("CMAKE_") + @@ -986,14 +990,14 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const char* l, bool cmGlobalGenerator::IgnoreFile(const char* l) const { - if(this->GetLanguageFromExtension(l)) + if(!this->GetLanguageFromExtension(l).empty()) { return false; } return (this->IgnoreExtensions.count(l) > 0); } -bool cmGlobalGenerator::GetLanguageEnabled(const char* l) const +bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const { return (this->LanguageEnabled.find(l)!= this->LanguageEnabled.end()); } @@ -1958,7 +1962,7 @@ cmGlobalGenerator::GetEnabledLanguages(std::vector& lang) const } } -int cmGlobalGenerator::GetLinkerPreference(const char* lang) const +int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const { std::map::const_iterator it = this->LanguageToLinkerPreference.find(lang); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index b66f01e..2f23fd5 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -77,8 +77,8 @@ public: /** * Set/Get and Clear the enabled languages. */ - void SetLanguageEnabled(const char*, cmMakefile* mf); - bool GetLanguageEnabled(const char*) const; + void SetLanguageEnabled(const std::string&, cmMakefile* mf); + bool GetLanguageEnabled(const std::string&) const; void ClearEnabledLanguages(); void GetEnabledLanguages(std::vector& lang) const; /** @@ -182,13 +182,13 @@ public: bool GetToolSupportsColor() const { return this->ToolSupportsColor; } ///! return the language for the given extension - const char* GetLanguageFromExtension(const char* ext) const; + std::string GetLanguageFromExtension(const char* ext) const; ///! is an extension to be ignored bool IgnoreFile(const char* ext) const; ///! What is the preference for linkers and this language (None or Prefered) - int GetLinkerPreference(const char* lang) const; + int GetLinkerPreference(const std::string& lang) const; ///! What is the object file extension for a given source file? - const char* GetLanguageOutputExtension(cmSourceFile const&) const; + std::string GetLanguageOutputExtension(cmSourceFile const&) const; ///! What is the configurations directory variable called? virtual const char* GetCMakeCFGIntDir() const { return "."; } @@ -332,9 +332,9 @@ protected: bool IsRootOnlyTarget(cmTarget* target) const; void AddTargetDepends(cmTarget const* target, TargetDependSet& projectTargets); - void SetLanguageEnabledFlag(const char* l, cmMakefile* mf); - void SetLanguageEnabledMaps(const char* l, cmMakefile* mf); - void FillExtensionToLanguageMap(const char* l, cmMakefile* mf); + void SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf); + void SetLanguageEnabledMaps(const std::string& l, cmMakefile* mf); + void FillExtensionToLanguageMap(const std::string& l, cmMakefile* mf); virtual bool ComputeTargetDepends(); @@ -420,9 +420,10 @@ private: void WriteSummary(cmTarget* target); void FinalizeTargetCompileInfo(); - virtual void PrintCompilerAdvice(std::ostream& os, std::string lang, + virtual void PrintCompilerAdvice(std::ostream& os, std::string const& lang, const char* envVar) const; - void CheckCompilerIdCompatibility(cmMakefile* mf, std::string lang) const; + void CheckCompilerIdCompatibility(cmMakefile* mf, + std::string const& lang) const; cmExternalMakefileProjectGenerator* ExtraGenerator; diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 9186d65..4b73118 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -114,7 +114,8 @@ protected: private: virtual std::string GetVSMakeProgram() = 0; - void PrintCompilerAdvice(std::ostream&, std::string, const char*) const {} + void PrintCompilerAdvice(std::ostream&, std::string const&, + const char*) const {} void ComputeTargetObjects(cmGeneratorTarget* gt) const; void FollowLinkDepends(cmTarget const* target, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ab92c6e..3f24167 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -696,12 +696,8 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, flags += flagsBuild.GetString(); } - const char* lang = + std::string lang = this->CurrentLocalGenerator->GetSourceFileLanguage(*sf); - if (!lang) - { - lang = ""; - } cmXCodeObject* buildFile = this->CreateXCodeSourceFileFromPath(sf->GetFullPath(), cmtarget, lang); @@ -906,12 +902,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf, cmTarget& cmtarget) { - const char* lang = + std::string lang = this->CurrentLocalGenerator->GetSourceFileLanguage(*sf); - if (!lang) - { - lang = ""; - } return this->CreateXCodeFileReferenceFromPath( sf->GetFullPath(), cmtarget, lang); @@ -1036,7 +1028,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, // Include this file in the build if it has a known language // and has not been listed as an ignored extension for this // generator. - if(this->CurrentLocalGenerator->GetSourceFileLanguage(**i) && + if(!this->CurrentLocalGenerator->GetSourceFileLanguage(**i).empty() && !this->IgnoreFile((*i)->GetExtension().c_str())) { sourceFiles.push_back(xsf); @@ -1241,8 +1233,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget) return; } - const char* llang = cmtarget.GetLinkerLanguage("NOCONFIG"); - if(!llang) { return; } + std::string llang = cmtarget.GetLinkerLanguage("NOCONFIG"); + if(llang.empty()) { return; } // If the language is compiled as a source trust Xcode to link with it. cmTarget::LinkImplementation const* impl = @@ -1270,7 +1262,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget) } if(cmSourceFile* sf = mf->GetOrCreateSource(fname.c_str())) { - sf->SetProperty("LANGUAGE", llang); + sf->SetProperty("LANGUAGE", llang.c_str()); cmtarget.AddSourceFile(sf); } } @@ -1714,12 +1706,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, (target.GetType() == cmTarget::EXECUTABLE) || shared); - const char* lang = target.GetLinkerLanguage(configName); + std::string lang = target.GetLinkerLanguage(configName); std::string cflags; - if(lang) + if(!lang.empty()) { // for c++ projects get the c flags as well - if(strcmp(lang, "CXX") == 0) + if(lang == "CXX") { this->CurrentLocalGenerator->AddLanguageFlags(cflags, "C", configName); this->CurrentLocalGenerator->AddCMP0018Flags(cflags, &target, @@ -2178,7 +2170,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, const char* debugStr = "YES"; // We can't set the Xcode flag differently depending on the language, // so put them back in this case. - if( (lang && strcmp(lang, "CXX") == 0) && gflag != gflagc ) + if( (lang == "CXX") && gflag != gflagc ) { cflags += " "; cflags += gflagc; @@ -2201,7 +2193,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->CreateString("NO")); buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN", this->CreateString("NO")); - if(lang && strcmp(lang, "CXX") == 0) + if(lang == "CXX") { flags += " "; flags += defFlags; @@ -3800,12 +3792,13 @@ cmGlobalXCodeGenerator } //---------------------------------------------------------------------------- -std::string cmGlobalXCodeGenerator::LookupFlags(const char* varNamePrefix, - const char* varNameLang, - const char* varNameSuffix, - const char* default_flags) +std::string cmGlobalXCodeGenerator::LookupFlags( + const std::string& varNamePrefix, + const std::string& varNameLang, + const std::string& varNameSuffix, + const std::string& default_flags) { - if(varNameLang) + if(!varNameLang.empty()) { std::string varName = varNamePrefix; varName += varNameLang; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 31c2cfb..15f1363 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -190,10 +190,10 @@ private: void CreateReRunCMakeFile(cmLocalGenerator* root, std::vector const& gens); - std::string LookupFlags(const char* varNamePrefix, - const char* varNameLang, - const char* varNameSuffix, - const char* default_flags); + std::string LookupFlags(const std::string& varNamePrefix, + const std::string& varNameLang, + const std::string& varNameSuffix, + const std::string& default_flags); class Factory; class BuildObjectListOrString; @@ -215,7 +215,8 @@ protected: std::vector XCodeObjects; cmXCodeObject* RootObject; private: - void PrintCompilerAdvice(std::ostream&, std::string, const char*) const {} + void PrintCompilerAdvice(std::ostream&, std::string const&, + const char*) const {} void ComputeTargetObjects(cmGeneratorTarget* gt) const; std::string GetObjectsNormalDirectory( diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 476c95d..0b4f94b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -572,7 +572,7 @@ void cmLocalGenerator::GenerateTargetManifest() } void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, - const char* lang, + const std::string& lang, cmSourceFile& source, cmGeneratorTarget& target) { @@ -604,7 +604,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, std::vector commands; cmSystemTools::ExpandList(rules, commands); cmLocalGenerator::RuleVariables vars; - vars.Language = lang; + vars.Language = lang.c_str(); vars.Source = sourceFile.c_str(); vars.Object = objectFile.c_str(); vars.ObjectDir = objectDir.c_str(); @@ -653,7 +653,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, ); } -void cmLocalGenerator::AddBuildTargetRule(const char* llang, +void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, cmGeneratorTarget& target) { cmStdString objs; @@ -703,7 +703,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, &target); linkLibs = frameworkPath + linkPath + linkLibs; cmLocalGenerator::RuleVariables vars; - vars.Language = llang; + vars.Language = llang.c_str(); vars.Objects = objs.c_str(); vars.ObjectDir = "."; vars.Target = targetName.c_str(); @@ -776,8 +776,8 @@ void cmLocalGenerator case cmTarget::MODULE_LIBRARY: case cmTarget::EXECUTABLE: { - const char* llang = target.Target->GetLinkerLanguage(); - if(!llang) + std::string llang = target.Target->GetLinkerLanguage(); + if(llang.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", @@ -1290,10 +1290,11 @@ cmLocalGenerator::ConvertToIncludeReference(std::string const& path, std::string cmLocalGenerator::GetIncludeFlags( const std::vector &includes, cmGeneratorTarget* target, - const char* lang, bool forResponseFile, + const std::string& lang, + bool forResponseFile, const char *config) { - if(!lang) + if(lang.empty()) { return ""; } @@ -1415,7 +1416,7 @@ void cmLocalGenerator::AddCompileDefinitions(std::set& defines, //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileOptions( std::string& flags, cmTarget* target, - const char* lang, const char* config + const std::string& lang, const char* config ) { std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX"; @@ -1463,7 +1464,7 @@ void cmLocalGenerator::AddCompileOptions( //---------------------------------------------------------------------------- void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, cmGeneratorTarget* target, - const char* lang, + const std::string& lang, const char *config, bool stripImplicitInclDirs ) @@ -1689,8 +1690,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, linkFlags += this->Makefile->GetSafeDefinition(build.c_str()); linkFlags += " "; } - const char* linkLanguage = target->Target->GetLinkerLanguage(); - if(!linkLanguage) + std::string linkLanguage = target->Target->GetLinkerLanguage(); + if(linkLanguage.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", @@ -1813,7 +1814,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, // Collect library linking flags command line options. std::string linkLibs; - const char* linkLanguage = cli.GetLinkLanguage(); + std::string linkLanguage = cli.GetLinkLanguage(); std::string libPathFlag = this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG"); @@ -1943,7 +1944,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, //---------------------------------------------------------------------------- void cmLocalGenerator::AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target, - const char *lang, + const std::string& lang, const char* config) { // Only add Mac OS X specific flags on Darwin platforms (OSX and iphone): @@ -1969,7 +1970,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG"; const char* deploymentTargetFlag = this->Makefile->GetDefinition(deploymentTargetFlagVar.c_str()); - if(!archs.empty() && lang && (lang[0] =='C' || lang[0] == 'F')) + if(!archs.empty() && !lang.empty() && (lang[0] =='C' || lang[0] == 'F')) { for(std::vector::iterator i = archs.begin(); i != archs.end(); ++i) @@ -2000,7 +2001,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, //---------------------------------------------------------------------------- void cmLocalGenerator::AddLanguageFlags(std::string& flags, - const char* lang, + const std::string& lang, const char* config) { // Add language-specific flags. @@ -2112,7 +2113,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, //---------------------------------------------------------------------------- void cmLocalGenerator::AddSharedFlags(std::string& flags, - const char* lang, + const std::string& lang, bool shared) { std::string flagsVar; @@ -2128,7 +2129,8 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags, } static void AddVisibilityCompileOption(std::string &flags, cmTarget* target, - cmLocalGenerator *lg, const char *lang) + cmLocalGenerator *lg, + const std::string& lang) { std::string l(lang); std::string compileOption = "CMAKE_" + l + "_COMPILE_OPTIONS_VISIBILITY"; @@ -2182,7 +2184,7 @@ static void AddInlineVisibilityCompileOption(std::string &flags, //---------------------------------------------------------------------------- void cmLocalGenerator ::AddVisibilityPresetFlags(std::string &flags, cmTarget* target, - const char *lang) + const std::string& lang) { int targetType = target->GetType(); bool suitableTarget = ((targetType == cmTarget::SHARED_LIBRARY) @@ -2194,13 +2196,13 @@ void cmLocalGenerator return; } - if (!lang) + if (lang.empty()) { return; } AddVisibilityCompileOption(flags, target, this, lang); - if(strcmp(lang, "CXX") == 0) + if(lang == "CXX") { AddInlineVisibilityCompileOption(flags, target, this); } @@ -2396,11 +2398,11 @@ void cmLocalGenerator::AppendDefines(std::set& defines, //---------------------------------------------------------------------------- void cmLocalGenerator::JoinDefines(const std::set& defines, std::string &definesString, - const char* lang) + const std::string& lang) { // Lookup the define flag for the current language. std::string dflag = "-D"; - if(lang) + if(!lang.empty()) { std::string defineFlagVar = "CMAKE_"; defineFlagVar += lang; @@ -2460,7 +2462,7 @@ void cmLocalGenerator::JoinDefines(const std::set& defines, //---------------------------------------------------------------------------- void cmLocalGenerator::AppendFeatureOptions( - std::string& flags, const char* lang, const char* feature) + std::string& flags, const std::string& lang, const char* feature) { std::string optVar = "CMAKE_"; optVar += lang; @@ -3140,7 +3142,8 @@ cmLocalGenerator bool replaceExt = this->NeedBackwardsCompatibility_2_4(); if(!replaceExt) { - if(const char* lang = source.GetLanguage()) + std::string lang = source.GetLanguage(); + if(!lang.empty()) { std::string repVar = "CMAKE_"; repVar += lang; @@ -3174,7 +3177,7 @@ cmLocalGenerator } //---------------------------------------------------------------------------- -const char* +std::string cmLocalGenerator ::GetSourceFileLanguage(const cmSourceFile& source) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 80a1421..74303f4 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -137,14 +137,14 @@ public: void AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target, - const char *lang, const char* config); + const std::string&lang, const char* config); - void AddLanguageFlags(std::string& flags, const char* lang, + void AddLanguageFlags(std::string& flags, const std::string& lang, const char* config); void AddCMP0018Flags(std::string &flags, cmTarget* target, std::string const& lang, const char *config); void AddVisibilityPresetFlags(std::string &flags, cmTarget* target, - const char *lang); + const std::string& lang); void AddConfigVariableFlags(std::string& flags, const std::string& var, const char* config); ///! Append flags to a string. @@ -153,7 +153,8 @@ public: ///! Get the include flags for the current makefile and language std::string GetIncludeFlags(const std::vector &includes, cmGeneratorTarget* target, - const char* lang, bool forResponseFile = false, + const std::string& lang, + bool forResponseFile = false, const char *config = 0); /** @@ -175,10 +176,10 @@ public: */ void JoinDefines(const std::set& defines, std::string &definesString, - const char* lang); + const std::string& lang); /** Lookup and append options associated with a particular feature. */ - void AppendFeatureOptions(std::string& flags, const char* lang, + void AppendFeatureOptions(std::string& flags, const std::string& lang, const char* feature); /** \brief Get absolute path to dependency \a name @@ -223,16 +224,17 @@ public: /** Get the include flags for the current makefile and language. */ void GetIncludeDirectories(std::vector& dirs, cmGeneratorTarget* target, - const char* lang = "C", const char *config = 0, + const std::string& lang = "C", + const char *config = 0, bool stripImplicitInclDirs = true); void AddCompileOptions(std::string& flags, cmTarget* target, - const char* lang, const char* config); + const std::string& lang, const char* config); void AddCompileDefinitions(std::set& defines, cmTarget const* target, const char* config); /** Compute the language used to compile the given source file. */ - const char* GetSourceFileLanguage(const cmSourceFile& source); + std::string GetSourceFileLanguage(const cmSourceFile& source); // Fill the vector with the target names for the object files, // preprocessed files and assembly files. @@ -389,10 +391,11 @@ protected: /** Convert a target to a utility target for unsupported * languages of a generator */ - void AddBuildTargetRule(const char* llang, cmGeneratorTarget& target); + void AddBuildTargetRule(const std::string& llang, + cmGeneratorTarget& target); ///! add a custom command to build a .o file that is part of a target void AddCustomCommandToCreateObject(const char* ofname, - const char* lang, + const std::string& lang, cmSourceFile& source, cmGeneratorTarget& target); // Create Custom Targets and commands for unsupported languages @@ -473,7 +476,8 @@ private: std::string const& result, OutputFormat format); - void AddSharedFlags(std::string& flags, const char* lang, bool shared); + void AddSharedFlags(std::string& flags, const std::string& lang, + bool shared); bool GetShouldUseOldFlags(bool shared, const std::string &lang) const; void AddPositionIndependentFlags(std::string& flags, std::string const& l, int targetType); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 93722d1..11b89f4 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2198,7 +2198,7 @@ cmLocalUnixMakefileGenerator3::GetImplicitDepends(cmTarget const& tgt) //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::AddImplicitDepends(cmTarget const& tgt, - const char* lang, + const std::string& lang, const char* obj, const char* src) { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 703369e..b0ccf52 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -217,7 +217,7 @@ public: public std::map {}; ImplicitDependLanguageMap const& GetImplicitDepends(cmTarget const& tgt); - void AddImplicitDepends(cmTarget const& tgt, const char* lang, + void AddImplicitDepends(cmTarget const& tgt, const std::string& lang, const char* obj, const char* src); void AppendGlobalTargetDepends(std::vector& depends, @@ -358,7 +358,7 @@ private: cmTarget* Target; std::string Language; LocalObjectEntry(): Target(0), Language() {} - LocalObjectEntry(cmTarget* t, const char* lang): + LocalObjectEntry(cmTarget* t, const std::string& lang): Target(t), Language(lang) {} }; struct LocalObjectInfo: public std::vector diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index a5e8294..ff217c3 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -413,19 +413,16 @@ void cmLocalVisualStudio6Generator compileFlags += cflags; } - const char* lang = this->GetSourceFileLanguage(*(*sf)); - if(lang) + const std::string& lang = this->GetSourceFileLanguage(*(*sf)); + if(lang == "CXX") { - if(strcmp(lang, "CXX") == 0) - { - // force a C++ file type - compileFlags += " /TP "; - } - else if(strcmp(lang, "C") == 0) - { - // force to c file type - compileFlags += " /TC "; - } + // force a C++ file type + compileFlags += " /TP "; + } + else if(lang == "C") + { + // force to c file type + compileFlags += " /TC "; } // Add per-source and per-configuration preprocessor definitions. @@ -469,7 +466,7 @@ void cmLocalVisualStudio6Generator } bool excludedFromBuild = - (lang && (*sf)->GetPropertyAsBool("HEADER_FILE_ONLY")); + (!lang.empty() && (*sf)->GetPropertyAsBool("HEADER_FILE_ONLY")); // Check for extra object-file dependencies. const char* dependsValue = (*sf)->GetProperty("OBJECT_DEPENDS"); @@ -1255,8 +1252,8 @@ void cmLocalVisualStudio6Generator if(targetBuilds) { // Get the language to use for linking. - const char* linkLanguage = target.GetLinkerLanguage(); - if(!linkLanguage) + const std::string& linkLanguage = target.GetLinkerLanguage(); + if(linkLanguage.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", @@ -1677,8 +1674,8 @@ void cmLocalVisualStudio6Generator if(target.GetType() >= cmTarget::EXECUTABLE && target.GetType() <= cmTarget::OBJECT_LIBRARY) { - const char* linkLanguage = target.GetLinkerLanguage(); - if(!linkLanguage) + const std::string& linkLanguage = target.GetLinkerLanguage(); + if(linkLanguage.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", @@ -1745,11 +1742,11 @@ void cmLocalVisualStudio6Generator std::string minsizeDefines = " "; std::string debugrelDefines = " "; - this->JoinDefines(definesSet, defines, 0); - this->JoinDefines(debugDefinesSet, debugDefines, 0); - this->JoinDefines(releaseDefinesSet, releaseDefines, 0); - this->JoinDefines(minsizeDefinesSet, minsizeDefines, 0); - this->JoinDefines(debugrelDefinesSet, debugrelDefines, 0); + this->JoinDefines(definesSet, defines, ""); + this->JoinDefines(debugDefinesSet, debugDefines, ""); + this->JoinDefines(releaseDefinesSet, releaseDefines, ""); + this->JoinDefines(minsizeDefinesSet, minsizeDefines, ""); + this->JoinDefines(debugrelDefinesSet, debugrelDefines, ""); flags += defines; flagsDebug += debugDefines; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index d11bf55..f93a7aa 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -687,17 +687,18 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, std::string flags; if(strcmp(configType, "10") != 0) { - const char* linkLanguage = (this->FortranProject? "Fortran": + const std::string& linkLanguage = (this->FortranProject? + std::string("Fortran"): target.GetLinkerLanguage(configName)); - if(!linkLanguage) + if(linkLanguage.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", target.GetName()); return; } - if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0 - || strcmp(linkLanguage, "Fortran") == 0) + if(linkLanguage == "C" || linkLanguage == "CXX" + || linkLanguage == "Fortran") { std::string baseFlagVar = "CMAKE_"; baseFlagVar += linkLanguage; @@ -709,11 +710,11 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, flags += this->Makefile->GetRequiredDefinition(flagVar.c_str()); } // set the correct language - if(strcmp(linkLanguage, "C") == 0) + if(linkLanguage == "C") { flags += " /TC "; } - if(strcmp(linkLanguage, "CXX") == 0) + if(linkLanguage == "CXX") { flags += " /TP "; } @@ -1081,7 +1082,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, return; } cmComputeLinkInformation& cli = *pcli; - const char* linkLanguage = cli.GetLinkLanguage(); + std::string linkLanguage = cli.GetLinkLanguage(); // Compute the variable name to lookup standard libraries for this // language. @@ -1177,7 +1178,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, return; } cmComputeLinkInformation& cli = *pcli; - const char* linkLanguage = cli.GetLinkLanguage(); + std::string linkLanguage = cli.GetLinkLanguage(); bool isWin32Executable = target.GetPropertyAsBool("WIN32_EXECUTABLE"); @@ -1546,14 +1547,14 @@ cmLocalVisualStudio7GeneratorFCInfo } } - const char* lang = + std::string lang = lg->GlobalGenerator->GetLanguageFromExtension (sf.GetExtension().c_str()); - const char* sourceLang = lg->GetSourceFileLanguage(sf); - const char* linkLanguage = target.GetLinkerLanguage(i->c_str()); + const std::string& sourceLang = lg->GetSourceFileLanguage(sf); + const std::string& linkLanguage = target.GetLinkerLanguage(i->c_str()); bool needForceLang = false; // source file does not match its extension language - if(lang && sourceLang && strcmp(lang, sourceLang) != 0) + if(lang != sourceLang) { needForceLang = true; lang = sourceLang; @@ -1569,16 +1570,15 @@ cmLocalVisualStudio7GeneratorFCInfo // if the source file does not match the linker language // then force c or c++ - if(needForceLang || (linkLanguage && lang - && strcmp(lang, linkLanguage) != 0)) + if(needForceLang || (linkLanguage != lang)) { - if(strcmp(lang, "CXX") == 0) + if(lang == "CXX") { // force a C++ file type fc.CompileFlags += " /TP "; needfc = true; } - else if(strcmp(lang, "C") == 0) + else if(lang == "C") { // force to c fc.CompileFlags += " /TC "; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ff0576e..8274b13 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2361,10 +2361,10 @@ bool cmMakefile::PlatformIs64Bit() const return false; } -const char* cmMakefile::GetSONameFlag(const char* language) const +const char* cmMakefile::GetSONameFlag(const std::string& language) const { std::string name = "CMAKE_SHARED_LIBRARY_SONAME"; - if(language) + if(!language.empty()) { name += "_"; name += language; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 044324e..331a064 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -608,7 +608,7 @@ public: bool PlatformIs64Bit() const; /** Retrieve soname flag for the specified language if supported */ - const char* GetSONameFlag(const char* language) const; + const char* GetSONameFlag(const std::string& language) const; /** * Get a list of preprocessor define flags. diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 1802054..b827363 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -160,11 +160,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) cmLocalGenerator::SHELL); // Get the language to use for linking this executable. - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); // Make sure we have a link language. - if(!linkLanguage) + if(linkLanguage.empty()) { cmSystemTools::Error("Cannot determine link language for target \"", this->Target->GetName(), "\"."); @@ -348,7 +348,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_LINK"; vars.CMTarget = this->Target; - vars.Language = linkLanguage; + vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->Target->GetSupportDirectory(); objectDir = this->Convert(objectDir.c_str(), diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 10418d0..96159f9 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -131,13 +131,10 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules() //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() { - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); std::string linkRuleVar = "CMAKE_"; - if (linkLanguage) - { - linkRuleVar += linkLanguage; - } + linkRuleVar += linkLanguage; linkRuleVar += "_CREATE_STATIC_LIBRARY"; if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION") && @@ -160,13 +157,10 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) this->WriteFrameworkRules(relink); return; } - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); std::string linkRuleVar = "CMAKE_"; - if (linkLanguage) - { - linkRuleVar += linkLanguage; - } + linkRuleVar += linkLanguage; linkRuleVar += "_CREATE_SHARED_LIBRARY"; std::string extraFlags; @@ -187,13 +181,10 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) { - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); std::string linkRuleVar = "CMAKE_"; - if (linkLanguage) - { - linkRuleVar += linkLanguage; - } + linkRuleVar += linkLanguage; linkRuleVar += "_CREATE_SHARED_MODULE"; std::string extraFlags; @@ -213,13 +204,10 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) { - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); std::string linkRuleVar = "CMAKE_"; - if (linkLanguage) - { - linkRuleVar += linkLanguage; - } + linkRuleVar += linkLanguage; linkRuleVar += "_CREATE_MACOSX_FRAMEWORK"; std::string extraFlags; @@ -248,11 +236,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules this->AppendLinkDepends(depends); // Get the language to use for linking this library. - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); // Make sure we have a link language. - if(!linkLanguage) + if(linkLanguage.empty()) { cmSystemTools::Error("Cannot determine link language for target \"", this->Target->GetName(), "\"."); @@ -589,7 +577,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules vars.RuleLauncher = "RULE_LAUNCH_LINK"; vars.CMTarget = this->Target; - vars.Language = linkLanguage; + vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->Target->GetSupportDirectory(); objectDir = this->Convert(objectDir.c_str(), @@ -786,7 +774,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator -::AppendOSXVerFlag(std::string& flags, const char* lang, +::AppendOSXVerFlag(std::string& flags, const std::string& lang, const char* name, bool so) { // Lookup the flag to specify the version. diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h index 4873516..68980c3 100644 --- a/Source/cmMakefileLibraryTargetGenerator.h +++ b/Source/cmMakefileLibraryTargetGenerator.h @@ -39,7 +39,7 @@ protected: // Store the computd framework version for OS X Frameworks. std::string FrameworkVersion; - void AppendOSXVerFlag(std::string& flags, const char* lang, + void AppendOSXVerFlag(std::string& flags, const std::string& lang, const char* name, bool so); }; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index bf0dc51..3ba5a77 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -422,8 +422,9 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator() void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) { // Identify the language of the source file. - const char* lang = this->LocalGenerator->GetSourceFileLanguage(source); - if(!lang) + const std::string& lang = + this->LocalGenerator->GetSourceFileLanguage(source); + if(lang.empty()) { // don't know anything about this file so skip it return; @@ -523,7 +524,7 @@ cmMakefileTargetGenerator void cmMakefileTargetGenerator ::WriteObjectBuildFile(std::string &obj, - const char *lang, + const std::string& lang, cmSourceFile& source, std::vector& depends) { @@ -552,7 +553,7 @@ cmMakefileTargetGenerator cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); // Add Fortran format flags. - if(strcmp(lang, "Fortran") == 0) + if(lang == "Fortran") { this->AppendFortranFormatFlags(flags, source); } @@ -664,7 +665,7 @@ cmMakefileTargetGenerator cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; vars.CMTarget = this->Target; - vars.Language = lang; + vars.Language = lang.c_str(); vars.Target = targetOutPathReal.c_str(); vars.TargetPDB = targetOutPathPDB.c_str(); vars.TargetCompilePDB = targetOutPathCompilePDB.c_str(); @@ -689,8 +690,7 @@ cmMakefileTargetGenerator vars.Defines = definesString.c_str(); - bool lang_is_c_or_cxx = ((strcmp(lang, "C") == 0) || - (strcmp(lang, "CXX") == 0)); + bool lang_is_c_or_cxx = ((lang == "C") || (lang == "CXX")); // Construct the compile rules. { @@ -1709,8 +1709,8 @@ void cmMakefileTargetGenerator } void cmMakefileTargetGenerator::RemoveForbiddenFlags(const char* flagVar, - const char* linkLang, - std::string& linkFlags) + const std::string& linkLang, + std::string& linkFlags) { // check for language flags that are not allowed at link time, and // remove them, -w on darwin for gcc -w -dynamiclib sends -w to libtool @@ -1943,7 +1943,7 @@ cmMakefileTargetGenerator //---------------------------------------------------------------------------- void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, - const char* lang) + const std::string& lang) { std::string responseVar = "CMAKE_"; responseVar += lang; @@ -2113,7 +2113,7 @@ bool cmMakefileTargetGenerator::GetFeatureAsBool(const char* feature) //---------------------------------------------------------------------------- void cmMakefileTargetGenerator::AddFeatureFlags( - std::string& flags, const char* lang + std::string& flags, const std::string& lang ) { // Add language-specific flags. diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index f960afc..8ab65bf 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -93,7 +93,7 @@ protected: // write the build rule for an object void WriteObjectBuildFile(std::string &obj, - const char *lang, + const std::string& lang, cmSourceFile& source, std::vector& depends); @@ -173,10 +173,10 @@ protected: bool useResponseFile, std::string& buildObjs, std::vector& makefile_depends); - void AddIncludeFlags(std::string& flags, const char* lang); + void AddIncludeFlags(std::string& flags, const std::string& lang); virtual void CloseFileStreams(); - void RemoveForbiddenFlags(const char* flagVar, const char* linkLang, + void RemoveForbiddenFlags(const char* flagVar, const std::string& linkLang, std::string& linkFlags); cmTarget *Target; cmGeneratorTarget* GeneratorTarget; @@ -260,7 +260,7 @@ protected: void AddModuleDefinitionFlag(std::string& flags); // Add language feature flags. - void AddFeatureFlags(std::string& flags, const char* lang); + void AddFeatureFlags(std::string& flags, const std::string& lang); // Feature query methods. const char* GetFeature(const char* feature); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 73ba815..b81fbeb 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -35,7 +35,7 @@ cmNinjaNormalTargetGenerator(cmGeneratorTarget* target) , TargetNameReal() , TargetNameImport() , TargetNamePDB() - , TargetLinkLanguage(0) + , TargetLinkLanguage("") { this->TargetLinkLanguage = target->Target ->GetLinkerLanguage(this->GetConfigName()); @@ -72,7 +72,7 @@ cmNinjaNormalTargetGenerator::~cmNinjaNormalTargetGenerator() void cmNinjaNormalTargetGenerator::Generate() { - if (!this->TargetLinkLanguage) { + if (this->TargetLinkLanguage.empty()) { cmSystemTools::Error("CMake can not determine linker language for " "target: ", this->GetTarget()->GetName()); @@ -140,7 +140,7 @@ std::string cmNinjaNormalTargetGenerator ::LanguageLinkerRule() const { - return std::string(this->TargetLinkLanguage) + return this->TargetLinkLanguage + "_" + cmTarget::GetTargetTypeName(this->GetTarget()->GetType()) + "_LINKER"; @@ -163,7 +163,7 @@ cmNinjaNormalTargetGenerator cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_LINK"; vars.CMTarget = this->GetTarget(); - vars.Language = this->TargetLinkLanguage; + vars.Language = this->TargetLinkLanguage.c_str(); std::string responseFlag; if (!useResponseFile) { diff --git a/Source/cmNinjaNormalTargetGenerator.h b/Source/cmNinjaNormalTargetGenerator.h index c7a089c..556ed5e 100644 --- a/Source/cmNinjaNormalTargetGenerator.h +++ b/Source/cmNinjaNormalTargetGenerator.h @@ -47,7 +47,7 @@ private: std::string TargetNameReal; std::string TargetNameImport; std::string TargetNamePDB; - const char *TargetLinkLanguage; + std::string TargetLinkLanguage; }; #endif // ! cmNinjaNormalTargetGenerator_h diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 00b0441..1c43cb3 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -110,7 +110,7 @@ bool cmNinjaTargetGenerator::GetFeatureAsBool(const char* feature) // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. void cmNinjaTargetGenerator::AddFeatureFlags(std::string& flags, - const char* lang) + const std::string& lang) { // Add language-specific flags. this->LocalGenerator->AddLanguageFlags(flags, lang, this->GetConfigName()); diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 43f2279..e8ac81c 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -72,7 +72,7 @@ protected: const char* GetFeature(const char* feature); bool GetFeatureAsBool(const char* feature); - void AddFeatureFlags(std::string& flags, const char* lang); + void AddFeatureFlags(std::string& flags, const std::string& lang); /** * Compute the flags for compilation of object files for a given @a language. diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index f052044..0d37205 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -39,7 +39,7 @@ std::string const& cmSourceFile::GetExtension() const } //---------------------------------------------------------------------------- -const char* cmSourceFile::GetLanguage() +std::string cmSourceFile::GetLanguage() { // If the language was set explicitly by the user then use it. if(const char* lang = this->GetProperty("LANGUAGE")) @@ -76,7 +76,7 @@ const char* cmSourceFile::GetLanguage() } //---------------------------------------------------------------------------- -const char* cmSourceFile::GetLanguage() const +std::string cmSourceFile::GetLanguage() const { // If the language was set explicitly by the user then use it. if(const char* lang = this->GetProperty("LANGUAGE")) @@ -87,11 +87,11 @@ const char* cmSourceFile::GetLanguage() const // If the language was determined from the source file extension use it. if(!this->Language.empty()) { - return this->Language.c_str(); + return this->Language; } // The language is not known. - return 0; + return ""; } //---------------------------------------------------------------------------- @@ -267,7 +267,8 @@ void cmSourceFile::CheckLanguage(std::string const& ext) // Try to identify the source file language from the extension. cmMakefile const* mf = this->Location.GetMakefile(); cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator(); - if(const char* l = gg->GetLanguageFromExtension(ext.c_str())) + std::string l = gg->GetLanguageFromExtension(ext.c_str()); + if(!l.empty()) { this->Language = l; } diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index b362c98..17c96ac 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -79,8 +79,8 @@ public: /** * Get the language of the compiler to use for this source file. */ - const char* GetLanguage(); - const char* GetLanguage() const; + std::string GetLanguage(); + std::string GetLanguage() const; /** * Return the vector that holds the list of dependencies diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index 832a6a7..30a53cb 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -93,7 +93,7 @@ void cmSourceFileLocation::UpdateExtension(const std::string& name) cmMakefile const* mf = this->Makefile; const std::vector& srcExts = mf->GetSourceExtensions(); const std::vector& hdrExts = mf->GetHeaderExtensions(); - if(gg->GetLanguageFromExtension(ext.c_str()) || + if(!gg->GetLanguageFromExtension(ext.c_str()).empty() || std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end() || std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end()) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 34d92fa..6782822 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2884,13 +2884,11 @@ private: }; //---------------------------------------------------------------------------- -const char* cmTarget::GetLinkerLanguage(const char* config, +std::string cmTarget::GetLinkerLanguage(const char* config, cmTarget const* head) const { cmTarget const* headTarget = head ? head : this; - const char* lang = this->GetLinkClosure(config, headTarget) - ->LinkerLanguage.c_str(); - return *lang? lang : 0; + return this->GetLinkClosure(config, headTarget)->LinkerLanguage; } //---------------------------------------------------------------------------- @@ -2924,7 +2922,7 @@ public: this->Makefile = this->Target->GetMakefile(); this->GG = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); } - void Consider(const char* lang) + void Consider(const std::string& lang) { int preference = this->GG->GetLinkerPreference(lang); if(preference > this->Preference) @@ -3530,7 +3528,8 @@ void cmTarget::GetFullNameInternal(const char* config, const char* suffixVar = this->GetSuffixVariableInternal(implib); // Check for language-specific default prefix and suffix. - if(const char* ll = this->GetLinkerLanguage(config, this)) + std::string ll = this->GetLinkerLanguage(config, this); + if(!ll.empty()) { if(!targetSuffix && suffixVar && *suffixVar) { @@ -3867,7 +3866,8 @@ bool cmTarget::NeedRelinkBeforeInstall(const char* config) const } // Check for rpath support on this platform. - if(const char* ll = this->GetLinkerLanguage(config, this)) + std::string ll = this->GetLinkerLanguage(config, this); + if(!ll.empty()) { std::string flagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_"; flagVar += ll; @@ -4825,7 +4825,8 @@ void cmTarget::GetLanguages(std::set& languages) const for(std::vector::const_iterator i = this->SourceFiles.begin(); i != this->SourceFiles.end(); ++i) { - if(const char* lang = (*i)->GetLanguage()) + const std::string& lang = (*i)->GetLanguage(); + if(!lang.empty()) { languages.insert(lang); } @@ -4876,7 +4877,8 @@ bool cmTarget::IsChrpathUsed(const char* config) const #if defined(CMAKE_USE_ELF_PARSER) // Enable if the rpath flag uses a separator and the target uses ELF // binaries. - if(const char* ll = this->GetLinkerLanguage(config, this)) + std::string ll = this->GetLinkerLanguage(config, this); + if(!ll.empty()) { std::string sepVar = "CMAKE_SHARED_LIBRARY_RUNTIME_"; sepVar += ll; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 9f7b811..205c81c 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -347,7 +347,7 @@ public: GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const; ///! Return the preferred linker language for this target - const char* GetLinkerLanguage(const char* config = 0, + std::string GetLinkerLanguage(const char* config = 0, cmTarget const* head = 0) const; /** Get the full name of the target according to the settings in its diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 2d21a3d..aa721b7 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1012,18 +1012,18 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() si = objectSources.begin(); si != objectSources.end(); ++si) { - const char* lang = (*si)->GetLanguage(); + const std::string& lang = (*si)->GetLanguage(); const char* tool = NULL; - if (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") == 0) + if (lang == "C"|| lang == "CXX") { tool = "ClCompile"; } - else if (strcmp(lang, "ASM_MASM") == 0 && + else if (lang == "ASM_NASM" && this->GlobalGenerator->IsMasmEnabled()) { tool = "MASM"; } - else if (strcmp(lang, "RC") == 0) + else if (lang == "RC") { tool = "ResourceCompile"; } @@ -1108,29 +1108,28 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( { defines += cdefs; } - const char* lang = + std::string lang = this->GlobalGenerator->GetLanguageFromExtension (sf.GetExtension().c_str()); - const char* sourceLang = this->LocalGenerator->GetSourceFileLanguage(sf); - const char* linkLanguage = this->Target->GetLinkerLanguage(); + std::string sourceLang = this->LocalGenerator->GetSourceFileLanguage(sf); + const std::string& linkLanguage = this->Target->GetLinkerLanguage(); bool needForceLang = false; // source file does not match its extension language - if(lang && sourceLang && strcmp(lang, sourceLang) != 0) + if(lang != sourceLang) { needForceLang = true; lang = sourceLang; } // if the source file does not match the linker language // then force c or c++ - if(needForceLang || (linkLanguage && lang - && strcmp(lang, linkLanguage) != 0)) + if(needForceLang || (linkLanguage != lang)) { - if(strcmp(lang, "CXX") == 0) + if(lang == "CXX") { // force a C++ file type flags += " /TP "; } - else if(strcmp(lang, "C") == 0) + else if(lang == "C") { // force to c flags += " /TC "; @@ -1341,17 +1340,17 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( // collect up flags for if(this->Target->GetType() < cmTarget::UTILITY) { - const char* linkLanguage = + const std::string& linkLanguage = this->Target->GetLinkerLanguage(configName.c_str()); - if(!linkLanguage) + if(linkLanguage.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", this->Name.c_str()); return false; } - if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0 - || strcmp(linkLanguage, "Fortran") == 0) + if(linkLanguage == "C" || linkLanguage == "CXX" + || linkLanguage == "Fortran") { std::string baseFlagVar = "CMAKE_"; baseFlagVar += linkLanguage; @@ -1365,11 +1364,11 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str()); } // set the correct language - if(strcmp(linkLanguage, "C") == 0) + if(linkLanguage == "C") { flags += " /TC "; } - if(strcmp(linkLanguage, "CXX") == 0) + if(linkLanguage == "CXX") { flags += " /TP "; } @@ -1525,9 +1524,9 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) cmVSGetLinkFlagTable(this->LocalGenerator), 0, this)); Options& linkOptions = *pOptions; - const char* linkLanguage = + const std::string& linkLanguage = this->Target->GetLinkerLanguage(config.c_str()); - if(!linkLanguage) + if(linkLanguage.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 6aca787..f48c593 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -222,7 +222,7 @@ cmVisualStudioGeneratorOptions ::OutputPreprocessorDefinitions(std::ostream& fout, const char* prefix, const char* suffix, - const char* lang) + const std::string& lang) { if(this->Defines.empty()) { @@ -270,7 +270,7 @@ cmVisualStudioGeneratorOptions { define = cmVisualStudio10GeneratorOptionsEscapeForXML(define.c_str()); - if(0 == strcmp(lang, "RC")) + if(lang == "RC") { cmSystemTools::ReplaceString(define, "\"", "\\\""); } diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index 90f7667..214b893 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -55,7 +55,7 @@ public: void OutputPreprocessorDefinitions(std::ostream& fout, const char* prefix, const char* suffix, - const char* lang); + const std::string& lang); void OutputFlagMap(std::ostream& fout, const char* indent); void OutputAdditionalOptions(std::ostream& fout, const char* prefix, diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 0761136..ad1533e 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -123,7 +123,7 @@ public: void CopyAttributes(cmXCodeObject* ); void AddDependLibrary(const char* configName, - const char* l) + const std::string& l) { if(!configName) { -- cgit v0.12 From a6ae2ea72bc0d4149c2ff6118fcfd577e95c680d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 4 Feb 2014 13:31:39 -0500 Subject: stringapi: Use strings in Convert methods in LocalGenerator The C strings were turned into std::strings internally anyways and most callers used .c_str(). --- Source/cmLocalGenerator.cxx | 36 +++++++++++++++++++----------------- Source/cmLocalGenerator.h | 20 +++++++++++--------- Source/cmMakefileTargetGenerator.h | 2 +- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0b4f94b..e1abfef 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1230,7 +1230,7 @@ void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target, //---------------------------------------------------------------------------- std::string -cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote, +cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote, std::string const& result, OutputFormat format) { @@ -1238,10 +1238,10 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote, // already exists, we can use a short-path to reference it without a // space. if(this->WindowsShell && result.find(' ') != result.npos && - cmSystemTools::FileExists(remote)) + cmSystemTools::FileExists(remote.c_str())) { std::string tmp; - if(cmSystemTools::GetShortPath(remote, tmp)) + if(cmSystemTools::GetShortPath(remote.c_str(), tmp)) { return this->Convert(tmp.c_str(), NONE, format, true); } @@ -1253,7 +1253,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote, //---------------------------------------------------------------------------- std::string -cmLocalGenerator::ConvertToOutputForExisting(const char* remote, +cmLocalGenerator::ConvertToOutputForExisting(const std::string& remote, RelativeRoot local, OutputFormat format) { @@ -1267,7 +1267,7 @@ cmLocalGenerator::ConvertToOutputForExisting(const char* remote, //---------------------------------------------------------------------------- std::string cmLocalGenerator::ConvertToOutputForExisting(RelativeRoot remote, - const char* local, + const std::string& local, OutputFormat format) { // Perform standard conversion. @@ -2513,7 +2513,8 @@ cmLocalGenerator::ConstructComment(const cmCustomCommand& cc, //---------------------------------------------------------------------------- std::string -cmLocalGenerator::ConvertToOptionallyRelativeOutputPath(const char* remote) +cmLocalGenerator::ConvertToOptionallyRelativeOutputPath( + const std::string& remote) { return this->Convert(remote, START_OUTPUT, SHELL, true); } @@ -2533,7 +2534,7 @@ const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot) } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::Convert(const char* source, +std::string cmLocalGenerator::Convert(const std::string& source, RelativeRoot relative, OutputFormat output, bool optional) @@ -2585,7 +2586,7 @@ std::string cmLocalGenerator::Convert(const char* source, } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::ConvertToOutputFormat(const char* source, +std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, OutputFormat output) { std::string result = source; @@ -2627,7 +2628,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const char* source, //---------------------------------------------------------------------------- std::string cmLocalGenerator::Convert(RelativeRoot remote, - const char* local, + const std::string& local, OutputFormat output, bool optional) { @@ -2636,10 +2637,10 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, // The relative root must have a path (i.e. not FULL or NONE) assert(remotePath != 0); - if(local && (!optional || this->UseRelativePaths)) + if(!local.empty() && (!optional || this->UseRelativePaths)) { std::vector components; - cmSystemTools::SplitPath(local, components); + cmSystemTools::SplitPath(local.c_str(), components); std::string result = this->ConvertToRelativePath(components, remotePath); return this->ConvertToOutputFormat(result.c_str(), output); } @@ -2722,7 +2723,8 @@ static bool cmLocalGeneratorNotAbove(const char* a, const char* b) //---------------------------------------------------------------------------- std::string cmLocalGenerator::ConvertToRelativePath(const std::vector& local, - const char* in_remote, bool force) + const std::string& in_remote, + bool force) { // The path should never be quoted. assert(in_remote[0] != '\"'); @@ -2731,7 +2733,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, assert(local.size() > 0 && !(local[local.size()-1] == "")); // If the path is already relative then just return the path. - if(!cmSystemTools::FileIsFullPath(in_remote)) + if(!cmSystemTools::FileIsFullPath(in_remote.c_str())) { return in_remote; } @@ -2750,11 +2752,11 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, std::string local_path = cmSystemTools::JoinPath(local); if(!((cmLocalGeneratorNotAbove(local_path.c_str(), this->RelativePathTopBinary.c_str()) && - cmLocalGeneratorNotAbove(in_remote, + cmLocalGeneratorNotAbove(in_remote.c_str(), this->RelativePathTopBinary.c_str())) || (cmLocalGeneratorNotAbove(local_path.c_str(), this->RelativePathTopSource.c_str()) && - cmLocalGeneratorNotAbove(in_remote, + cmLocalGeneratorNotAbove(in_remote.c_str(), this->RelativePathTopSource.c_str())))) { return in_remote; @@ -2764,7 +2766,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, // Identify the longest shared path component between the remote // path and the local path. std::vector remote; - cmSystemTools::SplitPath(in_remote, remote); + cmSystemTools::SplitPath(in_remote.c_str(), remote); unsigned int common=0; while(common < remote.size() && common < local.size() && @@ -2982,7 +2984,7 @@ bool cmLocalGeneratorCheckObjectName(std::string& objName, //---------------------------------------------------------------------------- std::string& cmLocalGenerator -::CreateSafeUniqueObjectFileName(const char* sin, +::CreateSafeUniqueObjectFileName(const std::string& sin, std::string const& dir_max) { // Look for an existing mapped name for this object file. diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 74303f4..182b783 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -106,11 +106,12 @@ public: */ enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT }; enum OutputFormat { UNCHANGED, MAKEFILE, SHELL, RESPONSE }; - std::string ConvertToOutputFormat(const char* source, OutputFormat output); - std::string Convert(const char* remote, RelativeRoot local, + std::string ConvertToOutputFormat(const std::string& source, + OutputFormat output); + std::string Convert(const std::string& remote, RelativeRoot local, OutputFormat output = UNCHANGED, bool optional = false); - std::string Convert(RelativeRoot remote, const char* local, + std::string Convert(RelativeRoot remote, const std::string& local, OutputFormat output = UNCHANGED, bool optional = false); @@ -125,7 +126,7 @@ public: * remote path must use forward slashes and not already be escaped * or quoted. */ - std::string ConvertToOptionallyRelativeOutputPath(const char* remote); + std::string ConvertToOptionallyRelativeOutputPath(const std::string& remote); ///! set/get the parent generator cmLocalGenerator* GetParent(){return this->Parent;} @@ -198,14 +199,14 @@ public: std::string& dep); ///! for existing files convert to output path and short path if spaces - std::string ConvertToOutputForExisting(const char* remote, + std::string ConvertToOutputForExisting(const std::string& remote, RelativeRoot local = START_OUTPUT, OutputFormat format = SHELL); /** For existing path identified by RelativeRoot convert to output path and short path if spaces. */ std::string ConvertToOutputForExisting(RelativeRoot remote, - const char* local = 0, + const std::string& local = "", OutputFormat format = SHELL); virtual std::string ConvertToIncludeReference(std::string const& path, @@ -309,7 +310,8 @@ public: * or quoted. */ std::string ConvertToRelativePath(const std::vector& local, - const char* remote, bool force=false); + const std::string& remote, + bool force=false); /** * Get the relative path from the generator output directory to a @@ -410,7 +412,7 @@ protected: std::ostream& os, const char* config, std::vector const& configurationTypes); - std::string& CreateSafeUniqueObjectFileName(const char* sin, + std::string& CreateSafeUniqueObjectFileName(const std::string& sin, std::string const& dir_max); void ComputeObjectMaxPath(); @@ -472,7 +474,7 @@ protected: cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: - std::string ConvertToOutputForExistingCommon(const char* remote, + std::string ConvertToOutputForExistingCommon(const std::string& remote, std::string const& result, OutputFormat format); diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 8ab65bf..baae2b0 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -269,7 +269,7 @@ protected: //================================================================== // Convenience routines that do nothing more than forward to // implementaitons - std::string Convert(const char* source, + std::string Convert(const std::string& source, cmLocalGenerator::RelativeRoot relative, cmLocalGenerator::OutputFormat output = cmLocalGenerator::UNCHANGED, -- cgit v0.12 From fabf1fbabb4fc67844d5b2210e70a9829a59ff23 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 6 Feb 2014 17:31:47 -0500 Subject: stringapi: Use strings in target name --- Source/CTest/cmCTestBuildCommand.cxx | 3 +- Source/cmBuildCommand.cxx | 6 +-- Source/cmComputeLinkDepends.cxx | 9 ++-- Source/cmComputeLinkDepends.h | 3 +- Source/cmComputeLinkInformation.cxx | 2 +- Source/cmComputeTargetDepends.cxx | 15 +++--- Source/cmComputeTargetDepends.h | 8 +-- Source/cmCoreTryCompile.cxx | 11 +++-- Source/cmCoreTryCompile.h | 2 +- Source/cmExtraCodeBlocksGenerator.cxx | 5 +- Source/cmExtraCodeBlocksGenerator.h | 4 +- Source/cmExtraSublimeTextGenerator.cxx | 5 +- Source/cmExtraSublimeTextGenerator.h | 4 +- Source/cmGeneratorTarget.cxx | 4 +- Source/cmGeneratorTarget.h | 2 +- Source/cmGetPropertyCommand.cxx | 2 +- Source/cmGlobalGenerator.cxx | 24 ++++----- Source/cmGlobalGenerator.h | 19 +++---- Source/cmGlobalNinjaGenerator.cxx | 6 +-- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 12 ++--- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 13 ++--- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 11 +++-- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 13 ++--- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalVisualStudio8Generator.cxx | 2 +- Source/cmGlobalVisualStudioGenerator.cxx | 6 +-- Source/cmGlobalVisualStudioGenerator.h | 4 +- Source/cmGlobalXCodeGenerator.cxx | 23 ++++----- Source/cmGlobalXCodeGenerator.h | 4 +- Source/cmGraphVizWriter.cxx | 8 +-- Source/cmGraphVizWriter.h | 8 +-- Source/cmLocalGenerator.cxx | 20 ++++---- Source/cmLocalGenerator.h | 6 +-- Source/cmLocalUnixMakefileGenerator3.cxx | 14 +++--- Source/cmLocalUnixMakefileGenerator3.h | 9 ++-- Source/cmLocalVisualStudio6Generator.cxx | 22 ++++----- Source/cmLocalVisualStudio6Generator.h | 12 ++--- Source/cmLocalVisualStudio7Generator.cxx | 30 ++++++------ Source/cmLocalVisualStudio7Generator.h | 17 ++++--- Source/cmMakefile.cxx | 68 ++++++++++++-------------- Source/cmMakefile.h | 29 +++++------ Source/cmMakefileExecutableTargetGenerator.cxx | 2 +- Source/cmMakefileLibraryTargetGenerator.cxx | 4 +- Source/cmMakefileTargetGenerator.cxx | 6 +-- Source/cmMakefileTargetGenerator.h | 2 +- Source/cmMakefileUtilityTargetGenerator.cxx | 2 +- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 14 +++--- Source/cmSetPropertyCommand.cxx | 2 +- Source/cmSetTargetPropertiesCommand.cxx | 2 +- Source/cmSetTargetPropertiesCommand.h | 2 +- Source/cmTarget.cxx | 28 ++++++----- Source/cmTarget.h | 18 +++---- Source/cmXCodeObject.h | 2 +- 58 files changed, 287 insertions(+), 274 deletions(-) diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 12ff718..9738bde 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -130,7 +130,8 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory"); std::string buildCommand = this->GlobalGenerator-> - GenerateCMakeBuildCommand(cmakeBuildTarget, cmakeBuildConfiguration, + GenerateCMakeBuildCommand(cmakeBuildTarget ? cmakeBuildTarget : "", + cmakeBuildConfiguration, cmakeBuildAdditionalFlags, true); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SetMakeCommand:" diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index c06b8ad..d8e1a2c 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -44,7 +44,7 @@ bool cmBuildCommand // Parse remaining arguments. const char* configuration = 0; const char* project_name = 0; - const char* target = 0; + std::string target; enum Doing { DoingNone, DoingConfiguration, DoingProjectName, DoingTarget }; Doing doing = DoingNone; for(unsigned int i=1; i < args.size(); ++i) @@ -74,7 +74,7 @@ bool cmBuildCommand else if(doing == DoingTarget) { doing = DoingNone; - target = args[i].c_str(); + target = args[i]; } else { @@ -136,7 +136,7 @@ bool cmBuildCommand } std::string makecommand = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->GenerateCMakeBuildCommand(0, configType.c_str(), + ->GetGlobalGenerator()->GenerateCMakeBuildCommand("", configType.c_str(), 0, true); if(cacheValue) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 1be5980..d51e6e6 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -254,7 +254,8 @@ cmComputeLinkDepends::Compute() "---------------------------------------" "---------------------------------------\n"); fprintf(stderr, "Link dependency analysis for target %s, config %s\n", - this->Target->GetName(), this->Config?this->Config:"noconfig"); + this->Target->GetName().c_str(), + this->Config?this->Config:"noconfig"); this->DisplayConstraintGraph(); } @@ -620,7 +621,7 @@ cmComputeLinkDepends::AddLinkEntries(int depender_index, //---------------------------------------------------------------------------- cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index, - const char* name) + const std::string& name) { // Look for a target in the scope of the depender. cmMakefile* mf = this->Makefile; @@ -968,14 +969,14 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl) //---------------------------------------------------------------------------- void cmComputeLinkDepends::DisplayFinalEntries() { - fprintf(stderr, "target [%s] links to:\n", this->Target->GetName()); + fprintf(stderr, "target [%s] links to:\n", this->Target->GetName().c_str()); for(std::vector::const_iterator lei = this->FinalLinkEntries.begin(); lei != this->FinalLinkEntries.end(); ++lei) { if(lei->Target) { - fprintf(stderr, " target [%s]\n", lei->Target->GetName()); + fprintf(stderr, " target [%s]\n", lei->Target->GetName().c_str()); } else { diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 9776f55..26bf6db 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -83,7 +83,8 @@ private: void AddDirectLinkEntries(); void AddLinkEntries(int depender_index, std::vector const& libs); - cmTarget const* FindTargetToLink(int depender_index, const char* name); + cmTarget const* FindTargetToLink(int depender_index, + const std::string& name); // One entry for each unique item. std::vector EntryList; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 716eb4d..23a6671 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -500,7 +500,7 @@ bool cmComputeLinkInformation::Compute() { cmSystemTools:: Error("CMake can not determine linker language for target: ", - this->Target->GetName()); + this->Target->GetName().c_str()); return false; } diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 6511510..83d1e2e 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -298,7 +298,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, - const char* dependee_name, + const std::string& dependee_name, bool linking, std::set &emitted) { @@ -333,7 +333,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddTargetDepend(int depender_index, - const char* dependee_name, + const std::string& dependee_name, bool linking) { // Get the depender. @@ -434,22 +434,23 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, //---------------------------------------------------------------------------- void -cmComputeTargetDepends::DisplayGraph(Graph const& graph, const char* name) +cmComputeTargetDepends::DisplayGraph(Graph const& graph, + const std::string& name) { - fprintf(stderr, "The %s target dependency graph is:\n", name); + fprintf(stderr, "The %s target dependency graph is:\n", name.c_str()); int n = static_cast(graph.size()); for(int depender_index = 0; depender_index < n; ++depender_index) { EdgeList const& nl = graph[depender_index]; cmTarget const* depender = this->Targets[depender_index]; fprintf(stderr, "target %d is [%s]\n", - depender_index, depender->GetName()); + depender_index, depender->GetName().c_str()); for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { int dependee_index = *ni; cmTarget const* dependee = this->Targets[dependee_index]; fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index, - dependee->GetName(), ni->IsStrong()? "strong" : "weak"); + dependee->GetName().c_str(), ni->IsStrong()? "strong" : "weak"); } } fprintf(stderr, "\n"); @@ -471,7 +472,7 @@ cmComputeTargetDepends { int i = *ni; fprintf(stderr, " contains target %d [%s]\n", - i, this->Targets[i]->GetName()); + i, this->Targets[i]->GetName().c_str()); } } fprintf(stderr, "\n"); diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index 6cd6da0..dcb450a 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -45,12 +45,14 @@ private: void CollectTargets(); void CollectDepends(); void CollectTargetDepends(int depender_index); - void AddTargetDepend(int depender_index, const char* dependee_name, + void AddTargetDepend(int depender_index, + const std::string& dependee_name, bool linking); void AddTargetDepend(int depender_index, cmTarget const* dependee, bool linking); bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); - void AddInterfaceDepends(int depender_index, const char* dependee_name, + void AddInterfaceDepends(int depender_index, + const std::string& dependee_name, bool linking, std::set &emitted); void AddInterfaceDepends(int depender_index, cmTarget const* dependee, const char *config, @@ -71,7 +73,7 @@ private: typedef cmGraphAdjacencyList Graph; Graph InitialGraph; Graph FinalGraph; - void DisplayGraph(Graph const& graph, const char* name); + void DisplayGraph(Graph const& graph, const std::string& name); // Deal with connected components. void DisplayComponents(cmComputeComponentGraph const& ccg); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 1e8e4d0..b0e2b6f 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -28,7 +28,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) const char* sourceDirectory = argv[2].c_str(); const char* projectName = 0; - const char* targetName = 0; + std::string targetName; std::vector cmakeFlags; std::vector compileDefs; std::string outputVariable; @@ -450,7 +450,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", this->BinaryDirectory.c_str()); /* Create the actual executable. */ - fprintf(fout, "add_executable(%s", targetName); + fprintf(fout, "add_executable(%s", targetName.c_str()); for(std::vector::iterator si = sources.begin(); si != sources.end(); ++si) { @@ -466,12 +466,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) if (useOldLinkLibs) { fprintf(fout, - "target_link_libraries(%s ${LINK_LIBRARIES})\n",targetName); + "target_link_libraries(%s ${LINK_LIBRARIES})\n", + targetName.c_str()); } else { fprintf(fout, "target_link_libraries(%s %s)\n", - targetName, + targetName.c_str(), libsToLink.c_str()); } fclose(fout); @@ -610,7 +611,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir) } } -void cmCoreTryCompile::FindOutputFile(const char* targetName) +void cmCoreTryCompile::FindOutputFile(const std::string& targetName) { this->FindErrorMessage = ""; this->OutputFile = ""; diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h index 5c67f13..3272462 100644 --- a/Source/cmCoreTryCompile.h +++ b/Source/cmCoreTryCompile.h @@ -44,7 +44,7 @@ public: TryCompileCode. The result is stored in OutputFile. If nothing is found, the error message is stored in FindErrorMessage. */ - void FindOutputFile(const char* targetName); + void FindOutputFile(const std::string& targetName); cmTypeMacro(cmCoreTryCompile, cmCommand); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 8d4cf85..1339969 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -537,7 +537,7 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile( // Generate the xml code for one target. void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, - const char* targetName, + const std::string& targetName, cmTarget* target, const char* make, const cmMakefile* makefile, @@ -757,7 +757,8 @@ int cmExtraCodeBlocksGenerator::GetCBTargetType(cmTarget* target) // Create the command line for building the given target using the selected // make std::string cmExtraCodeBlocksGenerator::BuildMakeCommand( - const std::string& make, const char* makefile, const char* target) + const std::string& make, const char* makefile, + const std::string& target) { std::string command = make; if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0) diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h index e0a64ca..1cbc3f3 100644 --- a/Source/cmExtraCodeBlocksGenerator.h +++ b/Source/cmExtraCodeBlocksGenerator.h @@ -49,9 +49,9 @@ private: std::string GetCBCompilerId(const cmMakefile* mf); int GetCBTargetType(cmTarget* target); std::string BuildMakeCommand(const std::string& make, const char* makefile, - const char* target); + const std::string& target); void AppendTarget(cmGeneratedFileStream& fout, - const char* targetName, + const std::string& targetName, cmTarget* target, const char* make, const cmMakefile* makefile, diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 1c9ac02..3cfafa7 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -223,7 +223,7 @@ void cmExtraSublimeTextGenerator:: void cmExtraSublimeTextGenerator:: AppendTarget(cmGeneratedFileStream& fout, - const char* targetName, + const std::string& targetName, cmLocalGenerator* lg, cmTarget* target, const char* make, @@ -315,7 +315,8 @@ void cmExtraSublimeTextGenerator:: // Create the command line for building the given target using the selected // make std::string cmExtraSublimeTextGenerator::BuildMakeCommand( - const std::string& make, const char* makefile, const char* target) + const std::string& make, const char* makefile, + const std::string& target) { std::string command = "\""; command += make + "\""; diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h index 7902593..44dfb31 100644 --- a/Source/cmExtraSublimeTextGenerator.h +++ b/Source/cmExtraSublimeTextGenerator.h @@ -60,12 +60,12 @@ private: * specified target. */ std::string BuildMakeCommand(const std::string& make, const char* makefile, - const char* target); + const std::string& target); /** Appends the specified target to the generated project file as a Sublime * Text build system. */ void AppendTarget(cmGeneratedFileStream& fout, - const char* targetName, + const std::string& targetName, cmLocalGenerator* lg, cmTarget* target, const char* make, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4e7c71e..7f22e00 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -228,7 +228,7 @@ int cmGeneratorTarget::GetType() const } //---------------------------------------------------------------------------- -const char *cmGeneratorTarget::GetName() const +std::string cmGeneratorTarget::GetName() const { return this->Target->GetName(); } @@ -988,7 +988,7 @@ void cmGeneratorTarget::GenerateTargetManifest(const char* config) const bool cmStrictTargetComparison::operator()(cmTarget const* t1, cmTarget const* t2) const { - int nameResult = strcmp(t1->GetName(), t2->GetName()); + int nameResult = strcmp(t1->GetName().c_str(), t2->GetName().c_str()); if (nameResult == 0) { return strcmp(t1->GetMakefile()->GetStartOutputDirectory(), diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 6e19f7d..b15bade 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -27,7 +27,7 @@ public: cmGeneratorTarget(cmTarget*); int GetType() const; - const char *GetName() const; + std::string GetName() const; const char *GetProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void GetSourceFiles(std::vector& files) const; diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 33c43ca..30bec16 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -295,7 +295,7 @@ bool cmGetPropertyCommand::HandleTargetMode() if(cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) { - return this->StoreResult(target->GetName()); + return this->StoreResult(target->GetName().c_str()); } } return this->StoreResult((this->Variable + "-NOTFOUND").c_str()); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 7e93676..795048b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1616,7 +1616,7 @@ void cmGlobalGenerator::CheckLocalGenerators() int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, const char *projectName, - const char *target, bool fast, + const std::string& target, bool fast, std::string *output, cmMakefile *mf) { // if this is not set, then this is a first time configure @@ -1640,7 +1640,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, } std::string newTarget; - if (target && strlen(target)) + if (!target.empty()) { newTarget += target; #if 0 @@ -1664,7 +1664,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, void cmGlobalGenerator::GenerateBuildCommand( std::vector& makeCommand, const char*, const char*, const char*, - const char*, const char*, bool, std::vector const&) + const std::string&, const char*, bool, std::vector const&) { makeCommand.push_back( "cmGlobalGenerator::GenerateBuildCommand not implemented"); @@ -1672,7 +1672,7 @@ void cmGlobalGenerator::GenerateBuildCommand( int cmGlobalGenerator::Build( const char *, const char *bindir, - const char *projectName, const char *target, + const char *projectName, const std::string& target, std::string *output, const char *makeCommandCSTR, const char *config, @@ -1787,7 +1787,7 @@ int cmGlobalGenerator::Build( //---------------------------------------------------------------------------- std::string cmGlobalGenerator::GenerateCMakeBuildCommand( - const char* target, const char* config, const char* native, + const std::string& target, const char* config, const char* native, bool ignoreErrors) { std::string makeCommand = cmSystemTools::GetCMakeCommand(); @@ -1799,7 +1799,7 @@ std::string cmGlobalGenerator::GenerateCMakeBuildCommand( makeCommand += config; makeCommand += "\""; } - if(target && *target) + if(!target.empty()) { makeCommand += " --target \""; makeCommand += target; @@ -2041,7 +2041,7 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap() ///! Find a local generator by its startdirectory cmLocalGenerator* -cmGlobalGenerator::FindLocalGenerator(const char* start_dir) const +cmGlobalGenerator::FindLocalGenerator(const std::string& start_dir) const { for(std::vector::const_iterator it = this->LocalGenerators.begin(); it != this->LocalGenerators.end(); ++it) @@ -2056,20 +2056,20 @@ cmGlobalGenerator::FindLocalGenerator(const char* start_dir) const } //---------------------------------------------------------------------------- -void cmGlobalGenerator::AddAlias(const char *name, cmTarget *tgt) +void cmGlobalGenerator::AddAlias(const std::string& name, cmTarget *tgt) { this->AliasTargets[name] = tgt; } //---------------------------------------------------------------------------- -bool cmGlobalGenerator::IsAlias(const char *name) const +bool cmGlobalGenerator::IsAlias(const std::string& name) const { return this->AliasTargets.find(name) != this->AliasTargets.end(); } //---------------------------------------------------------------------------- cmTarget* -cmGlobalGenerator::FindTarget(const char* project, const char* name, +cmGlobalGenerator::FindTarget(const char* project, const std::string& name, bool excludeAliases) const { // if project specific @@ -2481,7 +2481,7 @@ void cmGlobalGenerator::EnableMinGWLanguage(cmMakefile *mf) //---------------------------------------------------------------------------- cmTarget cmGlobalGenerator::CreateGlobalTarget( - const char* name, const char* message, + const std::string& name, const char* message, const cmCustomCommandLines* commandLines, std::vector depends, const char* workingDirectory) @@ -2672,7 +2672,7 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets, bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target) const { return (target->GetType() == cmTarget::GLOBAL_TARGET || - strcmp(target->GetName(), this->GetAllTargetName()) == 0); + target->GetName() == this->GetAllTargetName()); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 2f23fd5..38d7f58 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -106,7 +106,8 @@ public: * loaded commands, not as part of the usual build process. */ virtual int TryCompile(const char *srcdir, const char *bindir, - const char *projectName, const char *targetName, + const char *projectName, + const std::string& targetName, bool fast, std::string *output, cmMakefile* mf); @@ -117,7 +118,7 @@ public: * done first. */ int Build(const char *srcdir, const char *bindir, - const char *projectName, const char *targetName, + const char *projectName, const std::string& targetName, std::string *output, const char *makeProgram, const char *config, bool clean, bool fast, @@ -130,12 +131,12 @@ public: std::vector& makeCommand, const char* makeProgram, const char *projectName, const char *projectDir, - const char *targetName, const char* config, bool fast, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() ); /** Generate a "cmake --build" call for a given target and config. */ - std::string GenerateCMakeBuildCommand(const char* target, + std::string GenerateCMakeBuildCommand(const std::string& target, const char* config, const char* native, bool ignoreErrors); @@ -210,11 +211,11 @@ public: virtual void FindMakeProgram(cmMakefile*); ///! Find a target by name by searching the local generators. - cmTarget* FindTarget(const char* project, const char* name, + cmTarget* FindTarget(const char* project, const std::string& name, bool excludeAliases = false) const; - void AddAlias(const char *name, cmTarget *tgt); - bool IsAlias(const char *name) const; + void AddAlias(const std::string& name, cmTarget *tgt); + bool IsAlias(const std::string& name) const; /** Determine if a name resolves to a framework on disk or a built target that is a framework. */ @@ -224,7 +225,7 @@ public: target in the project */ bool IsDependedOn(const char* project, cmTarget const* target); ///! Find a local generator by its startdirectory - cmLocalGenerator* FindLocalGenerator(const char* start_dir) const; + cmLocalGenerator* FindLocalGenerator(const std::string& start_dir) const; /** Append the subdirectory for the given configuration. If anything is appended the given prefix and suffix will be appended around it, which @@ -355,7 +356,7 @@ protected: bool IsExcluded(cmLocalGenerator* root, cmTarget const& target) const; void FillLocalGeneratorToTargetMap(); void CreateDefaultGlobalTargets(cmTargets* targets); - cmTarget CreateGlobalTarget(const char* name, const char* message, + cmTarget CreateGlobalTarget(const std::string& name, const char* message, const cmCustomCommandLines* commandLines, std::vector depends, const char* workingDir); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 731bc00..b027995 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -554,7 +554,7 @@ void cmGlobalNinjaGenerator const char* makeProgram, const char* /*projectName*/, const char* /*projectDir*/, - const char* targetName, + const std::string& targetName, const char* /*config*/, bool /*fast*/, std::vector const& makeOptions) @@ -565,9 +565,9 @@ void cmGlobalNinjaGenerator makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); - if(targetName && *targetName) + if(!targetName.empty()) { - if(strcmp(targetName, "clean") == 0) + if(targetName == "clean") { makeCommand.push_back("-t"); makeCommand.push_back("clean"); diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 0d5fb44..41d1510 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -196,7 +196,7 @@ public: const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 0b37a07..74b8e98 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -568,7 +568,7 @@ void cmGlobalUnixMakefileGenerator3 const char* makeProgram, const char* /*projectName*/, const char* /*projectDir*/, - const char* targetName, + const std::string& targetName, const char* /*config*/, bool fast, std::vector const& makeOptions) @@ -585,7 +585,7 @@ void cmGlobalUnixMakefileGenerator3 } makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); - if ( targetName && strlen(targetName)) + if (!targetName.empty()) { cmLocalUnixMakefileGenerator3 *lg; if (this->LocalGenerators.size()) @@ -649,8 +649,7 @@ cmGlobalUnixMakefileGenerator3 } // Don't emit the same rule twice (e.g. two targets with the same // simple name) - if(t->second->GetName() && - strlen(t->second->GetName()) && + if(!t->second->GetName().empty() && emitted.insert(t->second->GetName()).second && // Handle user targets here. Global targets are handled in // the local generator on a per-directory basis. @@ -746,8 +745,7 @@ cmGlobalUnixMakefileGenerator3 { continue; } - if (t->second->GetName() - && strlen(t->second->GetName()) + if (!t->second->GetName().empty() && ((t->second->GetType() == cmTarget::EXECUTABLE) || (t->second->GetType() == cmTarget::STATIC_LIBRARY) || (t->second->GetType() == cmTarget::SHARED_LIBRARY) @@ -975,7 +973,7 @@ cmGlobalUnixMakefileGenerator3::ProgressMapCompare ::operator()(cmTarget const* l, cmTarget const* r) const { // Order by target name. - if(int c = strcmp(l->GetName(), r->GetName())) + if(int c = strcmp(l->GetName().c_str(), r->GetName().c_str())) { return c < 0; } diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 9173751..f97ae9b 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -112,7 +112,7 @@ public: const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 6983ef9..1346e13 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -313,7 +313,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions) @@ -369,25 +369,26 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( makeCommand.push_back(makeProgramSelected); + std::string realTarget = targetName; // msbuild.exe CxxOnly.sln /t:Build /p:Configuration=Debug /target:ALL_BUILD - if(!targetName || strlen(targetName) == 0) + if(realTarget.empty()) { - targetName = "ALL_BUILD"; + realTarget = "ALL_BUILD"; } - if ( targetName && strcmp(targetName, "clean") == 0 ) + if ( realTarget == "clean" ) { makeCommand.push_back(std::string(projectName)+".sln"); makeCommand.push_back("/t:Clean"); } else { - std::string targetProject(targetName); + std::string targetProject(realTarget); targetProject += ".vcxproj"; if (targetProject.find('/') == std::string::npos) { // it might be in a subdir if (cmSlnProjectEntry const* proj = - slnData.GetProjectByName(targetName)) + slnData.GetProjectByName(realTarget)) { targetProject = proj->GetRelativePath(); cmSystemTools::ConvertToUnixSlashes(targetProject); diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 976d41f..198e113 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -37,7 +37,7 @@ public: const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 6c458c3..534a493 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -119,7 +119,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( const char* makeProgram, const char* projectName, const char* /*projectDir*/, - const char* targetName, + const std::string& targetName, const char* config, bool /*fast*/, std::vector const& makeOptions @@ -134,14 +134,15 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( makeCommand.push_back("/MAKE"); std::string targetArg; bool clean = false; - if ( targetName && strcmp(targetName, "clean") == 0 ) + std::string realTarget = targetName; + if ( realTarget == "clean" ) { clean = true; - targetName = "ALL_BUILD"; + realTarget = "ALL_BUILD"; } - if (targetName && strlen(targetName)) + if (!realTarget.empty()) { - targetArg += targetName; + targetArg += realTarget; } else { diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 5521410..40b8462 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -57,7 +57,7 @@ public: const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index bb63289..5c7af00 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -186,7 +186,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( const char* makeProgram, const char* projectName, const char* /*projectDir*/, - const char* targetName, + const std::string& targetName, const char* config, bool /*fast*/, std::vector const& makeOptions) @@ -208,11 +208,12 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( makeCommand.push_back(makeProgramSelected); makeCommand.push_back(std::string(projectName) + ".sln"); + std::string realTarget = targetName; bool clean = false; - if ( targetName && strcmp(targetName, "clean") == 0 ) + if ( realTarget == "clean" ) { clean = true; - targetName = "ALL_BUILD"; + realTarget = "ALL_BUILD"; } if(clean) { @@ -233,9 +234,9 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( } makeCommand.push_back("/project"); - if (targetName && strlen(targetName)) + if (!realTarget.empty()) { - makeCommand.push_back(targetName); + makeCommand.push_back(realTarget); } else { @@ -381,7 +382,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( std::set allConfigurations(this->Configurations.begin(), this->Configurations.end()); this->WriteProjectConfigurations( - fout, target->GetName(), target->GetType(), + fout, target->GetName().c_str(), target->GetType(), allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING")); } else diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index f69bd84..a7aca60 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -65,7 +65,7 @@ public: const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 12c240b..0453333 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -426,7 +426,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends( { continue; } - std::string guid = this->GetGUID((*i)->GetName()); + std::string guid = this->GetGUID((*i)->GetName().c_str()); fout << "\t\t{" << guid << "} = {" << guid << "}\n"; } } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 0c5f35b..d388034 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -870,15 +870,15 @@ cmGlobalVisualStudioGenerator::TargetCompare ::operator()(cmTarget const* l, cmTarget const* r) const { // Make sure ALL_BUILD is first so it is the default active project. - if(strcmp(r->GetName(), "ALL_BUILD") == 0) + if(r->GetName() == "ALL_BUILD") { return false; } - if(strcmp(l->GetName(), "ALL_BUILD") == 0) + if(l->GetName() == "ALL_BUILD") { return true; } - return strcmp(l->GetName(), r->GetName()) < 0; + return strcmp(l->GetName().c_str(), r->GetName().c_str()) < 0; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 4b73118..b1fa838 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -104,8 +104,8 @@ protected: VSDependMap VSTargetDepends; void ComputeVSTargetDepends(cmTarget&); - bool CheckTargetLinks(cmTarget& target, const char* name); - std::string GetUtilityForTarget(cmTarget& target, const char*); + bool CheckTargetLinks(cmTarget& target, const std::string& name); + std::string GetUtilityForTarget(cmTarget& target, const std::string&); virtual std::string WriteUtilityDepend(cmTarget const*) = 0; std::string GetUtilityDepend(cmTarget const* target); typedef std::map UtilityDependsMap; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 3f24167..9e1e902 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -263,7 +263,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( const char* makeProgram, const char* projectName, const char* /*projectDir*/, - const char* targetName, + const std::string& targetName, const char* config, bool /*fast*/, std::vector const& makeOptions) @@ -283,10 +283,11 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( makeCommand.push_back(projectArg); bool clean = false; - if ( targetName && strcmp(targetName, "clean") == 0 ) + std::string realTarget = targetName; + if ( realTarget == "clean" ) { clean = true; - targetName = "ALL_BUILD"; + realTarget = "ALL_BUILD"; } if(clean) { @@ -302,9 +303,9 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( { config = 0; } - if (targetName && strlen(targetName)) + if (!realTarget.empty()) { - makeCommand.push_back(targetName); + makeCommand.push_back(realTarget); } else { @@ -1737,7 +1738,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target.GetName()); + target.GetName().c_str()); return; } @@ -2420,7 +2421,7 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) cmXCodeObject* target = this->CreateObject(cmXCodeObject::PBXAggregateTarget); - target->SetComment(cmtarget.GetName()); + target->SetComment(cmtarget.GetName().c_str()); cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST); std::vector emptyContentVector; @@ -2621,7 +2622,7 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget, fileRef->AddAttribute("refType", this->CreateString("0")); fileRef->AddAttribute("sourceTree", this->CreateString("BUILT_PRODUCTS_DIR")); - fileRef->SetComment(cmtarget.GetName()); + fileRef->SetComment(cmtarget.GetName().c_str()); target->AddAttribute("productReference", this->CreateObjectReference(fileRef)); if(const char* productType = this->GetTargetProductType(cmtarget)) @@ -2654,8 +2655,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(cmTarget const* t) } //---------------------------------------------------------------------------- -std::string cmGlobalXCodeGenerator::GetOrCreateId(const char* name, - const char* id) +std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name, + const std::string& id) { std::string guidStoreName = name; guidStoreName += "_GUID_CMAKE"; @@ -2668,7 +2669,7 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const char* name, } this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(), - id, "Stored Xcode object GUID", cmCacheManager::INTERNAL); + id.c_str(), "Stored Xcode object GUID", cmCacheManager::INTERNAL); return id; } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 15f1363..0cb1758 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -58,7 +58,7 @@ public: const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() @@ -129,7 +129,7 @@ private: ); cmXCodeObject* FindXCodeTarget(cmTarget const*); - std::string GetOrCreateId(const char* name, const char* id); + std::string GetOrCreateId(const std::string& name, const std::string& id); // create cmXCodeObject from these functions so that memory can be managed // correctly. All objects created are stored in this->XCodeObjects. diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index db964a9..6173d21 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -300,7 +300,7 @@ void cmGraphVizWriter::WriteFooter(cmGeneratedFileStream& str) const } -void cmGraphVizWriter::WriteConnections(const char* targetName, +void cmGraphVizWriter::WriteConnections(const std::string& targetName, std::set& insertedNodes, std::set& insertedConnections, cmGeneratedFileStream& str) const @@ -359,7 +359,7 @@ void cmGraphVizWriter::WriteConnections(const char* targetName, } -void cmGraphVizWriter::WriteDependerConnections(const char* targetName, +void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName, std::set& insertedNodes, std::set& insertedConnections, cmGeneratedFileStream& str) const @@ -444,7 +444,7 @@ void cmGraphVizWriter::WriteDependerConnections(const char* targetName, } -void cmGraphVizWriter::WriteNode(const char* targetName, +void cmGraphVizWriter::WriteNode(const std::string& targetName, const cmTarget* target, std::set& insertedNodes, cmGeneratedFileStream& str) const @@ -558,7 +558,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt) } -bool cmGraphVizWriter::IgnoreThisTarget(const char* name) +bool cmGraphVizWriter::IgnoreThisTarget(const std::string& name) { for(std::vector::iterator itvIt = this->TargetsToIgnoreRegex.begin(); diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index 17b97f8..6af460b 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -44,23 +44,23 @@ protected: void WriteHeader(cmGeneratedFileStream& str) const; - void WriteConnections(const char* targetName, + void WriteConnections(const std::string& targetName, std::set& insertedNodes, std::set& insertedConnections, cmGeneratedFileStream& str) const; - void WriteDependerConnections(const char* targetName, + void WriteDependerConnections(const std::string& targetName, std::set& insertedNodes, std::set& insertedConnections, cmGeneratedFileStream& str) const; - void WriteNode(const char* targetName, const cmTarget* target, + void WriteNode(const std::string& targetName, const cmTarget* target, std::set& insertedNodes, cmGeneratedFileStream& str) const; void WriteFooter(cmGeneratedFileStream& str) const; - bool IgnoreThisTarget(const char* name); + bool IgnoreThisTarget(const std::string& name); bool GenerateForTargetType(cmTarget::TargetType targetType) const; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e1abfef..ded4fc6 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -781,7 +781,7 @@ void cmLocalGenerator { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target.Target->GetName()); + target.Target->GetName().c_str()); return; } // if the language is not in the set lang then create custom @@ -1695,7 +1695,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target->Target->GetName()); + target->Target->GetName().c_str()); return; } this->AddLanguageFlags(flags, linkLanguage, buildType.c_str()); @@ -2012,7 +2012,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, } //---------------------------------------------------------------------------- -bool cmLocalGenerator::GetRealDependency(const char* inName, +bool cmLocalGenerator::GetRealDependency(const std::string& inName, const char* config, std::string& dep) { @@ -2040,7 +2040,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, { // make sure it is not just a coincidence that the target name // found is part of the inName - if(cmSystemTools::FileIsFullPath(inName)) + if(cmSystemTools::FileIsFullPath(inName.c_str())) { std::string tLocation; if(target->GetType() >= cmTarget::EXECUTABLE && @@ -2088,7 +2088,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, } // The name was not that of a CMake target. It must name a file. - if(cmSystemTools::FileIsFullPath(inName)) + if(cmSystemTools::FileIsFullPath(inName.c_str())) { // This is a full path. Return it as given. dep = inName; @@ -3474,7 +3474,7 @@ static void cmLGInfoProp(cmMakefile* mf, cmTarget* target, //---------------------------------------------------------------------------- void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target, - const char* targetName, + const std::string& targetName, const char* fname) { // Find the Info.plist template. @@ -3503,7 +3503,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target, // back to the directory-level values set by the user. cmMakefile* mf = this->Makefile; mf->PushScope(); - mf->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", targetName); + mf->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", targetName.c_str()); cmLGInfoProp(mf, target, "MACOSX_BUNDLE_INFO_STRING"); cmLGInfoProp(mf, target, "MACOSX_BUNDLE_ICON_FILE"); cmLGInfoProp(mf, target, "MACOSX_BUNDLE_GUI_IDENTIFIER"); @@ -3518,8 +3518,8 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target, //---------------------------------------------------------------------------- void cmLocalGenerator::GenerateFrameworkInfoPList(cmTarget* target, - const char* targetName, - const char* fname) + const std::string& targetName, + const char* fname) { // Find the Info.plist template. const char* in = target->GetProperty("MACOSX_FRAMEWORK_INFO_PLIST"); @@ -3547,7 +3547,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(cmTarget* target, // back to the directory-level values set by the user. cmMakefile* mf = this->Makefile; mf->PushScope(); - mf->AddDefinition("MACOSX_FRAMEWORK_NAME", targetName); + mf->AddDefinition("MACOSX_FRAMEWORK_NAME", targetName.c_str()); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_ICON_FILE"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_IDENTIFIER"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_SHORT_VERSION_STRING"); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 182b783..c1deb09 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -195,7 +195,7 @@ public: * the source directory of this generator. This should only be * used for dependencies of custom commands. */ - bool GetRealDependency(const char* name, const char* config, + bool GetRealDependency(const std::string& name, const char* config, std::string& dep); ///! for existing files convert to output path and short path if spaces @@ -339,14 +339,14 @@ public: /** * Generate a Mac OS X application bundle Info.plist file. */ - void GenerateAppleInfoPList(cmTarget* target, const char* targetName, + void GenerateAppleInfoPList(cmTarget* target, const std::string& targetName, const char* fname); /** * Generate a Mac OS X framework Info.plist file. */ void GenerateFrameworkInfoPList(cmTarget* target, - const char* targetName, + const std::string& targetName, const char* fname); /** Construct a comment for a custom command. */ std::string ConstructComment(const cmCustomCommand& cc, diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 11b89f4..f47ea29 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -550,14 +550,14 @@ void cmLocalUnixMakefileGenerator3 ::WriteMakeRule(std::ostream& os, const char* comment, - const char* target, + const std::string& target, const std::vector& depends, const std::vector& commands, bool symbolic, bool in_help) { // Make sure there is a target. - if(!target || !*target) + if(target.empty()) { cmSystemTools::Error("No target for WriteMakeRule! called with comment: ", comment); @@ -859,11 +859,11 @@ void cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3 ::WriteConvenienceRule(std::ostream& ruleFileStream, - const char* realTarget, - const char* helpTarget) + const std::string& realTarget, + const std::string& helpTarget) { // A rule is only needed if the names are different. - if(strcmp(realTarget, helpTarget) != 0) + if(realTarget != helpTarget) { // The helper target depends on the real target. std::vector depends; @@ -2034,7 +2034,7 @@ void cmLocalUnixMakefileGenerator3::WriteDisclaimer(std::ostream& os) //---------------------------------------------------------------------------- std::string cmLocalUnixMakefileGenerator3 -::GetRecursiveMakeCall(const char *makefile, const char* tgt) +::GetRecursiveMakeCall(const char *makefile, const std::string& tgt) { // Call make on the given file. std::string cmd; @@ -2059,7 +2059,7 @@ cmLocalUnixMakefileGenerator3 } // Add the target. - if (tgt && tgt[0] != '\0') + if (!tgt.empty()) { // The make target is always relative to the top of the build tree. std::string tgt2 = this->Convert(tgt, HOME_OUTPUT); diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index b0ccf52..2ad5250 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -55,7 +55,7 @@ public: // Write out a make rule void WriteMakeRule(std::ostream& os, const char* comment, - const char* target, + const std::string& target, const std::vector& depends, const std::vector& commands, bool symbolic, @@ -168,7 +168,8 @@ public: void WriteDivider(std::ostream& os); /** used to create a recursive make call */ - std::string GetRecursiveMakeCall(const char *makefile, const char* tgt); + std::string GetRecursiveMakeCall(const char *makefile, + const std::string& tgt); // append flags to a string virtual void AppendFlags(std::string& flags, const char* newFlags); @@ -273,8 +274,8 @@ protected: void WriteConvenienceRule(std::ostream& ruleFileStream, - const char* realTarget, - const char* helpTarget); + const std::string& realTarget, + const std::string& helpTarget); void WriteTargetDependRule(std::ostream& ruleFileStream, cmTarget& target); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index ff217c3..88206f1 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -186,7 +186,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() // extern std::string GetVS6TargetName(const std::string& targetName); -void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname, +void cmLocalVisualStudio6Generator::CreateSingleDSP(const std::string& lname, cmTarget &target) { // add to the list of projects @@ -263,7 +263,7 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, - const char *libName, + const std::string& libName, cmTarget &target) { // For utility targets need custom command since pre- and post- @@ -372,7 +372,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, void cmLocalVisualStudio6Generator ::WriteGroup(const cmSourceGroup *sg, cmTarget& target, - std::ostream &fout, const char *libName) + std::ostream &fout, const std::string& libName) { cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&target); @@ -572,9 +572,9 @@ cmLocalVisualStudio6Generator { // Create a fake output that forces the rule to run. char* output = new char[(strlen(this->Makefile->GetStartOutputDirectory()) + - strlen(target.GetName()) + 30)]; + target.GetName().size() + 30)]; sprintf(output,"%s/%s_force_%i", this->Makefile->GetStartOutputDirectory(), - target.GetName(), count); + target.GetName().c_str(), count); std::string comment = this->ConstructComment(origCommand, ""); // Add the rule with the given dependencies and commands. @@ -699,7 +699,7 @@ void cmLocalVisualStudio6Generator::WriteDSPEndGroup(std::ostream& fout) void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, - const char* libName, + const std::string& libName, cmTarget& target) { std::string root= this->Makefile->GetRequiredDefinition("CMAKE_ROOT"); @@ -813,8 +813,8 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target, // look for custom rules on a target and collect them together std::string cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, - const char* configName, - const char * /* libName */) + const char* configName, + const std::string& /* libName */) { if (target.GetType() >= cmTarget::UTILITY ) { @@ -926,7 +926,7 @@ cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target, void cmLocalVisualStudio6Generator ::WriteDSPHeader(std::ostream& fout, - const char *libName, cmTarget &target, + const std::string& libName, cmTarget &target, std::vector &) { bool targetBuilds = (target.GetType() >= cmTarget::EXECUTABLE && @@ -1257,7 +1257,7 @@ void cmLocalVisualStudio6Generator { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target.GetName()); + target.GetName().c_str()); return; } @@ -1679,7 +1679,7 @@ void cmLocalVisualStudio6Generator { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target.GetName()); + target.GetName().c_str()); return; } // if CXX is on and the target contains cxx code then add the cxx flags diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index f45bc17..6702111 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -48,7 +48,7 @@ public: /** * Specify the type of the build: static, dll, or executable. */ - void SetBuildType(BuildType, const char* libName, cmTarget&); + void SetBuildType(BuildType, const std::string& libName, cmTarget&); virtual std::string GetTargetDirectory(cmTarget const& target) const; virtual std::string ComputeLongestObjectDirectory(cmTarget&) const; @@ -56,15 +56,15 @@ private: std::string DSPHeaderTemplate; std::string DSPFooterTemplate; - void CreateSingleDSP(const char *lname, cmTarget &tgt); - void WriteDSPFile(std::ostream& fout, const char *libName, + void CreateSingleDSP(const std::string& lname, cmTarget &tgt); + void WriteDSPFile(std::ostream& fout, const std::string& libName, cmTarget &tgt); void WriteDSPBeginGroup(std::ostream& fout, const char* group, const char* filter); void WriteDSPEndGroup(std::ostream& fout); - void WriteDSPHeader(std::ostream& fout, const char *libName, + void WriteDSPHeader(std::ostream& fout, const std::string& libName, cmTarget &tgt, std::vector &sgs); void WriteDSPFooter(std::ostream& fout); @@ -77,14 +77,14 @@ private: std::vector& depends, const cmCustomCommand& origCommand); void WriteGroup(const cmSourceGroup *sg, cmTarget& target, - std::ostream &fout, const char *libName); + std::ostream &fout, const std::string& libName); class EventWriter; friend class EventWriter; cmsys::auto_ptr MaybeCreateOutputDir(cmTarget& target, const char* config); std::string CreateTargetRules(cmTarget &target, const char* configName, - const char *libName); + const std::string& libName); void ComputeLinkOptions(cmTarget& target, const char* configName, const std::string extraOptions, std::string& options); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index f93a7aa..786791c 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -83,7 +83,7 @@ void cmLocalVisualStudio7Generator::AddHelperCommands() if(path) { this->ReadAndStoreExternalGUID( - l->second.GetName(), path); + l->second.GetName().c_str(), path); } else { @@ -334,8 +334,8 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() } void cmLocalVisualStudio7Generator::WriteConfigurations(std::ostream& fout, - const char *libName, - cmTarget &target) + const std::string& libName, + cmTarget &target) { std::vector *configs = static_cast @@ -637,9 +637,9 @@ private: //---------------------------------------------------------------------------- void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, - const char* configName, - const char *libName, - cmTarget &target) + const char* configName, + const std::string& libName, + cmTarget &target) { const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG"); if(!mfcFlag) @@ -694,7 +694,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target.GetName()); + target.GetName().c_str()); return; } if(linkLanguage == "C" || linkLanguage == "CXX" @@ -1380,7 +1380,7 @@ cmLocalVisualStudio7Generator } void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, - const char *libName, + const std::string& libName, cmTarget &target) { // get the configurations @@ -1627,7 +1627,7 @@ cmLocalVisualStudio7Generator bool cmLocalVisualStudio7Generator ::WriteGroup(const cmSourceGroup *sg, cmTarget& target, - std::ostream &fout, const char *libName, + std::ostream &fout, const std::string& libName, std::vector *configs) { const std::vector &sourceFiles = @@ -1906,7 +1906,7 @@ void cmLocalVisualStudio7Generator ::OutputTargetRules(std::ostream& fout, const char* configName, cmTarget &target, - const char * /*libName*/) + const std::string& /*libName*/) { if (target.GetType() > cmTarget::GLOBAL_TARGET) { @@ -1966,7 +1966,7 @@ void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout, void cmLocalVisualStudio7Generator ::WriteProjectStartFortran(std::ostream& fout, - const char *libName, + const std::string& libName, cmTarget & target) { @@ -2017,7 +2017,7 @@ cmLocalVisualStudio7Generator } this->WriteProjectSCC(fout, target); fout<< "\tKeyword=\"" << keyword << "\">\n" - << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n" + << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\">\n" << "\t\n" << "\t\tPlatformName << "\"/>\n" << "\t\n"; @@ -2026,7 +2026,7 @@ cmLocalVisualStudio7Generator void cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, - const char *libName, + const std::string& libName, cmTarget & target, std::vector &) { @@ -2049,7 +2049,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, const char* projLabel = target.GetProperty("PROJECT_LABEL"); if(!projLabel) { - projLabel = libName; + projLabel = libName.c_str(); } const char* keyword = target.GetProperty("VS_KEYWORD"); if(!keyword) @@ -2061,7 +2061,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, fout << "\tName=\"" << projLabel << "\"\n"; if(this->Version >= VS8) { - fout << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\"\n"; + fout << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\"\n"; } this->WriteProjectSCC(fout, target); if(const char* targetFrameworkVersion = diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 92e4d3c..4d72747 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -74,29 +74,29 @@ private: const char* configName); void FixGlobalTargets(); void WriteProjectFiles(); - void WriteVCProjHeader(std::ostream& fout, const char *libName, + void WriteVCProjHeader(std::ostream& fout, const std::string& libName, cmTarget &tgt, std::vector &sgs); void WriteVCProjFooter(std::ostream& fout, cmTarget &target); - void WriteVCProjFile(std::ostream& fout, const char *libName, + void WriteVCProjFile(std::ostream& fout, const std::string& libName, cmTarget &tgt); void WriteConfigurations(std::ostream& fout, - const char *libName, cmTarget &tgt); + const std::string& libName, cmTarget &tgt); void WriteConfiguration(std::ostream& fout, const char* configName, - const char* libName, cmTarget &tgt); + const std::string& libName, cmTarget &tgt); std::string EscapeForXML(const char* s); std::string ConvertToXMLOutputPath(const char* path); std::string ConvertToXMLOutputPathSingle(const char* path); void OutputTargetRules(std::ostream& fout, const char* configName, - cmTarget &target, const char *libName); + cmTarget &target, const std::string& libName); void OutputBuildTool(std::ostream& fout, const char* configName, cmTarget& t, const Options& targetOptions); void OutputLibraryDirectories(std::ostream& fout, std::vector const& dirs); void WriteProjectSCC(std::ostream& fout, cmTarget& target); - void WriteProjectStart(std::ostream& fout, const char *libName, + void WriteProjectStart(std::ostream& fout, const std::string& libName, cmTarget &tgt, std::vector &sgs); - void WriteProjectStartFortran(std::ostream& fout, const char *libName, + void WriteProjectStartFortran(std::ostream& fout, const std::string& libName, cmTarget &tgt); void WriteVCProjBeginGroup(std::ostream& fout, const char* group, @@ -111,7 +111,8 @@ private: bool WriteGroup(const cmSourceGroup *sg, cmTarget& target, std::ostream &fout, - const char *libName, std::vector *configs); + const std::string& libName, + std::vector *configs); friend class cmLocalVisualStudio7GeneratorFCInfo; friend class cmLocalVisualStudio7GeneratorInternals; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8274b13..7215e76 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -878,7 +878,7 @@ void cmMakefile::ConfigureFinalPass() //---------------------------------------------------------------------------- void -cmMakefile::AddCustomCommandToTarget(const char* target, +cmMakefile::AddCustomCommandToTarget(const std::string& target, const std::vector& depends, const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type, @@ -1120,7 +1120,7 @@ cmMakefile::AddCustomCommandToOutput(const char* output, //---------------------------------------------------------------------------- void -cmMakefile::AddCustomCommandOldStyle(const char* target, +cmMakefile::AddCustomCommandOldStyle(const std::string& target, const std::vector& outputs, const std::vector& depends, const char* source, @@ -1129,7 +1129,7 @@ cmMakefile::AddCustomCommandOldStyle(const char* target, { // Translate the old-style signature to one of the new-style // signatures. - if(strcmp(source, target) == 0) + if(source == target) { // In the old-style signature if the source and target were the // same then it added a post-build rule to the target. Preserve @@ -1179,7 +1179,8 @@ cmMakefile::AddCustomCommandOldStyle(const char* target, else { cmSystemTools::Error("Attempt to add a custom rule to a target " - "that does not exist yet for target ", target); + "that does not exist yet for target ", + target.c_str()); return; } } @@ -1453,7 +1454,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) return true; } -void cmMakefile::AddLinkLibrary(const char* lib, +void cmMakefile::AddLinkLibrary(const std::string& lib, cmTarget::LinkLibraryType llt) { cmTarget::LibraryID tmp; @@ -1462,8 +1463,8 @@ void cmMakefile::AddLinkLibrary(const char* lib, this->LinkLibraries.push_back(tmp); } -void cmMakefile::AddLinkLibraryForTarget(const char *target, - const char* lib, +void cmMakefile::AddLinkLibraryForTarget(const std::string& target, + const std::string& lib, cmTarget::LinkLibraryType llt) { cmTargets::iterator i = this->Targets.find(target); @@ -1500,8 +1501,8 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target, } } -void cmMakefile::AddLinkDirectoryForTarget(const char *target, - const char* d) +void cmMakefile::AddLinkDirectoryForTarget(const std::string& target, + const std::string& d) { cmTargets::iterator i = this->Targets.find(target); if ( i != this->Targets.end()) @@ -1520,46 +1521,37 @@ void cmMakefile::AddLinkDirectoryForTarget(const char *target, { cmSystemTools::Error ("Attempt to add link directories to non-existent target: ", - target, " for directory ", d); + target.c_str(), " for directory ", d.c_str()); } } -void cmMakefile::AddLinkLibrary(const char* lib) +void cmMakefile::AddLinkLibrary(const std::string& lib) { this->AddLinkLibrary(lib,cmTarget::GENERAL); } -void cmMakefile::AddLinkDirectory(const char* dir) +void cmMakefile::AddLinkDirectory(const std::string& dir) { // Don't add a link directory that is already present. Yes, this // linear search results in n^2 behavior, but n won't be getting // much bigger than 20. We cannot use a set because of order // dependency of the link search path. - if(!dir) + if(dir.empty()) { return; } + std::string newdir = dir; // remove trailing slashes - if(dir[strlen(dir)-1] == '/') + if(*dir.rbegin() == '/') { - std::string newdir = dir; - newdir = newdir.substr(0, newdir.size()-1); - if(std::find(this->LinkDirectories.begin(), - this->LinkDirectories.end(), - newdir.c_str()) == this->LinkDirectories.end()) - { - this->LinkDirectories.push_back(newdir); - } + newdir = dir.substr(0, dir.size()-1); } - else + if(std::find(this->LinkDirectories.begin(), + this->LinkDirectories.end(), newdir) + == this->LinkDirectories.end()) { - if(std::find(this->LinkDirectories.begin(), - this->LinkDirectories.end(), dir) - == this->LinkDirectories.end()) - { - this->LinkDirectories.push_back(dir); - } + this->LinkDirectories.push_back(dir); } } @@ -1975,7 +1967,8 @@ void cmMakefile::SetProjectName(const char* p) } -void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target) +void cmMakefile::AddGlobalLinkInformation(const std::string& name, + cmTarget& target) { // for these targets do not add anything switch(target.GetType()) @@ -1996,13 +1989,14 @@ void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target) } -void cmMakefile::AddAlias(const char* lname, cmTarget *tgt) +void cmMakefile::AddAlias(const std::string& lname, cmTarget *tgt) { this->AliasTargets[lname] = tgt; this->LocalGenerator->GetGlobalGenerator()->AddAlias(lname, tgt); } -cmTarget* cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type, +cmTarget* cmMakefile::AddLibrary(const std::string& lname, + cmTarget::TargetType type, const std::vector &srcs, bool excludeFromAll) { @@ -2048,7 +2042,7 @@ cmTarget* cmMakefile::AddExecutable(const char *exeName, //---------------------------------------------------------------------------- cmTarget* -cmMakefile::AddNewTarget(cmTarget::TargetType type, const char* name) +cmMakefile::AddNewTarget(cmTarget::TargetType type, const std::string& name) { cmTargets::iterator it = this->Targets.insert(cmTargets::value_type(name, cmTarget())).first; @@ -3066,7 +3060,8 @@ void cmMakefile::ExpandSourceListArguments( } int cmMakefile::TryCompile(const char *srcdir, const char *bindir, - const char *projectName, const char *targetName, + const char *projectName, + const std::string& targetName, bool fast, const std::vector *cmakeArgs, std::string *output) @@ -4030,7 +4025,8 @@ void cmMakefile::DefineProperties(cmake *cm) //---------------------------------------------------------------------------- cmTarget* -cmMakefile::AddImportedTarget(const char* name, cmTarget::TargetType type, +cmMakefile::AddImportedTarget(const std::string& name, + cmTarget::TargetType type, bool global) { // Create the target. @@ -4087,7 +4083,7 @@ bool cmMakefile::IsAlias(const std::string& name) const //---------------------------------------------------------------------------- cmGeneratorTarget* -cmMakefile::FindGeneratorTargetToUse(const char* name) const +cmMakefile::FindGeneratorTargetToUse(const std::string& name) const { if (cmTarget *t = this->FindTargetToUse(name)) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 331a064..aa25f09 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -127,7 +127,7 @@ public: * loaded commands, not as part of the usual build process. */ int TryCompile(const char *srcdir, const char *bindir, - const char *projectName, const char *targetName, + const char *projectName, const std::string& targetName, bool fast, const std::vector *cmakeArgs, std::string *output); @@ -168,7 +168,7 @@ public: void Print() const; /** Add a custom command to the build. */ - void AddCustomCommandToTarget(const char* target, + void AddCustomCommandToTarget(const std::string& target, const std::vector& depends, const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type, @@ -190,7 +190,7 @@ public: const char* comment, const char* workingDir, bool replace = false, bool escapeOldStyle = true); - void AddCustomCommandOldStyle(const char* target, + void AddCustomCommandOldStyle(const std::string& target, const std::vector& outputs, const std::vector& depends, const char* source, @@ -205,10 +205,11 @@ public: void AddCompileOption(const char* option); /** Create a new imported target with the name and type given. */ - cmTarget* AddImportedTarget(const char* name, cmTarget::TargetType type, + cmTarget* AddImportedTarget(const std::string& name, + cmTarget::TargetType type, bool global); - cmTarget* AddNewTarget(cmTarget::TargetType type, const char* name); + cmTarget* AddNewTarget(cmTarget::TargetType type, const std::string& name); /** * Add an executable to the build. @@ -239,16 +240,16 @@ public: /** * Add a link library to the build. */ - void AddLinkLibrary(const char*); - void AddLinkLibrary(const char*, cmTarget::LinkLibraryType type); - void AddLinkLibraryForTarget(const char *tgt, const char*, + void AddLinkLibrary(const std::string&); + void AddLinkLibrary(const std::string&, cmTarget::LinkLibraryType type); + void AddLinkLibraryForTarget(const std::string& tgt, const std::string&, cmTarget::LinkLibraryType type); - void AddLinkDirectoryForTarget(const char *tgt, const char* d); + void AddLinkDirectoryForTarget(const std::string& tgt, const std::string& d); /** * Add a link directory to the build. */ - void AddLinkDirectory(const char*); + void AddLinkDirectory(const std::string&); const std::vector& GetLinkDirectories() const { @@ -323,10 +324,10 @@ public: /** * Set the name of the library. */ - cmTarget* AddLibrary(const char *libname, cmTarget::TargetType type, + cmTarget* AddLibrary(const std::string& libname, cmTarget::TargetType type, const std::vector &srcs, bool excludeFromAll = false); - void AddAlias(const char *libname, cmTarget *tgt); + void AddAlias(const std::string& libname, cmTarget *tgt); #if defined(CMAKE_BUILD_WITH_CMAKE) /** @@ -534,7 +535,7 @@ public: cmTarget* FindTargetToUse(const std::string& name, bool excludeAliases = false) const; bool IsAlias(const std::string& name) const; - cmGeneratorTarget* FindGeneratorTargetToUse(const char* name) const; + cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const; /** * Mark include directories as system directories. @@ -878,7 +879,7 @@ public: protected: // add link libraries and directories to the target - void AddGlobalLinkInformation(const char* name, cmTarget& target); + void AddGlobalLinkInformation(const std::string& name, cmTarget& target); // Check for a an unused variable void CheckForUnused(const char* reason, const std::string& name) const; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index b827363..ca8ff06 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -167,7 +167,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) if(linkLanguage.empty()) { cmSystemTools::Error("Cannot determine link language for target \"", - this->Target->GetName(), "\"."); + this->Target->GetName().c_str(), "\"."); return; } diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 96159f9..d9425e6 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -125,7 +125,7 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules() depends, commands, true); // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(this->Target->GetName(), false); + this->WriteTargetDriverRule(this->Target->GetName().c_str(), false); } //---------------------------------------------------------------------------- @@ -243,7 +243,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules if(linkLanguage.empty()) { cmSystemTools::Error("Cannot determine link language for target \"", - this->Target->GetName(), "\"."); + this->Target->GetName().c_str(), "\"."); return; } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 3ba5a77..fb9b045 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1347,7 +1347,7 @@ cmMakefileTargetGenerator // Write a make variable assignment that lists all objects for the // target. variableName = - this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), + this->LocalGenerator->CreateMakeVariable(this->Target->GetName().c_str(), "_OBJECTS"); *this->BuildFileStream << "# Object files for target " << this->Target->GetName() << "\n" @@ -1382,7 +1382,7 @@ cmMakefileTargetGenerator // Write a make variable assignment that lists all external objects // for the target. variableNameExternal = - this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), + this->LocalGenerator->CreateMakeVariable(this->Target->GetName().c_str(), "_EXTERNAL_OBJECTS"); *this->BuildFileStream << "\n" @@ -1683,7 +1683,7 @@ void cmMakefileTargetGenerator //---------------------------------------------------------------------------- std::string cmMakefileTargetGenerator::GetLinkRule( - const cmStdString& linkRuleVar) + const std::string& linkRuleVar) { std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar); if(this->Target->HasImplibGNUtoMS()) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index baae2b0..d2cbadd 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -138,7 +138,7 @@ protected: void AppendLinkDepends(std::vector& depends); // Lookup the link rule for this target. - std::string GetLinkRule(const cmStdString& linkRuleVar); + std::string GetLinkRule(const std::string& linkRuleVar); /** In order to support parallel builds for custom commands with multiple outputs the outputs are given a serial order, and only diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 7751ad9..2066fc2 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -105,7 +105,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() depends, commands, true); // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(this->Target->GetName(), false); + this->WriteTargetDriverRule(this->Target->GetName().c_str(), false); // Write clean target this->WriteTargetCleanRules(); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index b81fbeb..502127e 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -75,7 +75,7 @@ void cmNinjaNormalTargetGenerator::Generate() if (this->TargetLinkLanguage.empty()) { cmSystemTools::Error("CMake can not determine linker language for " "target: ", - this->GetTarget()->GetName()); + this->GetTarget()->GetName().c_str()); return; } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index d940fe2..e075c54 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -772,7 +772,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, makefile->AddDefinition("_qt_uic_options_options", cmLocalGenerator::EscapeForCMake(uiFileOptions.c_str()).c_str()); - const char* targetName = target->GetName(); + std::string targetName = target->GetName(); if (strcmp(qtVersion, "5") == 0) { cmTarget *qt5Uic = makefile->FindTargetToUse("Qt5::uic"); @@ -791,7 +791,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, if (!qt4Uic) { cmSystemTools::Error("Qt4::uic target not found ", - targetName); + targetName.c_str()); return; } makefile->AddDefinition("_qt_uic_executable", qt4Uic->GetLocation(0)); @@ -799,7 +799,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, else { cmSystemTools::Error("The CMAKE_AUTOUIC feature supports only Qt 4 and " - "Qt 5 ", targetName); + "Qt 5 ", targetName.c_str()); } } @@ -921,14 +921,14 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) makefile->AddDefinition("_qt_rcc_options_options", cmLocalGenerator::EscapeForCMake(rccFileOptions.c_str()).c_str()); - const char* targetName = target->GetName(); + std::string targetName = target->GetName(); if (strcmp(qtVersion, "5") == 0) { cmTarget *qt5Rcc = makefile->FindTargetToUse("Qt5::rcc"); if (!qt5Rcc) { cmSystemTools::Error("Qt5::rcc target not found ", - targetName); + targetName.c_str()); return; } makefile->AddDefinition("_qt_rcc_executable", qt5Rcc->GetLocation(0)); @@ -939,7 +939,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) if (!qt4Rcc) { cmSystemTools::Error("Qt4::rcc target not found ", - targetName); + targetName.c_str()); return; } makefile->AddDefinition("_qt_rcc_executable", qt4Rcc->GetLocation(0)); @@ -947,7 +947,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) else { cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " - "Qt 5 ", targetName); + "Qt 5 ", targetName.c_str()); } } diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 1a6f1d6..e561e36 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -203,7 +203,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode() // Lookup the generator. if(cmLocalGenerator* lg = (this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->FindLocalGenerator(dir.c_str()))) + ->GetGlobalGenerator()->FindLocalGenerator(dir))) { // Use the makefile for the directory found. mf = lg->GetMakefile(); diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index dab4180..fa5aafe 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -91,7 +91,7 @@ bool cmSetTargetPropertiesCommand } bool cmSetTargetPropertiesCommand -::SetOneTarget(const char *tname, +::SetOneTarget(const std::string& tname, std::vector &propertyPairs, cmMakefile *mf) { diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index 6221a18..cfe35df 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -37,7 +37,7 @@ public: /** * Used by this command and cmSetPropertiesCommand */ - static bool SetOneTarget(const char *tname, + static bool SetOneTarget(const std::string& tname, std::vector &propertyPairs, cmMakefile *mf); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 6782822..c927a0b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -234,7 +234,7 @@ void cmTarget::DefineProperties(cmake *cm) "", "", true); } -void cmTarget::SetType(TargetType type, const char* name) +void cmTarget::SetType(TargetType type, const std::string& name) { this->Name = name; // only add dependency information for library targets @@ -415,7 +415,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) } //---------------------------------------------------------------------------- -void cmTarget::AddUtility(const char *u, cmMakefile *makefile) +void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile) { this->Utilities.insert(u); if(makefile) @@ -425,7 +425,8 @@ void cmTarget::AddUtility(const char *u, cmMakefile *makefile) } //---------------------------------------------------------------------------- -cmListFileBacktrace const* cmTarget::GetUtilityBacktrace(const char *u) const +cmListFileBacktrace const* cmTarget::GetUtilityBacktrace( + const std::string& u) const { std::map::const_iterator i = this->UtilityBacktraces.find(u); @@ -657,7 +658,7 @@ void cmTarget::ProcessSourceExpression(std::string const& expr) //---------------------------------------------------------------------------- void cmTarget::MergeLinkLibraries( cmMakefile& mf, - const char *selfname, + const std::string& selfname, const LinkLibraryVectorType& libs ) { // Only add on libraries we haven't added on before. @@ -675,7 +676,7 @@ void cmTarget::MergeLinkLibraries( cmMakefile& mf, } //---------------------------------------------------------------------------- -void cmTarget::AddLinkDirectory(const char* d) +void cmTarget::AddLinkDirectory(const std::string& d) { // Make sure we don't add unnecessary search directories. if(this->LinkDirectoriesEmmitted.insert(d).second) @@ -720,7 +721,7 @@ cmTarget::LinkLibraryType cmTarget::ComputeLinkType(const char* config) const //---------------------------------------------------------------------------- void cmTarget::ClearDependencyInformation( cmMakefile& mf, - const char* target ) + const std::string& target ) { // Clear the dependencies. The cache variable must exist iff we are // recording dependency information for this target. @@ -844,9 +845,9 @@ std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value, } //---------------------------------------------------------------------------- -static std::string targetNameGenex(const char *lib) +static std::string targetNameGenex(const std::string& lib) { - return std::string("$"; + return "$"; } //---------------------------------------------------------------------------- @@ -908,7 +909,8 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s, //---------------------------------------------------------------------------- void cmTarget::AddLinkLibrary(cmMakefile& mf, - const char *target, const char* lib, + const std::string& target, + const std::string& lib, LinkLibraryType llt) { cmTarget *tgt = this->Makefile->FindTargetToUse(lib); @@ -917,7 +919,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string libName = (isNonImportedTarget && llt != GENERAL) ? targetNameGenex(lib) - : std::string(lib); + : lib; this->AppendProperty("LINK_LIBRARIES", this->GetDebugGeneratorExpressions(libName, llt).c_str()); @@ -925,7 +927,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, if (cmGeneratorExpression::Find(lib) != std::string::npos || (tgt && tgt->GetType() == INTERFACE_LIBRARY) - || (strcmp( target, lib ) == 0)) + || (target == lib )) { return; } @@ -1469,7 +1471,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, } //---------------------------------------------------------------------------- -const char* cmTarget::GetExportName() const +std::string cmTarget::GetExportName() const { const char *exportName = this->GetProperty("EXPORT_NAME"); @@ -2630,7 +2632,7 @@ const char *cmTarget::GetProperty(const std::string& prop, if (prop == "NAME") { - return this->GetName(); + return this->GetName().c_str(); } // Watch for special "computed" properties that are dependent on diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 205c81c..f73b271 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -93,13 +93,13 @@ public: /** * Set the target type */ - void SetType(TargetType f, const char* name); + void SetType(TargetType f, const std::string& name); void MarkAsImported(); ///! Set/Get the name of the target - const char* GetName() const {return this->Name.c_str();} - const char* GetExportName() const; + const std::string& GetName() const {return this->Name;} + std::string GetExportName() const; ///! Set the cmMakefile that owns this target void SetMakefile(cmMakefile *mf); @@ -168,12 +168,12 @@ public: /** * Clear the dependency information recorded for this target, if any. */ - void ClearDependencyInformation(cmMakefile& mf, const char* target); + void ClearDependencyInformation(cmMakefile& mf, const std::string& target); // Check to see if a library is a framework and treat it different on Mac bool NameResolvesToFramework(const std::string& libname) const; void AddLinkLibrary(cmMakefile& mf, - const char *target, const char* lib, + const std::string& target, const std::string& lib, LinkLibraryType llt); enum TLLSignature { KeywordTLLSignature, @@ -182,12 +182,12 @@ public: bool PushTLLCommandTrace(TLLSignature signature); void GetTllSignatureTraces(cmOStringStream &s, TLLSignature sig) const; - void MergeLinkLibraries( cmMakefile& mf, const char* selfname, + void MergeLinkLibraries( cmMakefile& mf, const std::string& selfname, const LinkLibraryVectorType& libs ); const std::vector& GetLinkDirectories() const; - void AddLinkDirectory(const char* d); + void AddLinkDirectory(const std::string& d); /** * Set the path where this target should be installed. This is relative to @@ -214,10 +214,10 @@ public: * name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE * commands. It is not a full path nor does it have an extension. */ - void AddUtility(const char* u, cmMakefile *makefile = 0); + void AddUtility(const std::string& u, cmMakefile *makefile = 0); ///! Get the utilities used by this target std::setconst& GetUtilities() const { return this->Utilities; } - cmListFileBacktrace const* GetUtilityBacktrace(const char* u) const; + cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const; /** Finalize the target at the end of the Configure step. */ void FinishConfigure(); diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index ad1533e..b4623a0 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -136,7 +136,7 @@ public: return this->DependLibraries; } void AddDependTarget(const char* configName, - const char* tName) + const std::string& tName) { if(!configName) { -- cgit v0.12 From a5996111164a4c4121e7d1fa08dbcd0983bb3589 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 4 Feb 2014 13:35:11 -0500 Subject: FindCUDA: Fix a typo --- Modules/FindCUDA.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 7bc8d49..94f82f6 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -987,7 +987,7 @@ function(CUDA_COMPUTE_BUILD_PATH path build_path) endif() endif() - # This recipie is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the + # This recipe is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the # CMake source. # Remove leading / -- cgit v0.12 From 473ca1ac4a5df336ff09ee2c666e437eabf43bc9 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:02:41 -0500 Subject: stringapi: Use string for OS X resource names --- Source/CPack/cmCPackOSXX11Generator.cxx | 6 +++--- Source/CPack/cmCPackOSXX11Generator.h | 5 +++-- Source/CPack/cmCPackPackageMakerGenerator.cxx | 9 +++++---- Source/CPack/cmCPackPackageMakerGenerator.h | 3 ++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 76e15fb..95ffab5 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -227,7 +227,7 @@ int cmCPackOSXX11Generator::InitializeInternal() //---------------------------------------------------------------------- /* -bool cmCPackOSXX11Generator::CopyCreateResourceFile(const char* name) +bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name) { std::string uname = cmSystemTools::UpperCase(name); std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname; @@ -271,7 +271,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const char* name) */ //---------------------------------------------------------------------- -bool cmCPackOSXX11Generator::CopyResourcePlistFile(const char* name, +bool cmCPackOSXX11Generator::CopyResourcePlistFile(const std::string& name, const char* dir, const char* outputFileName /* = 0 */, bool copyOnly /* = false */) { @@ -288,7 +288,7 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(const char* name, if ( !outputFileName ) { - outputFileName = name; + outputFileName = name.c_str(); } std::string destFileName = dir; diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h index b7bd243..7a93f5a 100644 --- a/Source/CPack/cmCPackOSXX11Generator.h +++ b/Source/CPack/cmCPackOSXX11Generator.h @@ -37,8 +37,9 @@ protected: virtual const char* GetPackagingInstallPrefix(); virtual const char* GetOutputExtension() { return ".dmg"; } - //bool CopyCreateResourceFile(const char* name, const char* dir); - bool CopyResourcePlistFile(const char* name, const char* dir, + //bool CopyCreateResourceFile(const std::string& name, + // const std::string& dir); + bool CopyResourcePlistFile(const std::string& name, const char* dir, const char* outputFileName = 0, bool copyOnly = false); std::string InstallPrefix; }; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index c5b9c6f..69886a1 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -553,8 +553,9 @@ int cmCPackPackageMakerGenerator::InitializeInternal() } //---------------------------------------------------------------------- -bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name, - const char* dirName) +bool cmCPackPackageMakerGenerator::CopyCreateResourceFile( + const std::string& name, + const std::string& dirName) { std::string uname = cmSystemTools::UpperCase(name); std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname; @@ -563,7 +564,7 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name, { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: " << cpackVar.c_str() << " not specified. It should point to " - << (name ? name : "(NULL)") + << (!name.empty() ? name : "") << ".rtf, " << name << ".html, or " << name << ".txt file" << std::endl); return false; @@ -571,7 +572,7 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name, if ( !cmSystemTools::FileExists(inFileName) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find " - << (name ? name : "(NULL)") + << (!name.empty() ? name : "") << " resource file: " << inFileName << std::endl); return false; } diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h index ba3d968..bebb633 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.h +++ b/Source/CPack/cmCPackPackageMakerGenerator.h @@ -51,7 +51,8 @@ protected: // CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased // version of name) specifies the input file to use for this file, // which will be configured via ConfigureFile. - bool CopyCreateResourceFile(const char* name, const char *dirName); + bool CopyCreateResourceFile(const std::string& name, + const std::string& dirName); bool CopyResourcePlistFile(const char* name, const char* outName = 0); // Run PackageMaker with the given command line, which will (if -- cgit v0.12 From 77f60392d93f41a8828d3db1d7b76d45f1535d07 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:06:13 -0500 Subject: stringapi: Accept strings when MD5 hashing data --- Source/cmCryptoHash.cxx | 10 +++++----- Source/cmCryptoHash.h | 4 ++-- Source/cmSystemTools.cxx | 4 ++-- Source/cmSystemTools.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index 7f4b10f..0d3c6bb 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -35,18 +35,18 @@ cmsys::auto_ptr cmCryptoHash::New(const char* algo) } //---------------------------------------------------------------------------- -std::string cmCryptoHash::HashString(const char* input) +std::string cmCryptoHash::HashString(const std::string& input) { this->Initialize(); - this->Append(reinterpret_cast(input), - static_cast(strlen(input))); + this->Append(reinterpret_cast(&input[0]), + static_cast(input.size())); return this->Finalize(); } //---------------------------------------------------------------------------- -std::string cmCryptoHash::HashFile(const char* file) +std::string cmCryptoHash::HashFile(const std::string& file) { - cmsys::ifstream fin(file, std::ios::in | cmsys_ios_binary); + cmsys::ifstream fin(file.c_str(), std::ios::in | cmsys_ios_binary); if(!fin) { return ""; diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h index 1bea9ab..88cd240 100644 --- a/Source/cmCryptoHash.h +++ b/Source/cmCryptoHash.h @@ -21,8 +21,8 @@ class cmCryptoHash public: virtual ~cmCryptoHash() {} static cmsys::auto_ptr New(const char* algo); - std::string HashString(const char* input); - std::string HashFile(const char* file); + std::string HashString(const std::string& input); + std::string HashFile(const std::string& file); protected: virtual void Initialize()=0; virtual void Append(unsigned char const*, int)=0; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 7cc63bb..18eb62e 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -944,7 +944,7 @@ bool cmSystemTools::RenameFile(const char* oldname, const char* newname) #endif } -bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out) +bool cmSystemTools::ComputeFileMD5(const std::string& source, char* md5out) { #if defined(CMAKE_BUILD_WITH_CMAKE) cmCryptoHashMD5 md5; @@ -959,7 +959,7 @@ bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out) #endif } -std::string cmSystemTools::ComputeStringMD5(const char* input) +std::string cmSystemTools::ComputeStringMD5(const std::string& input) { #if defined(CMAKE_BUILD_WITH_CMAKE) cmCryptoHashMD5 md5; diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 4a5d298..da37ceb 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -185,10 +185,10 @@ public: static bool RenameFile(const char* oldname, const char* newname); ///! Compute the md5sum of a file - static bool ComputeFileMD5(const char* source, char* md5out); + static bool ComputeFileMD5(const std::string& source, char* md5out); /** Compute the md5sum of a string. */ - static std::string ComputeStringMD5(const char* input); + static std::string ComputeStringMD5(const std::string& input); /** * Run a single executable command -- cgit v0.12 From 30bc251b65e9deb39c2cb8a785bd98c8d707d508 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:32:48 -0500 Subject: stringapi: Use strings for output names in AddCustomCommandToOutput --- Source/cmMakefile.cxx | 2 +- Source/cmMakefile.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7215e76..8b1f0ba 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1102,7 +1102,7 @@ cmMakefile::UpdateOutputToSourceMap(std::string const& output, //---------------------------------------------------------------------------- cmSourceFile* -cmMakefile::AddCustomCommandToOutput(const char* output, +cmMakefile::AddCustomCommandToOutput(const std::string& output, const std::vector& depends, const char* main_dependency, const cmCustomCommandLines& commandLines, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index aa25f09..e165fd8 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -183,7 +183,7 @@ public: bool replace = false, bool escapeOldStyle = true); cmSourceFile* AddCustomCommandToOutput( - const char* output, + const std::string& output, const std::vector& depends, const char* main_dependency, const cmCustomCommandLines& commandLines, -- cgit v0.12 From adcd812917fe37798a3062bfb3a0932e128faec2 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:33:35 -0500 Subject: stringapi: Use strings for AddSubdirectory paths --- Source/cmGlobalGenerator.h | 2 +- Source/cmMakefile.cxx | 9 +++++---- Source/cmMakefile.h | 12 +++++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 38d7f58..4779682 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -287,7 +287,7 @@ public: std::string const& content); /** Return whether the given binary directory is unused. */ - bool BinaryDirectoryIsNew(const char* dir) + bool BinaryDirectoryIsNew(const std::string& dir) { return this->BinaryDirectories.insert(dir).second; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8b1f0ba..1df64dd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1648,7 +1648,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) } } -void cmMakefile::AddSubDirectory(const char* sub, +void cmMakefile::AddSubDirectory(const std::string& sub, bool excludeFromAll, bool preorder) { // the source path must be made full if it isn't already @@ -1675,7 +1675,8 @@ void cmMakefile::AddSubDirectory(const char* sub, } -void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath, +void cmMakefile::AddSubDirectory(const std::string& srcPath, + const std::string& binPath, bool excludeFromAll, bool preorder, bool immediate) { @@ -4185,8 +4186,8 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, } //---------------------------------------------------------------------------- -bool cmMakefile::EnforceUniqueDir(const char* srcPath, - const char* binPath) const +bool cmMakefile::EnforceUniqueDir(const std::string& srcPath, + const std::string& binPath) const { // Make sure the binary directory is unique. cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e165fd8..4019372 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -263,9 +263,10 @@ public: /** * Add a subdirectory to the build. */ - void AddSubDirectory(const char*, bool excludeFromAll=false, + void AddSubDirectory(const std::string&, bool excludeFromAll=false, bool preorder = false); - void AddSubDirectory(const char* fullSrcDir,const char *fullBinDir, + void AddSubDirectory(const std::string& fullSrcDir, + const std::string& fullBinDir, bool excludeFromAll, bool preorder, bool immediate); @@ -430,7 +431,7 @@ public: * recursing up the tree starting at the StartDirectory and going up until * it reaches the HomeDirectory. */ - void SetStartDirectory(const char* dir) + void SetStartDirectory(const std::string& dir) { this->cmStartDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); @@ -443,7 +444,7 @@ public: { return this->cmStartDirectory.c_str(); } - void SetStartOutputDirectory(const char* lib) + void SetStartOutputDirectory(const std::string& lib) { this->StartOutputDirectory = lib; cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); @@ -949,7 +950,8 @@ private: bool ParseDefineFlag(std::string const& definition, bool remove); - bool EnforceUniqueDir(const char* srcPath, const char* binPath) const; + bool EnforceUniqueDir(const std::string& srcPath, + const std::string& binPath) const; friend class cmMakeDepend; // make depend needs direct access // to the Sources array -- cgit v0.12 From f3efa3cd160d9957437168627689720bb953bb2b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:34:39 -0500 Subject: stringapi: Use strings for cache paths as arguments --- Source/cmCacheManager.cxx | 12 ++++++------ Source/cmCacheManager.h | 12 ++++++------ Source/cmMakefile.cxx | 4 ++-- Source/cmMakefile.h | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 7a71482..141fde5 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -82,12 +82,12 @@ bool cmCacheManager::LoadCache(cmMakefile* mf) } -bool cmCacheManager::LoadCache(const char* path) +bool cmCacheManager::LoadCache(const std::string& path) { return this->LoadCache(path,true); } -bool cmCacheManager::LoadCache(const char* path, +bool cmCacheManager::LoadCache(const std::string& path, bool internal) { std::set emptySet; @@ -178,7 +178,7 @@ bool cmCacheManager::ParseEntry(const char* entry, return flag; } -void cmCacheManager::CleanCMakeFiles(const char* path) +void cmCacheManager::CleanCMakeFiles(const std::string& path) { std::string glob = path; glob += cmake::GetCMakeFilesDirectory(); @@ -193,7 +193,7 @@ void cmCacheManager::CleanCMakeFiles(const char* path) } } -bool cmCacheManager::LoadCache(const char* path, +bool cmCacheManager::LoadCache(const std::string& path, bool internal, std::set& excludes, std::set& includes) @@ -428,7 +428,7 @@ bool cmCacheManager::SaveCache(cmMakefile* mf) } -bool cmCacheManager::SaveCache(const char* path) +bool cmCacheManager::SaveCache(const std::string& path) { std::string cacheFile = path; cacheFile += "/CMakeCache.txt"; @@ -578,7 +578,7 @@ bool cmCacheManager::SaveCache(const char* path) return true; } -bool cmCacheManager::DeleteCache(const char* path) +bool cmCacheManager::DeleteCache(const std::string& path) { std::string cacheFile = path; cmSystemTools::ConvertToUnixSlashes(cacheFile); diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 7a61394..14cb1d9 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -108,19 +108,19 @@ public: ///! Load a cache for given makefile. Loads from ouput home. bool LoadCache(cmMakefile*); ///! Load a cache for given makefile. Loads from path/CMakeCache.txt. - bool LoadCache(const char* path); - bool LoadCache(const char* path, bool internal); - bool LoadCache(const char* path, bool internal, + bool LoadCache(const std::string& path); + bool LoadCache(const std::string& path, bool internal); + bool LoadCache(const std::string& path, bool internal, std::set& excludes, std::set& includes); ///! Save cache for given makefile. Saves to ouput home CMakeCache.txt. bool SaveCache(cmMakefile*) ; ///! Save cache for given makefile. Saves to ouput path/CMakeCache.txt - bool SaveCache(const char* path) ; + bool SaveCache(const std::string& path) ; ///! Delete the cache given - bool DeleteCache(const char* path); + bool DeleteCache(const std::string& path); ///! Print the cache to a stream void PrintCache(std::ostream&) const; @@ -159,7 +159,7 @@ protected: ///! Get a cache entry object for a key CacheEntry *GetCacheEntry(const std::string& key); ///! Clean out the CMakeFiles directory if no CMakeCache.txt - void CleanCMakeFiles(const char* path); + void CleanCMakeFiles(const std::string& path); // Cache version info unsigned int CacheMajorVersion; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1df64dd..e059dd3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2956,7 +2956,7 @@ cmMakefile::LexicalPushPop::~LexicalPushPop() this->Makefile->PopFunctionBlockerBarrier(this->ReportError); } -void cmMakefile::SetHomeDirectory(const char* dir) +void cmMakefile::SetHomeDirectory(const std::string& dir) { this->cmHomeDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory); @@ -2967,7 +2967,7 @@ void cmMakefile::SetHomeDirectory(const char* dir) } } -void cmMakefile::SetHomeOutputDirectory(const char* lib) +void cmMakefile::SetHomeOutputDirectory(const std::string& lib) { this->HomeOutputDirectory = lib; cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 4019372..4b9c548 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -401,12 +401,12 @@ public: * CMakeLists files by recursing up the tree starting at the StartDirectory * and going up until it reaches the HomeDirectory. */ - void SetHomeDirectory(const char* dir); + void SetHomeDirectory(const std::string& dir); const char* GetHomeDirectory() const { return this->cmHomeDirectory.c_str(); } - void SetHomeOutputDirectory(const char* lib); + void SetHomeOutputDirectory(const std::string& lib); const char* GetHomeOutputDirectory() const { return this->HomeOutputDirectory.c_str(); -- cgit v0.12 From dddbd2c7faf0a606200d5b03c549d348eceb87d7 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:35:10 -0500 Subject: stringapi: Accept strings when setting command errors --- Source/cmCommand.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmCommand.h b/Source/cmCommand.h index e148857..2378ef0 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -166,7 +166,7 @@ public: /** * Set the error message */ - void SetError(const char* e) + void SetError(const std::string& e) { this->Error = this->GetName(); this->Error += " "; -- cgit v0.12 From 38c7544578f4154dfaaa0a55b118b79b11ec6ae1 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:35:30 -0500 Subject: stringapi: Use strings for documentation names --- Source/cmDocumentation.cxx | 4 ++-- Source/cmDocumentation.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 9c27fc1..96b5f04 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -477,9 +477,9 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, } //---------------------------------------------------------------------------- -void cmDocumentation::SetName(const char* name) +void cmDocumentation::SetName(const std::string& name) { - this->NameString = name?name:""; + this->NameString = name; } //---------------------------------------------------------------------------- diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index d5a7dd5..56a4151 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -56,7 +56,7 @@ public: void SetShowGenerators(bool showGen) { this->ShowGenerators = showGen; } /** Set the program name for standard document generation. */ - void SetName(const char* name); + void SetName(const std::string& name); /** Set a section of the documentation. Typical sections include Name, Usage, Description, Options */ -- cgit v0.12 From d76a6e08d06ef0fa6d52f67e88b0cfe4d96f24d1 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:37:02 -0500 Subject: stringapi: Use strings for generated file stream names --- Source/cmGeneratedFileStream.cxx | 7 +------ Source/cmGeneratedFileStream.h | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index 34efc15..78ad4b2 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -249,12 +249,7 @@ int cmGeneratedFileStreamBase::RenameFile(const char* oldname, } //---------------------------------------------------------------------------- -void cmGeneratedFileStream::SetName(const char* fname) +void cmGeneratedFileStream::SetName(const std::string& fname) { - if ( !fname ) - { - this->Name = ""; - return; - } this->Name = fname; } diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h index 99f3b47..7adee7b 100644 --- a/Source/cmGeneratedFileStream.h +++ b/Source/cmGeneratedFileStream.h @@ -140,7 +140,7 @@ public: * Set name of the file that will hold the actual output. This method allows * the output file to be changed during the use of cmGeneratedFileStream. */ - void SetName(const char* fname); + void SetName(const std::string& fname); private: cmGeneratedFileStream(cmGeneratedFileStream const&); // not implemented -- cgit v0.12 From c3833c7da40ccb03fc80bf10f37b77398d7123f8 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:40:05 -0500 Subject: stringapi: Use strings for VS project names --- Source/cmGlobalGenerator.cxx | 11 ++++++----- Source/cmGlobalGenerator.h | 8 ++++---- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 2 +- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 6 +++--- Source/cmGlobalVisualStudio6Generator.h | 7 ++++--- Source/cmGlobalVisualStudio71Generator.cxx | 8 ++++---- Source/cmGlobalVisualStudio71Generator.h | 8 ++++---- Source/cmGlobalVisualStudio7Generator.cxx | 19 ++++++++++--------- Source/cmGlobalVisualStudio7Generator.h | 14 +++++++------- Source/cmGlobalVisualStudio8Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio8Generator.h | 5 +++-- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 5 ++--- Source/cmLocalVisualStudio7Generator.h | 2 +- Source/cmMakefile.cxx | 2 +- Source/cmMakefile.h | 2 +- 22 files changed, 60 insertions(+), 57 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 795048b..ae9c731 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1007,7 +1007,7 @@ void cmGlobalGenerator::ClearEnabledLanguages() this->LanguageEnabled.clear(); } -bool cmGlobalGenerator::IsDependedOn(const char* project, +bool cmGlobalGenerator::IsDependedOn(const std::string& project, cmTarget const* targetIn) { // Get all local gens for this project @@ -1615,7 +1615,7 @@ void cmGlobalGenerator::CheckLocalGenerators() } int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, - const char *projectName, + const std::string& projectName, const std::string& target, bool fast, std::string *output, cmMakefile *mf) { @@ -1663,8 +1663,9 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, } void cmGlobalGenerator::GenerateBuildCommand( - std::vector& makeCommand, const char*, const char*, const char*, - const std::string&, const char*, bool, std::vector const&) + std::vector& makeCommand, const char*, const std::string&, + const char*, const std::string&, const char*, bool, + std::vector const&) { makeCommand.push_back( "cmGlobalGenerator::GenerateBuildCommand not implemented"); @@ -1672,7 +1673,7 @@ void cmGlobalGenerator::GenerateBuildCommand( int cmGlobalGenerator::Build( const char *, const char *bindir, - const char *projectName, const std::string& target, + const std::string& projectName, const std::string& target, std::string *output, const char *makeCommandCSTR, const char *config, diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 4779682..ce285d6 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -106,7 +106,7 @@ public: * loaded commands, not as part of the usual build process. */ virtual int TryCompile(const char *srcdir, const char *bindir, - const char *projectName, + const std::string& projectName, const std::string& targetName, bool fast, std::string *output, cmMakefile* mf); @@ -118,7 +118,7 @@ public: * done first. */ int Build(const char *srcdir, const char *bindir, - const char *projectName, const std::string& targetName, + const std::string& projectName, const std::string& targetName, std::string *output, const char *makeProgram, const char *config, bool clean, bool fast, @@ -130,7 +130,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char *projectName, const char *projectDir, + const std::string& projectName, const char *projectDir, const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() ); @@ -223,7 +223,7 @@ public: /** If check to see if the target is linked to by any other target in the project */ - bool IsDependedOn(const char* project, cmTarget const* target); + bool IsDependedOn(const std::string& project, cmTarget const* target); ///! Find a local generator by its startdirectory cmLocalGenerator* FindLocalGenerator(const std::string& start_dir) const; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index b027995..954fb17 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -552,7 +552,7 @@ bool cmGlobalNinjaGenerator::UsingMinGW = false; void cmGlobalNinjaGenerator ::GenerateBuildCommand(std::vector& makeCommand, const char* makeProgram, - const char* /*projectName*/, + const std::string& /*projectName*/, const char* /*projectDir*/, const std::string& targetName, const char* /*config*/, diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 41d1510..e422e36 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -194,7 +194,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 74b8e98..735887e 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -566,7 +566,7 @@ cmGlobalUnixMakefileGenerator3 void cmGlobalUnixMakefileGenerator3 ::GenerateBuildCommand(std::vector& makeCommand, const char* makeProgram, - const char* /*projectName*/, + const std::string& /*projectName*/, const char* /*projectDir*/, const std::string& targetName, const char* /*config*/, diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index f97ae9b..ffdf6fb 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -110,7 +110,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 1346e13..a2991e1 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -311,7 +311,7 @@ std::string cmGlobalVisualStudio10Generator::FindDevEnvCommand() void cmGlobalVisualStudio10Generator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 198e113..97ac9bc 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -35,7 +35,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 534a493..214b9ea 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -117,7 +117,7 @@ void cmGlobalVisualStudio6Generator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* /*projectDir*/, const std::string& targetName, const char* config, @@ -271,7 +271,7 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile() // Note, that dependencies from executables to // the libraries it uses are also done here void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, - const char* dspname, + const std::string& dspname, const char* dir, cmTarget const& target) { @@ -316,7 +316,7 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, // Note, that dependencies from executables to // the libraries it uses are also done here void cmGlobalVisualStudio6Generator::WriteExternalProject(std::ostream& fout, - const char* name, + const std::string& name, const char* location, const std::set& dependencies) { diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 40b8462..f1c70e4 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -55,7 +55,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, @@ -99,9 +99,10 @@ private: void WriteDSWFile(std::ostream& fout); void WriteDSWHeader(std::ostream& fout); void WriteProject(std::ostream& fout, - const char* name, const char* path, cmTarget const& t); + const std::string& name, const char* path, + cmTarget const& t); void WriteExternalProject(std::ostream& fout, - const char* name, const char* path, + const std::string& name, const char* path, const std::set& dependencies); void WriteDSWFooter(std::ostream& fout); virtual std::string WriteUtilityDepend(cmTarget const* target); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 22e4f08..af1a5c5 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -155,7 +155,7 @@ cmGlobalVisualStudio71Generator // the libraries it uses are also done here void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, - const char* dspname, + const std::string& dspname, const char* dir, cmTarget const& t) { @@ -208,7 +208,7 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, void cmGlobalVisualStudio71Generator ::WriteProjectDepends(std::ostream& fout, - const char*, + const std::string&, const char*, cmTarget const& target) { VSDependSet const& depends = this->VSTargetDepends[&target]; @@ -234,7 +234,7 @@ cmGlobalVisualStudio71Generator // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator ::WriteExternalProject(std::ostream& fout, - const char* name, + const std::string& name, const char* location, const char* typeGuid, const std::set& depends) @@ -277,7 +277,7 @@ void cmGlobalVisualStudio71Generator // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator ::WriteProjectConfigurations( - std::ostream& fout, const char* name, cmTarget::TargetType, + std::ostream& fout, const std::string& name, cmTarget::TargetType, const std::set& configsPartOfDefaultBuild, const char* platformMapping) { diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 04e3a55..8791468 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -59,17 +59,17 @@ protected: std::vector& generators); virtual void WriteSolutionConfigurations(std::ostream& fout); virtual void WriteProject(std::ostream& fout, - const char* name, const char* path, + const std::string& name, const char* path, cmTarget const& t); virtual void WriteProjectDepends(std::ostream& fout, - const char* name, const char* path, + const std::string& name, const char* path, cmTarget const& t); virtual void WriteProjectConfigurations( - std::ostream& fout, const char* name, cmTarget::TargetType type, + std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, const char* platformMapping = NULL); virtual void WriteExternalProject(std::ostream& fout, - const char* name, + const std::string& name, const char* path, const char* typeGuid, const std::set& depends); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 5c7af00..cf84fe3 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -184,7 +184,7 @@ const char* cmGlobalVisualStudio7Generator::ExternalProjectType( void cmGlobalVisualStudio7Generator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* /*projectDir*/, const std::string& targetName, const char* config, @@ -654,7 +654,7 @@ cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path) // Note, that dependencies from executables to // the libraries it uses are also done here void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, - const char* dspname, + const std::string& dspname, const char* dir, cmTarget const& target) { // check to see if this is a fortran build @@ -694,7 +694,7 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, void cmGlobalVisualStudio7Generator ::WriteProjectDepends(std::ostream& fout, - const char* dspname, + const std::string& dspname, const char*, cmTarget const& target) { int depcount = 0; @@ -730,7 +730,7 @@ cmGlobalVisualStudio7Generator // executables to the libraries it uses are also done here void cmGlobalVisualStudio7Generator ::WriteProjectConfigurations( - std::ostream& fout, const char* name, cmTarget::TargetType, + std::ostream& fout, const std::string& name, cmTarget::TargetType, const std::set& configsPartOfDefaultBuild, const char* platformMapping) { @@ -758,7 +758,7 @@ void cmGlobalVisualStudio7Generator // Note, that dependencies from executables to // the libraries it uses are also done here void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout, - const char* name, + const std::string& name, const char* location, const char* typeGuid, const std::set&) @@ -908,7 +908,7 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target) return pname; } -std::string cmGlobalVisualStudio7Generator::GetGUID(const char* name) +std::string cmGlobalVisualStudio7Generator::GetGUID(const std::string& name) { std::string guidStoreName = name; guidStoreName += "_GUID_CMAKE"; @@ -919,7 +919,7 @@ std::string cmGlobalVisualStudio7Generator::GetGUID(const char* name) return std::string(storedGUID); } cmSystemTools::Error("Unknown Target referenced : ", - name); + name.c_str()); return ""; } @@ -975,8 +975,9 @@ cmGlobalVisualStudio7Generator } std::set -cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project, - cmTarget const* target) +cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( + const std::string& project, + cmTarget const* target) { std::set activeConfigs; // if it is a utilitiy target then only make it part of the diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index a7aca60..6fb3731 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -63,7 +63,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, @@ -90,7 +90,7 @@ public: ///! Create a GUID or get an existing one. void CreateGUID(const char* name); - std::string GetGUID(const char* name); + std::string GetGUID(const std::string& name); /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const char* prefix, @@ -123,13 +123,13 @@ protected: virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); virtual void WriteProject(std::ostream& fout, - const char* name, const char* path, + const std::string& name, const char* path, cmTarget const& t); virtual void WriteProjectDepends(std::ostream& fout, - const char* name, const char* path, + const std::string& name, const char* path, cmTarget const&t); virtual void WriteProjectConfigurations( - std::ostream& fout, const char* name, cmTarget::TargetType type, + std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, const char* platformMapping = NULL); virtual void WriteSLNGlobalSections(std::ostream& fout, @@ -153,7 +153,7 @@ protected: void GenerateConfigurations(cmMakefile* mf); virtual void WriteExternalProject(std::ostream& fout, - const char* name, + const std::string& name, const char* path, const char* typeGuid, const std::set& @@ -161,7 +161,7 @@ protected: std::string ConvertToSolutionPath(const char* path); - std::set IsPartOfDefaultBuild(const char* project, + std::set IsPartOfDefaultBuild(const std::string& project, cmTarget const* target); std::vector Configurations; std::map GUIDMap; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 0453333..1ba74eb 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -372,7 +372,7 @@ cmGlobalVisualStudio8Generator void cmGlobalVisualStudio8Generator ::WriteProjectConfigurations( - std::ostream& fout, const char* name, cmTarget::TargetType type, + std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, const char* platformMapping) { @@ -415,7 +415,7 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends() //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator::WriteProjectDepends( - std::ostream& fout, const char*, const char*, cmTarget const& t) + std::ostream& fout, const std::string&, const char*, cmTarget const& t) { TargetDependSet const& unordered = this->GetTargetDirectDepends(t); OrderedTargetDependSet depends(unordered); diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 5b952c4..bafb9eb 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -79,11 +79,12 @@ protected: virtual void WriteSLNHeader(std::ostream& fout); virtual void WriteSolutionConfigurations(std::ostream& fout); virtual void WriteProjectConfigurations( - std::ostream& fout, const char* name, cmTarget::TargetType type, + std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, const char* platformMapping = NULL); virtual bool ComputeTargetDepends(); - virtual void WriteProjectDepends(std::ostream& fout, const char* name, + virtual void WriteProjectDepends(std::ostream& fout, + const std::string& name, const char* path, cmTarget const& t); std::string Name; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 9e1e902..a1255a0 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -261,7 +261,7 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* /*projectDir*/, const std::string& targetName, const char* config, diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 0cb1758..8e2de9a 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -56,7 +56,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 786791c..280320f 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -228,7 +228,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles() //---------------------------------------------------------------------------- void cmLocalVisualStudio7Generator -::CreateSingleVCProj(const char *lname, cmTarget &target) +::CreateSingleVCProj(const std::string& lname, cmTarget &target) { this->FortranProject = static_cast(this->GlobalGenerator) @@ -245,8 +245,7 @@ void cmLocalVisualStudio7Generator } // add to the list of projects - std::string pname = lname; - target.SetProperty("GENERATOR_FILE_NAME",lname); + target.SetProperty("GENERATOR_FILE_NAME",lname.c_str()); // create the dsp.cmake file std::string fname; fname = this->Makefile->GetStartOutputDirectory(); diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 4d72747..760716e 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -66,7 +66,7 @@ public: const char* path); virtual void AddCMakeListsRules(); protected: - void CreateSingleVCProj(const char *lname, cmTarget &tgt); + void CreateSingleVCProj(const std::string& lname, cmTarget &tgt); private: typedef cmVisualStudioGeneratorOptions Options; typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e059dd3..8584ad8 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3061,7 +3061,7 @@ void cmMakefile::ExpandSourceListArguments( } int cmMakefile::TryCompile(const char *srcdir, const char *bindir, - const char *projectName, + const std::string& projectName, const std::string& targetName, bool fast, const std::vector *cmakeArgs, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 4b9c548..6475c0f 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -127,7 +127,7 @@ public: * loaded commands, not as part of the usual build process. */ int TryCompile(const char *srcdir, const char *bindir, - const char *projectName, const std::string& targetName, + const std::string& projectName, const std::string& targetName, bool fast, const std::vector *cmakeArgs, std::string *output); -- cgit v0.12 From 8455dd0a9a6c766870c7ddcb186e49a8a5db1416 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:45:11 -0500 Subject: stringapi: Use strings for search paths --- Source/cmMakeDepend.cxx | 2 +- Source/cmMakeDepend.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 615e6f2..03ad37c 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -359,7 +359,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) } // Add a directory to the search path -void cmMakeDepend::AddSearchPath(const char* path) +void cmMakeDepend::AddSearchPath(const std::string& path) { this->IncludeDirectories.push_back(path); } diff --git a/Source/cmMakeDepend.h b/Source/cmMakeDepend.h index b6e3928..2419ae9 100644 --- a/Source/cmMakeDepend.h +++ b/Source/cmMakeDepend.h @@ -94,7 +94,7 @@ public: /** * Add a directory to the search path for include files. */ - virtual void AddSearchPath(const char*); + virtual void AddSearchPath(const std::string&); /** * Generate dependencies for the file given. Returns a pointer to -- cgit v0.12 From 23e9b80f585db1cc68846a54e6e5844f970215ea Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:46:27 -0500 Subject: stringapi: Use strings for globbing parameters --- Source/cmSystemTools.cxx | 12 ++++++------ Source/cmSystemTools.h | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 18eb62e..9b35e61 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -971,13 +971,14 @@ std::string cmSystemTools::ComputeStringMD5(const std::string& input) #endif } -void cmSystemTools::Glob(const char *directory, const char *regexp, +void cmSystemTools::Glob(const std::string& directory, + const std::string& regexp, std::vector& files) { cmsys::Directory d; - cmsys::RegularExpression reg(regexp); + cmsys::RegularExpression reg(regexp.c_str()); - if (d.Load(directory)) + if (d.Load(directory.c_str())) { size_t numf; unsigned int i; @@ -994,14 +995,13 @@ void cmSystemTools::Glob(const char *directory, const char *regexp, } -void cmSystemTools::GlobDirs(const char *fullPath, +void cmSystemTools::GlobDirs(const std::string& path, std::vector& files) { - std::string path = fullPath; std::string::size_type pos = path.find("/*"); if(pos == std::string::npos) { - files.push_back(fullPath); + files.push_back(path); return; } std::string startPath = path.substr(0, pos); diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index da37ceb..51c103e 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -158,9 +158,10 @@ public: static std::string FileExistsInParentDirectories(const char* fname, const char* directory, const char* toplevel); - static void Glob(const char *directory, const char *regexp, + static void Glob(const std::string& directory, const std::string& regexp, std::vector& files); - static void GlobDirs(const char *fullPath, std::vector& files); + static void GlobDirs(const std::string& fullPath, + std::vector& files); /** * Try to find a list of files that match the "simple" globbing -- cgit v0.12 From 8d60da0cb56b44815f02ece01e224e1f4eba6c80 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 8 Feb 2014 11:39:22 -0500 Subject: cmTarget: Remove the project argument to FindTarget All callers passed 0 in, so just remove the branch. --- Source/cmExportCommand.cxx | 2 +- Source/cmExportLibraryDependenciesCommand.cxx | 2 +- Source/cmGlobalGenerator.cxx | 51 +++++++++------------------ Source/cmGlobalGenerator.h | 2 +- Source/cmGlobalVisualStudio8Generator.cxx | 2 +- Source/cmLocalVisualStudio6Generator.cxx | 2 +- Source/cmMakefile.cxx | 5 ++- Source/cmTargetLinkLibrariesCommand.cxx | 2 +- Source/cmTargetPropCommandBase.cxx | 2 +- 9 files changed, 25 insertions(+), 45 deletions(-) diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index db56aaf..bda8dda 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -168,7 +168,7 @@ bool cmExportCommand return false; } - if(cmTarget* target = gg->FindTarget(0, currentTarget->c_str())) + if(cmTarget* target = gg->FindTarget(currentTarget->c_str())) { if(target->GetType() == cmTarget::OBJECT_LIBRARY) { diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index 5d6f094..469a661 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -138,7 +138,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const break; } std::string lib = li->first; - if(cmTarget* libtgt = global->FindTarget(0, lib.c_str())) + if(cmTarget* libtgt = global->FindTarget(lib.c_str())) { // Handle simple output name changes. This command is // deprecated so we do not support full target name diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ae9c731..ba4cce8 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2070,47 +2070,28 @@ bool cmGlobalGenerator::IsAlias(const std::string& name) const //---------------------------------------------------------------------------- cmTarget* -cmGlobalGenerator::FindTarget(const char* project, const std::string& name, +cmGlobalGenerator::FindTarget(const std::string& name, bool excludeAliases) const { - // if project specific - if(project) + if (!excludeAliases) { - std::map >::const_iterator - gens = this->ProjectMap.find(project); - for(unsigned int i = 0; i < gens->second.size(); ++i) + std::map::const_iterator ai + = this->AliasTargets.find(name); + if (ai != this->AliasTargets.end()) { - cmTarget* ret = (gens->second)[i]->GetMakefile()->FindTarget(name, - excludeAliases); - if(ret) - { - return ret; - } + return ai->second; } } - // if all projects/directories - else + std::map::const_iterator i = + this->TotalTargets.find ( name ); + if ( i != this->TotalTargets.end() ) { - if (!excludeAliases) - { - std::map::const_iterator ai - = this->AliasTargets.find(name); - if (ai != this->AliasTargets.end()) - { - return ai->second; - } - } - std::map::const_iterator i = - this->TotalTargets.find ( name ); - if ( i != this->TotalTargets.end() ) - { - return i->second; - } - i = this->ImportedTargets.find(name); - if ( i != this->ImportedTargets.end() ) - { - return i->second; - } + return i->second; + } + i = this->ImportedTargets.find(name); + if ( i != this->ImportedTargets.end() ) + { + return i->second; } return 0; } @@ -2124,7 +2105,7 @@ cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const return true; } - if(cmTarget* tgt = this->FindTarget(0, libname.c_str())) + if(cmTarget* tgt = this->FindTarget(libname.c_str())) { if(tgt->IsFrameworkOnApple()) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index ce285d6..746f715 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -211,7 +211,7 @@ public: virtual void FindMakeProgram(cmMakefile*); ///! Find a target by name by searching the local generators. - cmTarget* FindTarget(const char* project, const std::string& name, + cmTarget* FindTarget(const std::string& name, bool excludeAliases = false) const; void AddAlias(const std::string& name, cmTarget *tgt); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 1ba74eb..51825ee 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -440,7 +440,7 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies( target.GetUtilities().begin(); ui != target.GetUtilities().end(); ++ui) { - if(cmTarget* depTarget = this->FindTarget(0, ui->c_str())) + if(cmTarget* depTarget = this->FindTarget(ui->c_str())) { if(depTarget->GetType() != cmTarget::INTERFACE_LIBRARY && depTarget->GetProperty("EXTERNAL_MSPROJECT")) diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 88206f1..a5ac629 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1099,7 +1099,7 @@ void cmLocalVisualStudio6Generator // Compute the proper name to use to link this library. std::string lib; std::string libDebug; - cmTarget* tgt = this->GlobalGenerator->FindTarget(0, j->first.c_str()); + cmTarget* tgt = this->GlobalGenerator->FindTarget(j->first.c_str()); if(tgt) { lib = cmSystemTools::GetFilenameWithoutExtension diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8584ad8..a94e39c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1471,7 +1471,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, if ( i != this->Targets.end()) { cmTarget* tgt = - this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(0,lib); + this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(lib); if(tgt) { // if it is not a static or shared library then you can not link to it @@ -4068,8 +4068,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name, } // Look for a target built in this project. - return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, - name.c_str(), + return this->LocalGenerator->GetGlobalGenerator()->FindTarget(name.c_str(), excludeAliases); } diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 02da933..b16f311 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -39,7 +39,7 @@ bool cmTargetLinkLibrariesCommand // Lookup the target for which libraries are specified. this->Target = this->Makefile->GetCMakeInstance() - ->GetGlobalGenerator()->FindTarget(0, args[0].c_str()); + ->GetGlobalGenerator()->FindTarget(args[0].c_str()); if(!this->Target) { cmake::MessageType t = cmake::FATAL_ERROR; // fail by default diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index 2a20516..1a1cfa0 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -34,7 +34,7 @@ bool cmTargetPropCommandBase } this->Target = this->Makefile->GetCMakeInstance() - ->GetGlobalGenerator()->FindTarget(0, args[0].c_str()); + ->GetGlobalGenerator()->FindTarget(args[0].c_str()); if(!this->Target) { this->Target = this->Makefile->FindTargetToUse(args[0]); -- cgit v0.12 From 466abd846fdbe17f4cff8a6008396eb1887b70c3 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 8 Feb 2014 21:36:26 -0500 Subject: cmTargetLinkLibrariesCommand: Use a string argument --- Source/cmTargetLinkLibrariesCommand.cxx | 10 +++++----- Source/cmTargetLinkLibrariesCommand.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index b16f311..8dc407b 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -272,7 +272,7 @@ bool cmTargetLinkLibrariesCommand { // The link type was specified by the previous argument. haveLLT = false; - if (!this->HandleLibrary(args[i].c_str(), llt)) + if (!this->HandleLibrary(args[i], llt)) { return false; } @@ -301,7 +301,7 @@ bool cmTargetLinkLibrariesCommand llt = cmTarget::OPTIMIZED; } } - if (!this->HandleLibrary(args[i].c_str(), llt)) + if (!this->HandleLibrary(args[i], llt)) { return false; } @@ -352,7 +352,7 @@ cmTargetLinkLibrariesCommand //---------------------------------------------------------------------------- bool -cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib, +cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, cmTarget::LinkLibraryType llt) { if(this->Target->GetType() == cmTarget::INTERFACE_LIBRARY @@ -479,13 +479,13 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib, { prop = "LINK_INTERFACE_LIBRARIES_"; prop += *i; - this->Target->AppendProperty(prop.c_str(), lib); + this->Target->AppendProperty(prop.c_str(), lib.c_str()); } } if(llt == cmTarget::OPTIMIZED || llt == cmTarget::GENERAL) { // Put in the non-DEBUG configuration interfaces. - this->Target->AppendProperty("LINK_INTERFACE_LIBRARIES", lib); + this->Target->AppendProperty("LINK_INTERFACE_LIBRARIES", lib.c_str()); // Make sure the DEBUG configuration interfaces exist so that the // general one will not be used as a fall-back. diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index 6fbf722..e2f3743 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -62,7 +62,7 @@ private: ProcessingState CurrentProcessingState; - bool HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt); + bool HandleLibrary(const std::string& lib, cmTarget::LinkLibraryType llt); }; -- cgit v0.12 From 4c53997f3880785953e3ab6c811626b85ee67510 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 23:55:28 -0500 Subject: stringapi: Take strings for utility command names --- Source/cmMakefile.cxx | 4 ++-- Source/cmMakefile.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a94e39c..7198523 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1188,7 +1188,7 @@ cmMakefile::AddCustomCommandOldStyle(const std::string& target, } //---------------------------------------------------------------------------- -void cmMakefile::AddUtilityCommand(const char* utilityName, +void cmMakefile::AddUtilityCommand(const std::string& utilityName, bool excludeFromAll, const std::vector& depends, const char* workingDirectory, @@ -1227,7 +1227,7 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, //---------------------------------------------------------------------------- cmTarget* -cmMakefile::AddUtilityCommand(const char* utilityName, +cmMakefile::AddUtilityCommand(const std::string& utilityName, bool excludeFromAll, const char* workingDirectory, const std::vector& depends, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 6475c0f..39635dd 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -222,7 +222,7 @@ public: * Add a utility to the build. A utiltity target is a command that * is run every time the target is built. */ - void AddUtilityCommand(const char* utilityName, bool excludeFromAll, + void AddUtilityCommand(const std::string& utilityName, bool excludeFromAll, const std::vector& depends, const char* workingDirectory, const char* command, @@ -230,7 +230,8 @@ public: const char* arg2=0, const char* arg3=0, const char* arg4=0); - cmTarget* AddUtilityCommand(const char* utilityName, bool excludeFromAll, + cmTarget* AddUtilityCommand(const std::string& utilityName, + bool excludeFromAll, const char* workingDirectory, const std::vector& depends, const cmCustomCommandLines& commandLines, -- cgit v0.12 From 215b1addf09359507281359cd7d478c61c01a9f2 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 8 Feb 2014 00:29:59 -0500 Subject: stringapi: Take strings in escaping functions --- Source/cmLocalGenerator.cxx | 54 +++++++++++++++++--------------- Source/cmLocalGenerator.h | 9 +++--- Source/cmLocalVisualStudio7Generator.cxx | 4 +-- Source/cmLocalVisualStudio7Generator.h | 2 +- Source/cmLocalXCodeGenerator.cxx | 2 +- Source/cmLocalXCodeGenerator.h | 3 +- Source/cmSystemTools.cxx | 7 +++-- Source/cmSystemTools.h | 2 +- 8 files changed, 44 insertions(+), 39 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index ded4fc6..75f2130 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2358,7 +2358,7 @@ void cmLocalGenerator::AppendFlags(std::string& flags, //---------------------------------------------------------------------------- void cmLocalGenerator::AppendFlagEscape(std::string& flags, - const char* rawFlag) + const std::string& rawFlag) { this->AppendFlags(flags, this->EscapeForShell(rawFlag).c_str()); } @@ -3187,7 +3187,7 @@ cmLocalGenerator } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str) +std::string cmLocalGenerator::EscapeForShellOldStyle(const std::string& str) { std::string result; #if defined(_WIN32) && !defined(__CYGWIN__) @@ -3203,7 +3203,7 @@ std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str) } return str; #else - for(const char* ch = str; *ch != '\0'; ++ch) + for(const char* ch = str.c_str(); *ch != '\0'; ++ch) { if(*ch == ' ') { @@ -3216,28 +3216,30 @@ std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str) } //---------------------------------------------------------------------------- -static bool cmLocalGeneratorIsShellOperator(const char* str) -{ - if(strcmp(str, "<") == 0 || - strcmp(str, ">") == 0 || - strcmp(str, "<<") == 0 || - strcmp(str, ">>") == 0 || - strcmp(str, "|") == 0 || - strcmp(str, "||") == 0 || - strcmp(str, "&&") == 0 || - strcmp(str, "&>") == 0 || - strcmp(str, "1>") == 0 || - strcmp(str, "2>") == 0 || - strcmp(str, "2>&1") == 0 || - strcmp(str, "1>&2") == 0) +static bool cmLocalGeneratorIsShellOperator(const std::string& str) +{ + static std::set shellOperators; + if(shellOperators.empty()) { - return true; + shellOperators.insert("<"); + shellOperators.insert(">"); + shellOperators.insert("<<"); + shellOperators.insert(">>"); + shellOperators.insert("|"); + shellOperators.insert("||"); + shellOperators.insert("&&"); + shellOperators.insert("&>"); + shellOperators.insert("1>"); + shellOperators.insert("2>"); + shellOperators.insert("2>&1"); + shellOperators.insert("1>&2"); } - return false; + return shellOperators.count(str) > 0; } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars, +std::string cmLocalGenerator::EscapeForShell(const std::string& str, + bool makeVars, bool forEcho) { // Do not escape shell operators. @@ -3279,28 +3281,28 @@ std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars, // Compute the buffer size needed. int size = (this->WindowsShell ? - cmsysSystem_Shell_GetArgumentSizeForWindows(str, flags) : - cmsysSystem_Shell_GetArgumentSizeForUnix(str, flags)); + cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) : + cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags)); // Compute the shell argument itself. std::vector arg(size); if(this->WindowsShell) { - cmsysSystem_Shell_GetArgumentForWindows(str, &arg[0], flags); + cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags); } else { - cmsysSystem_Shell_GetArgumentForUnix(str, &arg[0], flags); + cmsysSystem_Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags); } return std::string(&arg[0]); } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::EscapeForCMake(const char* str) +std::string cmLocalGenerator::EscapeForCMake(const std::string& str) { // Always double-quote the argument to take care of most escapes. std::string result = "\""; - for(const char* c = str; *c; ++c) + for(const char* c = str.c_str(); *c; ++c) { if(*c == '"') { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index c1deb09..633be5d 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -150,7 +150,8 @@ public: const char* config); ///! Append flags to a string. virtual void AppendFlags(std::string& flags, const char* newFlags); - virtual void AppendFlagEscape(std::string& flags, const char* rawFlag); + virtual void AppendFlagEscape(std::string& flags, + const std::string& rawFlag); ///! Get the include flags for the current makefile and language std::string GetIncludeFlags(const std::vector &includes, cmGeneratorTarget* target, @@ -285,14 +286,14 @@ public: system to replace make variable references. Optionally adjust escapes for the special case of passing to the native echo command. */ - std::string EscapeForShell(const char* str, bool makeVars = false, + std::string EscapeForShell(const std::string& str, bool makeVars = false, bool forEcho = false); /** Backwards-compatibility version of EscapeForShell. */ - std::string EscapeForShellOldStyle(const char* str); + std::string EscapeForShellOldStyle(const std::string& str); /** Escape the given string as an argument in a CMake script. */ - static std::string EscapeForCMake(const char* str); + static std::string EscapeForCMake(const std::string& str); enum FortranFormat { diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 280320f..7b921a3 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -2100,7 +2100,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter(std::ostream& fout, << "\n"; } -std::string cmLocalVisualStudio7GeneratorEscapeForXML(const char* s) +std::string cmLocalVisualStudio7GeneratorEscapeForXML(const std::string& s) { std::string ret = s; cmSystemTools::ReplaceString(ret, "&", "&"); @@ -2111,7 +2111,7 @@ std::string cmLocalVisualStudio7GeneratorEscapeForXML(const char* s) return ret; } -std::string cmLocalVisualStudio7Generator::EscapeForXML(const char* s) +std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s) { return cmLocalVisualStudio7GeneratorEscapeForXML(s); } diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 760716e..2823a2c 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -84,7 +84,7 @@ private: void WriteConfiguration(std::ostream& fout, const char* configName, const std::string& libName, cmTarget &tgt); - std::string EscapeForXML(const char* s); + std::string EscapeForXML(const std::string& s); std::string ConvertToXMLOutputPath(const char* path); std::string ConvertToXMLOutputPathSingle(const char* path); void OutputTargetRules(std::ostream& fout, const char* configName, diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index a9a27b9..fb8c2d1 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -37,7 +37,7 @@ cmLocalXCodeGenerator::GetTargetDirectory(cmTarget const&) const //---------------------------------------------------------------------------- void cmLocalXCodeGenerator::AppendFlagEscape(std::string& flags, - const char* rawFlag) + const std::string& rawFlag) { cmGlobalXCodeGenerator* gg = static_cast(this->GlobalGenerator); diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index edd2f5b..3bfe3a3 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -28,7 +28,8 @@ public: virtual ~cmLocalXCodeGenerator(); virtual std::string GetTargetDirectory(cmTarget const& target) const; - virtual void AppendFlagEscape(std::string& flags, const char* rawFlag); + virtual void AppendFlagEscape(std::string& flags, + const std::string& rawFlag); virtual void Generate(); virtual void GenerateInstallRules(); private: diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 9b35e61..2b17fba 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -179,10 +179,11 @@ void cmSystemTools::ExpandRegistryValues(std::string& source, KeyWOW64) } #endif -std::string cmSystemTools::EscapeQuotes(const char* str) +std::string cmSystemTools::EscapeQuotes(const std::string& str) { - std::string result = ""; - for(const char* ch = str; *ch != '\0'; ++ch) + std::string result; + result.reserve(str.size()); + for(const char* ch = str.c_str(); *ch != '\0'; ++ch) { if(*ch == '"') { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 51c103e..4a212c2 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -47,7 +47,7 @@ public: KeyWOW64 view = KeyWOW64_Default); ///! Escape quotes in a string. - static std::string EscapeQuotes(const char* str); + static std::string EscapeQuotes(const std::string& str); /** Map help document name to file name. */ static std::string HelpFileName(std::string); -- cgit v0.12 From 270eb96df05b93023cdd3d3a186b44b4ece1d655 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 10 Feb 2014 00:21:34 -0500 Subject: strings: Remove cmStdString references Casts from std::string -> cmStdString were high on the list of things taking up time. Avoid such implicit casts across function calls by just using std::string everywhere. The comment that the symbol name is too long is no longer relevant since modern debuggers alias the templates anyways and the size is a non-issue since the underlying methods are generated since it's inherited. --- Source/CPack/cmCPackGeneratorFactory.h | 4 +- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestBZR.cxx | 4 +- Source/CTest/cmCTestBuildAndTestHandler.h | 2 +- Source/CTest/cmCTestBuildHandler.cxx | 12 ++-- Source/CTest/cmCTestBuildHandler.h | 14 ++-- Source/CTest/cmCTestCVS.cxx | 6 +- Source/CTest/cmCTestCVS.h | 4 +- Source/CTest/cmCTestCoverageCommand.h | 2 +- Source/CTest/cmCTestCoverageHandler.cxx | 24 +++---- Source/CTest/cmCTestCoverageHandler.h | 12 ++-- Source/CTest/cmCTestGIT.cxx | 4 +- Source/CTest/cmCTestGenericHandler.h | 2 +- Source/CTest/cmCTestGlobalVC.cxx | 2 +- Source/CTest/cmCTestGlobalVC.h | 4 +- Source/CTest/cmCTestHG.cxx | 4 +- Source/CTest/cmCTestLaunch.cxx | 2 +- Source/CTest/cmCTestLaunch.h | 2 +- Source/CTest/cmCTestMemCheckHandler.cxx | 34 +++++----- Source/CTest/cmCTestMemCheckHandler.h | 10 +-- Source/CTest/cmCTestMultiProcessHandler.cxx | 2 +- Source/CTest/cmCTestMultiProcessHandler.h | 10 +-- Source/CTest/cmCTestP4.cxx | 8 +-- Source/CTest/cmCTestSVN.cxx | 8 +-- Source/CTest/cmCTestScriptHandler.cxx | 4 +- Source/CTest/cmCTestScriptHandler.h | 28 ++++---- Source/CTest/cmCTestSubmitCommand.cxx | 6 +- Source/CTest/cmCTestSubmitHandler.cxx | 98 +++++++++++++-------------- Source/CTest/cmCTestSubmitHandler.h | 60 ++++++++-------- Source/CTest/cmCTestTestHandler.cxx | 30 ++++---- Source/CTest/cmCTestTestHandler.h | 18 ++--- Source/CTest/cmCTestUploadCommand.cxx | 2 +- Source/CTest/cmCTestVC.cxx | 4 +- Source/CTest/cmParseGTMCoverage.cxx | 2 +- Source/CTest/cmParseMumpsCoverage.cxx | 2 +- Source/CTest/cmParseMumpsCoverage.h | 2 +- Source/CTest/cmParsePHPCoverage.cxx | 4 +- Source/CTest/cmParsePHPCoverage.h | 2 +- Source/CursesDialog/cmCursesPathWidget.cxx | 2 +- Source/cmCTest.cxx | 22 +++--- Source/cmCTest.h | 20 +++--- Source/cmCacheManager.cxx | 10 +-- Source/cmCacheManager.h | 8 +-- Source/cmCommandArgumentParserHelper.h | 4 +- Source/cmComputeLinkDepends.cxx | 10 +-- Source/cmComputeLinkDepends.h | 4 +- Source/cmComputeLinkInformation.cxx | 8 +-- Source/cmComputeLinkInformation.h | 10 +-- Source/cmComputeTargetDepends.cxx | 16 ++--- Source/cmComputeTargetDepends.h | 4 +- Source/cmCoreTryCompile.cxx | 2 +- Source/cmCustomCommand.h | 2 +- Source/cmDefinitions.cxx | 20 +++--- Source/cmDefinitions.h | 23 ++++--- Source/cmDependsC.cxx | 16 ++--- Source/cmDependsC.h | 16 ++--- Source/cmDependsFortran.cxx | 40 +++++------ Source/cmDependsJavaParserHelper.cxx | 24 +++---- Source/cmDependsJavaParserHelper.h | 20 +++--- Source/cmDynamicLoader.cxx | 8 +-- Source/cmExportFileGenerator.h | 2 +- Source/cmExportInstallFileGenerator.h | 4 +- Source/cmExportLibraryDependenciesCommand.cxx | 12 ++-- Source/cmExprParserHelper.h | 4 +- Source/cmExtraCodeBlocksGenerator.cxx | 4 +- Source/cmExtraCodeLiteGenerator.cxx | 4 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmExtraSublimeTextGenerator.cxx | 2 +- Source/cmFileTimeComparison.cxx | 4 +- Source/cmFindBase.h | 6 +- Source/cmFindCommon.h | 4 +- Source/cmFindLibraryCommand.cxx | 4 +- Source/cmFindPackageCommand.cxx | 2 +- Source/cmFindPackageCommand.h | 12 ++-- Source/cmFindPathCommand.cxx | 10 +-- Source/cmGeneratorExpression.cxx | 2 +- Source/cmGeneratorExpression.h | 4 +- Source/cmGeneratorExpressionDAGChecker.cxx | 6 +- Source/cmGeneratorExpressionDAGChecker.h | 2 +- Source/cmGeneratorExpressionEvaluator.h | 2 +- Source/cmGeneratorTarget.cxx | 8 +-- Source/cmGetCMakePropertyCommand.cxx | 4 +- Source/cmGlobalGenerator.cxx | 38 +++++------ Source/cmGlobalGenerator.h | 46 ++++++------- Source/cmGlobalKdevelopGenerator.cxx | 6 +- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 12 ++-- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 6 +- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio71Generator.cxx | 4 +- Source/cmGlobalVisualStudio71Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 4 +- Source/cmGlobalVisualStudio7Generator.h | 4 +- Source/cmGlobalVisualStudio8Generator.cxx | 4 +- Source/cmGlobalVisualStudioGenerator.cxx | 8 +-- Source/cmGlobalVisualStudioGenerator.h | 4 +- Source/cmGlobalXCodeGenerator.cxx | 82 +++++++++++----------- Source/cmGlobalXCodeGenerator.h | 16 ++--- Source/cmGraphVizWriter.cxx | 24 +++---- Source/cmGraphVizWriter.h | 12 ++-- Source/cmIDEOptions.cxx | 4 +- Source/cmIDEOptions.h | 4 +- Source/cmIncludeDirectoryCommand.cxx | 2 +- Source/cmInstallCommand.cxx | 2 +- Source/cmInstallExportGenerator.cxx | 2 +- Source/cmInstallTargetGenerator.cxx | 4 +- Source/cmLoadCacheCommand.cxx | 4 +- Source/cmLoadCacheCommand.h | 2 +- Source/cmLocalGenerator.cxx | 20 +++--- Source/cmLocalGenerator.h | 6 +- Source/cmLocalUnixMakefileGenerator3.cxx | 16 ++--- Source/cmLocalUnixMakefileGenerator3.h | 18 ++--- Source/cmLocalVisualStudio6Generator.cxx | 6 +- Source/cmLocalVisualStudio7Generator.cxx | 6 +- Source/cmMakeDepend.h | 6 +- Source/cmMakefile.cxx | 46 ++++++------- Source/cmMakefile.h | 18 ++--- Source/cmMakefileTargetGenerator.cxx | 12 ++-- Source/cmMakefileTargetGenerator.h | 12 ++-- Source/cmNinjaNormalTargetGenerator.cxx | 4 +- Source/cmNinjaTargetGenerator.h | 2 +- Source/cmOSXBundleGenerator.h | 4 +- Source/cmOrderDirectories.cxx | 20 +++--- Source/cmOrderDirectories.h | 10 +-- Source/cmPropertyDefinitionMap.cxx | 6 +- Source/cmPropertyDefinitionMap.h | 8 +-- Source/cmPropertyMap.h | 2 +- Source/cmQtAutoGenerators.cxx | 14 ++-- Source/cmRST.cxx | 4 +- Source/cmRST.h | 4 +- Source/cmSetPropertyCommand.cxx | 12 ++-- Source/cmSetPropertyCommand.h | 2 +- Source/cmSourceGroup.cxx | 2 +- Source/cmSourceGroup.h | 2 +- Source/cmStandardIncludes.h | 4 +- Source/cmSystemTools.cxx | 50 +++----------- Source/cmSystemTools.h | 17 ++--- Source/cmTarget.cxx | 80 +++++++++++----------- Source/cmTarget.h | 24 +++---- Source/cmTest.h | 2 +- Source/cmVariableWatch.h | 2 +- Source/cmVisualStudio10TargetGenerator.h | 4 +- Source/cmVisualStudioGeneratorOptions.cxx | 4 +- Source/cmXCodeObject.cxx | 6 +- Source/cmXCodeObject.h | 20 +++--- Source/cmake.cxx | 2 +- Source/cmake.h | 8 +-- Source/cmcldeps.cxx | 2 +- Source/cmcmd.cxx | 18 ++--- Source/cmcmd.h | 4 +- Tests/CMakeLib/run_compile_commands.cxx | 8 +-- 152 files changed, 808 insertions(+), 844 deletions(-) diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h index e6f74f9..010777f 100644 --- a/Source/CPack/cmCPackGeneratorFactory.h +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -42,7 +42,7 @@ public: void SetLogger(cmCPackLog* logger) { this->Logger = logger; } - typedef std::map DescriptionsMap; + typedef std::map DescriptionsMap; const DescriptionsMap& GetGeneratorsList() const { return this->GeneratorDescriptions; } @@ -50,7 +50,7 @@ private: cmCPackGenerator* NewGeneratorInternal(const std::string& name); std::vector Generators; - typedef std::map t_GeneratorCreatorsMap; + typedef std::map t_GeneratorCreatorsMap; t_GeneratorCreatorsMap GeneratorCreators; DescriptionsMap GeneratorDescriptions; cmCPackLog* Logger; diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index a19b778..d74c38d 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -68,7 +68,7 @@ int cpackUnknownArgument(const char*, void*) //---------------------------------------------------------------------------- struct cpackDefinitions { - typedef std::map MapType; + typedef std::map MapType; MapType Map; cmCPackLog *Log; }; diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 381c70c..840ebc9 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -409,7 +409,7 @@ bool cmCTestBZR::UpdateImpl() { opts = this->CTest->GetCTestConfiguration("BZRUpdateOptions"); } - std::vector args = cmSystemTools::ParseArguments(opts.c_str()); + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); // TODO: if(this->CTest->GetTestModel() == cmCTest::NIGHTLY) @@ -418,7 +418,7 @@ bool cmCTestBZR::UpdateImpl() bzr_update.push_back(this->CommandLineTool.c_str()); bzr_update.push_back("pull"); - for(std::vector::const_iterator ai = args.begin(); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { bzr_update.push_back(ai->c_str()); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index ca50c64..d1e9a4d 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -54,7 +54,7 @@ protected: std::string &cmakeOutString, std::string &cwd, cmake *cm); - cmStdString Output; + std::string Output; std::string BuildGenerator; std::string BuildGeneratorToolset; diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index c5deb96..291c70a 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -380,7 +380,7 @@ int cmCTestBuildHandler::ProcessHandler() // Create lists of regular expression strings for errors, error exceptions, // warnings and warning exceptions. - std::vector::size_type cc; + std::vector::size_type cc; for ( cc = 0; cmCTestErrorMatches[cc]; cc ++ ) { this->CustomErrorMatches.push_back(cmCTestErrorMatches[cc]); @@ -400,7 +400,7 @@ int cmCTestBuildHandler::ProcessHandler() } // Pre-compile regular expressions objects for all regular expressions - std::vector::iterator it; + std::vector::iterator it; #define cmCTestBuildHandlerPopulateRegexVector(strings, regexes) \ regexes.clear(); \ @@ -602,7 +602,7 @@ void cmCTestBuildHandler::GenerateXMLLaunched(std::ostream& os) // Sort XML fragments in chronological order. cmFileTimeComparison ftc; FragmentCompare fragmentCompare(&ftc); - typedef std::set Fragments; + typedef std::set Fragments; Fragments fragments(fragmentCompare); // Identify fragments on disk. @@ -889,7 +889,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, const char* dir, int timeout, std::ostream& ofs) { // First generate the command and arguments - std::vector args = cmSystemTools::ParseArguments(command); + std::vector args = cmSystemTools::ParseArguments(command); if(args.size() < 1) { @@ -897,7 +897,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, } std::vector argv; - for(std::vector::const_iterator a = args.begin(); + for(std::vector::const_iterator a = args.begin(); a != args.end(); ++a) { argv.push_back(a->c_str()); @@ -1133,7 +1133,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, errorwarning.PostContext = ""; // Copy pre-context to report - std::deque::iterator pcit; + std::deque::iterator pcit; for ( pcit = this->PreContext.begin(); pcit != this->PreContext.end(); ++pcit ) diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index ff7cfd6..09346f9 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -97,10 +97,10 @@ private: double StartBuildTime; double EndBuildTime; - std::vector CustomErrorMatches; - std::vector CustomErrorExceptions; - std::vector CustomWarningMatches; - std::vector CustomWarningExceptions; + std::vector CustomErrorMatches; + std::vector CustomErrorExceptions; + std::vector CustomWarningMatches; + std::vector CustomWarningExceptions; std::vector ReallyCustomWarningMatches; std::vector ReallyCustomWarningExceptions; std::vector ErrorWarningFileLineRegex; @@ -121,8 +121,8 @@ private: size_t BuildOutputLogSize; std::vector CurrentProcessingLine; - cmStdString SimplifySourceDir; - cmStdString SimplifyBuildDir; + std::string SimplifySourceDir; + std::string SimplifyBuildDir; size_t OutputLineCounter; typedef std::vector t_ErrorsAndWarningsVector; t_ErrorsAndWarningsVector ErrorsAndWarnings; @@ -130,7 +130,7 @@ private: size_t PostContextCount; size_t MaxPreContext; size_t MaxPostContext; - std::deque PreContext; + std::deque PreContext; int TotalErrors; int TotalWarnings; diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index 17dbb55..ab363d0 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -99,7 +99,7 @@ bool cmCTestCVS::UpdateImpl() opts = "-dP"; } } - std::vector args = cmSystemTools::ParseArguments(opts.c_str()); + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); // Specify the start time for nightly testing. if(this->CTest->GetTestModel() == cmCTest::NIGHTLY) @@ -112,7 +112,7 @@ bool cmCTestCVS::UpdateImpl() cvs_update.push_back(this->CommandLineTool.c_str()); cvs_update.push_back("-z3"); cvs_update.push_back("update"); - for(std::vector::const_iterator ai = args.begin(); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { cvs_update.push_back(ai->c_str()); @@ -308,7 +308,7 @@ bool cmCTestCVS::WriteXMLUpdates(std::ostream& xml) " Gathering version information (one . per updated file):\n" " " << std::flush); - for(std::map::const_iterator + for(std::map::const_iterator di = this->Dirs.begin(); di != this->Dirs.end(); ++di) { this->WriteXMLDirectory(xml, di->first, di->second); diff --git a/Source/CTest/cmCTestCVS.h b/Source/CTest/cmCTestCVS.h index b7fe567..64e1747 100644 --- a/Source/CTest/cmCTestCVS.h +++ b/Source/CTest/cmCTestCVS.h @@ -32,8 +32,8 @@ private: virtual bool WriteXMLUpdates(std::ostream& xml); // Update status for files in each directory. - class Directory: public std::map {}; - std::map Dirs; + class Directory: public std::map {}; + std::map Dirs; std::string ComputeBranchFlag(std::string const& dir); void LoadRevisions(std::string const& file, const char* branchFlag, diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h index 11bb411..3731592 100644 --- a/Source/CTest/cmCTestCoverageCommand.h +++ b/Source/CTest/cmCTestCoverageCommand.h @@ -56,7 +56,7 @@ protected: }; bool LabelsMentioned; - std::set Labels; + std::set Labels; }; diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 0503d94..2e35b75 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -363,7 +363,7 @@ int cmCTestCoverageHandler::ProcessHandler() // setup the regex exclude stuff this->CustomCoverageExcludeRegex.clear(); - std::vector::iterator rexIt; + std::vector::iterator rexIt; for ( rexIt = this->CustomCoverageExclude.begin(); rexIt != this->CustomCoverageExclude.end(); ++ rexIt ) @@ -713,7 +713,7 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf) this->CustomCoverageExclude); this->CTest->PopulateCustomVector(mf, "CTEST_EXTRA_COVERAGE_GLOB", this->ExtraCoverageGlobs); - std::vector::iterator it; + std::vector::iterator it; for ( it = this->CustomCoverageExclude.begin(); it != this->CustomCoverageExclude.end(); ++ it ) @@ -989,8 +989,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( << "--------------------------------------------------------------" << std::endl); - std::vector lines; - std::vector::iterator line; + std::vector lines; + std::vector::iterator line; cmSystemTools::Split(output.c_str(), lines); @@ -1504,7 +1504,7 @@ namespace //---------------------------------------------------------------------- int cmCTestCoverageHandler::RunBullseyeCoverageBranch( cmCTestCoverageHandlerContainer* cont, - std::set& coveredFileNames, + std::set& coveredFileNames, std::vector& files, std::vector& filesFullPath) { @@ -1545,7 +1545,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( outputFile.c_str() << std::endl); return 0; } - std::map fileMap; + std::map fileMap; std::vector::iterator fp = filesFullPath.begin(); for(std::vector::iterator f = files.begin(); f != files.end(); ++f, ++fp) @@ -1558,7 +1558,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( std::string lineIn; bool valid = false; // are we in a valid output file int line = 0; // line of the current file - cmStdString file; + std::string file; while(cmSystemTools::GetLineFromStream(fin, lineIn)) { bool startFile = false; @@ -1593,7 +1593,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( } count++; // move on one } - std::map::iterator + std::map::iterator i = fileMap.find(file); // if the file should be covered write out the header for that file if(i != fileMap.end()) @@ -1758,7 +1758,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( outputFile.c_str() << std::endl); return 0; } - std::set coveredFileNames; + std::set coveredFileNames; while(cmSystemTools::GetLineFromStream(fin, stdline)) { // if we have a line of output from stdout @@ -2105,10 +2105,10 @@ void cmCTestCoverageHandler::WriteXMLLabels(std::ostream& os, //---------------------------------------------------------------------------- void -cmCTestCoverageHandler::SetLabelFilter(std::set const& labels) +cmCTestCoverageHandler::SetLabelFilter(std::set const& labels) { this->LabelFilter.clear(); - for(std::set::const_iterator li = labels.begin(); + for(std::set::const_iterator li = labels.begin(); li != labels.end(); ++li) { this->LabelFilter.insert(this->GetLabelId(*li)); @@ -2158,7 +2158,7 @@ std::set cmCTestCoverageHandler::FindUncoveredFiles( { std::set extraMatches; - for(std::vector::iterator i = this->ExtraCoverageGlobs.begin(); + for(std::vector::iterator i = this->ExtraCoverageGlobs.begin(); i != this->ExtraCoverageGlobs.end(); ++i) { cmsys::Glob gl; diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index 660f501..6a8f55d 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -55,7 +55,7 @@ public: void PopulateCustomVectors(cmMakefile *mf); /** Report coverage only for sources with these labels. */ - void SetLabelFilter(std::set const& labels); + void SetLabelFilter(std::set const& labels); private: bool ShouldIDoCoverage(const char* file, const char* srcDir, @@ -81,7 +81,7 @@ private: int HandleBullseyeCoverage(cmCTestCoverageHandlerContainer* cont); int RunBullseyeSourceSummary(cmCTestCoverageHandlerContainer* cont); int RunBullseyeCoverageBranch(cmCTestCoverageHandlerContainer* cont, - std::set& coveredFileNames, + std::set& coveredFileNames, std::vector& files, std::vector& filesFullPath); @@ -112,19 +112,19 @@ private: std::set FindUncoveredFiles( cmCTestCoverageHandlerContainer* cont); - std::vector CustomCoverageExclude; + std::vector CustomCoverageExclude; std::vector CustomCoverageExcludeRegex; - std::vector ExtraCoverageGlobs; + std::vector ExtraCoverageGlobs; // Map from source file to label ids. class LabelSet: public std::set {}; - typedef std::map LabelMapType; + typedef std::map LabelMapType; LabelMapType SourceLabels; LabelMapType TargetDirs; // Map from label name to label id. - typedef std::map LabelIdMapType; + typedef std::map LabelIdMapType; LabelIdMapType LabelIdMap; std::vector Labels; int GetLabelId(std::string const& label); diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 0e0e797..aaa01b2 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -179,8 +179,8 @@ bool cmCTestGIT::UpdateByFetchAndReset() { opts = this->CTest->GetCTestConfiguration("GITUpdateOptions"); } - std::vector args = cmSystemTools::ParseArguments(opts.c_str()); - for(std::vector::const_iterator ai = args.begin(); + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { git_fetch.push_back(ai->c_str()); diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index d05e230..2788cba 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -71,7 +71,7 @@ public: cmCTestGenericHandler(); virtual ~cmCTestGenericHandler(); - typedef std::map t_StringToString; + typedef std::map t_StringToString; void SetPersistentOption(const std::string& op, const char* value); diff --git a/Source/CTest/cmCTestGlobalVC.cxx b/Source/CTest/cmCTestGlobalVC.cxx index 8c51102..5f570b5 100644 --- a/Source/CTest/cmCTestGlobalVC.cxx +++ b/Source/CTest/cmCTestGlobalVC.cxx @@ -132,7 +132,7 @@ bool cmCTestGlobalVC::WriteXMLUpdates(std::ostream& xml) this->WriteXMLGlobal(xml); - for(std::map::const_iterator + for(std::map::const_iterator di = this->Dirs.begin(); di != this->Dirs.end(); ++di) { this->WriteXMLDirectory(xml, di->first, di->second); diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h index a648a59..cb0d165 100644 --- a/Source/CTest/cmCTestGlobalVC.h +++ b/Source/CTest/cmCTestGlobalVC.h @@ -39,8 +39,8 @@ protected: }; // Update status for files in each directory. - class Directory: public std::map {}; - std::map Dirs; + class Directory: public std::map {}; + std::map Dirs; // Old and new repository revisions. std::string OldRevision; diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index 86a7617..5bf9949 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -149,8 +149,8 @@ bool cmCTestHG::UpdateImpl() { opts = this->CTest->GetCTestConfiguration("HGUpdateOptions"); } - std::vector args = cmSystemTools::ParseArguments(opts.c_str()); - for(std::vector::const_iterator ai = args.begin(); + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { hg_update.push_back(ai->c_str()); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index cd3bd57..c9f9e9e 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -567,7 +567,7 @@ void cmCTestLaunch::WriteXMLLabels(std::ostream& fxml) fxml << "\n"; fxml << "\t\t\n"; fxml << "\t\t\n"; - for(std::set::const_iterator li = this->Labels.begin(); + for(std::set::const_iterator li = this->Labels.begin(); li != this->Labels.end(); ++li) { fxml << "\t\t\t\n"; diff --git a/Source/CTest/cmCTestLaunch.h b/Source/CTest/cmCTestLaunch.h index f680d19..bc90d28 100644 --- a/Source/CTest/cmCTestLaunch.h +++ b/Source/CTest/cmCTestLaunch.h @@ -73,7 +73,7 @@ private: bool HaveErr; // Labels associated with the build rule. - std::set Labels; + std::set Labels; void LoadLabels(); bool SourceMatches(std::string const& lhs, std::string const& rhs); diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index fdce04d..f2982a4 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -246,8 +246,8 @@ int cmCTestMemCheckHandler::PostProcessHandler() void cmCTestMemCheckHandler::GenerateTestCommand( std::vector& args, int test) { - std::vector::size_type pp; - cmStdString index; + std::vector::size_type pp; + std::string index; cmOStringStream stream; std::string memcheckcommand = cmSystemTools::ConvertToOutputPath(this->MemoryTester.c_str()); @@ -255,9 +255,9 @@ void cmCTestMemCheckHandler::GenerateTestCommand( index = stream.str(); for ( pp = 0; pp < this->MemoryTesterDynamicOptions.size(); pp ++ ) { - cmStdString arg = this->MemoryTesterDynamicOptions[pp]; - cmStdString::size_type pos = arg.find("??"); - if (pos != cmStdString::npos) + std::string arg = this->MemoryTesterDynamicOptions[pp]; + std::string::size_type pos = arg.find("??"); + if (pos != std::string::npos) { arg.replace(pos, 2, index); } @@ -580,7 +580,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() return false; } - std::vector::size_type cc; + std::vector::size_type cc; for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ ) { this->MemoryTesterGlobalResults[cc] = 0; @@ -627,7 +627,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( const std::string& str, std::string& log, int* results) { - std::vector lines; + std::vector lines; cmSystemTools::Split(str.c_str(), lines); cmOStringStream ostr; log = ""; @@ -636,7 +636,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( int defects = 0; - for( std::vector::iterator i = lines.begin(); + for( std::vector::iterator i = lines.begin(); i != lines.end(); ++i) { int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT; @@ -681,7 +681,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( const std::string& str, std::string& log, int* results) { - std::vector lines; + std::vector lines; cmSystemTools::Split(str.c_str(), lines); bool unlimitedOutput = false; if(str.find("CTEST_FULL_OUTPUT") != str.npos || @@ -864,10 +864,10 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( { log = ""; double sttime = cmSystemTools::GetTime(); - std::vector lines; + std::vector lines; cmSystemTools::Split(str.c_str(), lines); cmCTestLog(this->CTest, DEBUG, "Start test: " << lines.size() << std::endl); - std::vector::size_type cc; + std::vector::size_type cc; for ( cc = 0; cc < lines.size(); cc ++ ) { if(lines[cc] == BOUNDS_CHECKER_MARKER) @@ -923,7 +923,7 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessBoundsCheckerTest for : " << res.Name.c_str() << std::endl); - cmStdString ofile = testOutputFileName(test); + std::string ofile = testOutputFileName(test); if ( ofile.empty() ) { return; @@ -979,7 +979,7 @@ void cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res, int test) { - cmStdString ofile = testOutputFileName(test); + std::string ofile = testOutputFileName(test); if ( ofile.empty() ) { @@ -1000,15 +1000,15 @@ cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res, } } -cmStdString +std::string cmCTestMemCheckHandler::testOutputFileName(int test) { - cmStdString index; + std::string index; cmOStringStream stream; stream << test; index = stream.str(); - cmStdString ofile = this->MemoryTesterOutputFile; - cmStdString::size_type pos = ofile.find("??"); + std::string ofile = this->MemoryTesterOutputFile; + std::string::size_type pos = ofile.find("??"); ofile.replace(pos, 2, index); if ( !cmSystemTools::FileExists(ofile.c_str()) ) diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 040d2e0..0521a48 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -89,8 +89,8 @@ private: std::string BoundsCheckerDPBDFile; std::string BoundsCheckerXMLFile; std::string MemoryTester; - std::vector MemoryTesterDynamicOptions; - std::vector MemoryTesterOptions; + std::vector MemoryTesterDynamicOptions; + std::vector MemoryTesterOptions; int MemoryTesterStyle; std::string MemoryTesterOutputFile; int MemoryTesterGlobalResults[NO_MEMORY_FAULT]; @@ -103,8 +103,8 @@ private: */ void GenerateDartOutput(std::ostream& os); - std::vector CustomPreMemCheck; - std::vector CustomPostMemCheck; + std::vector CustomPreMemCheck; + std::vector CustomPostMemCheck; //! Parse Valgrind/Purify/Bounds Checker result out of the output //string. After running, log holds the output and results hold the @@ -127,7 +127,7 @@ private: int test); ///! generate the output filename for the given test index - cmStdString testOutputFileName(int test); + std::string testOutputFileName(int test); }; #endif diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index ddd1707..c979be3 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -369,7 +369,7 @@ void cmCTestMultiProcessHandler::UpdateCostData() // Write list of failed tests fout << "---\n"; - for(std::vector::iterator i = this->Failed->begin(); + for(std::vector::iterator i = this->Failed->begin(); i != this->Failed->end(); ++i) { fout << i->c_str() << "\n"; diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 1b53ec7..605de31 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -41,8 +41,8 @@ public: void PrintTestList(); void PrintLabels(); - void SetPassFailVectors(std::vector* passed, - std::vector* failed) + void SetPassFailVectors(std::vector* passed, + std::vector* failed) { this->Passed = passed; this->Failed = failed; @@ -107,9 +107,9 @@ protected: PropertiesMap Properties; std::map TestRunningMap; std::map TestFinishMap; - std::map TestOutput; - std::vector* Passed; - std::vector* Failed; + std::map TestOutput; + std::vector* Passed; + std::vector* Failed; std::vector LastTestsFailed; std::set LockedResources; std::vector* TestResults; diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index b09d6f5..1ad94bc 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -346,10 +346,10 @@ void cmCTestP4::SetP4Options(std::vector &CommandOptions) //The CTEST_P4_OPTIONS variable adds additional Perforce command line //options before the main command std::string opts = this->CTest->GetCTestConfiguration("P4Options"); - std::vector args = + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); - for(std::vector::const_iterator ai = args.begin(); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { P4Options.push_back(ai->c_str()); @@ -538,8 +538,8 @@ bool cmCTestP4::UpdateImpl() { opts = this->CTest->GetCTestConfiguration("P4UpdateOptions"); } - std::vector args = cmSystemTools::ParseArguments(opts.c_str()); - for(std::vector::const_iterator ai = args.begin(); + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { p4_sync.push_back(ai->c_str()); diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 2668c8e..89592dd 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -277,7 +277,7 @@ bool cmCTestSVN::UpdateImpl() { opts = this->CTest->GetCTestConfiguration("SVNUpdateOptions"); } - std::vector args = cmSystemTools::ParseArguments(opts.c_str()); + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); // Specify the start time for nightly testing. if(this->CTest->GetTestModel() == cmCTest::NIGHTLY) @@ -287,7 +287,7 @@ bool cmCTestSVN::UpdateImpl() std::vector svn_update; svn_update.push_back("update"); - for(std::vector::const_iterator ai = args.begin(); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { svn_update.push_back(ai->c_str()); @@ -314,9 +314,9 @@ bool cmCTestSVN::RunSVNCommand(std::vector const& parameters, std::string userOptions = this->CTest->GetCTestConfiguration("SVNOptions"); - std::vector parsedUserOptions = + std::vector parsedUserOptions = cmSystemTools::ParseArguments(userOptions.c_str()); - for(std::vector::iterator i = parsedUserOptions.begin(); + for(std::vector::iterator i = parsedUserOptions.begin(); i != parsedUserOptions.end(); ++i) { args.push_back(i->c_str()); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 00a0a09..7f13855 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -231,7 +231,7 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) cmSystemTools::GetCTestCommand() << "\n"); // now pass through all the other arguments - std::vector &initArgs = + std::vector &initArgs = this->CTest->GetInitialCommandLineArguments(); //*** need to make sure this does not have the current script *** for(size_t i=1; i < initArgs.size(); ++i) @@ -766,7 +766,7 @@ int cmCTestScriptHandler::PerformExtraUpdates() // do an initial cvs update as required command = this->UpdateCmd; - std::vector::iterator it; + std::vector::iterator it; for (it = this->ExtraUpdates.begin(); it != this->ExtraUpdates.end(); ++ it ) diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index 44e9dd0..42c2f20 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -138,26 +138,26 @@ private: // Try to remove the binary directory once static bool TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath); - std::vector ConfigurationScripts; + std::vector ConfigurationScripts; std::vector ScriptProcessScope; bool Backup; bool EmptyBinDir; bool EmptyBinDirOnce; - cmStdString SourceDir; - cmStdString BinaryDir; - cmStdString BackupSourceDir; - cmStdString BackupBinaryDir; - cmStdString CTestRoot; - cmStdString CVSCheckOut; - cmStdString CTestCmd; - cmStdString UpdateCmd; - cmStdString CTestEnv; - cmStdString InitialCache; - cmStdString CMakeCmd; - cmStdString CMOutFile; - std::vector ExtraUpdates; + std::string SourceDir; + std::string BinaryDir; + std::string BackupSourceDir; + std::string BackupBinaryDir; + std::string CTestRoot; + std::string CVSCheckOut; + std::string CTestCmd; + std::string UpdateCmd; + std::string CTestEnv; + std::string InitialCache; + std::string CMakeCmd; + std::string CMOutFile; + std::vector ExtraUpdates; double MinimumInterval; double ContinuousDuration; diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 24974e3..07a994d 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -72,7 +72,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() if (notesFilesVariable) { std::vector notesFiles; - std::vector newNotesFiles; + cmCTest::VectorOfStrings newNotesFiles; cmSystemTools::ExpandListArgument(notesFilesVariable,notesFiles); std::vector::iterator it; for ( it = notesFiles.begin(); @@ -89,7 +89,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() if (extraFilesVariable) { std::vector extraFiles; - std::vector newExtraFiles; + cmCTest::VectorOfStrings newExtraFiles; cmSystemTools::ExpandListArgument(extraFilesVariable,extraFiles); std::vector::iterator it; for ( it = extraFiles.begin(); @@ -222,7 +222,7 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg) if(this->ArgumentDoing == ArgumentDoingFiles) { - cmStdString filename(arg); + std::string filename(arg); if(cmSystemTools::FileExists(filename.c_str())) { this->Files.insert(filename); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 139f515..1cd8fc7 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -170,10 +170,10 @@ void cmCTestSubmitHandler::Initialize() } //---------------------------------------------------------------------------- -bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url) +bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url) { CURL *curl; CURLcode res; @@ -217,12 +217,12 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix, ::curl_easy_setopt(curl, CURLOPT_UPLOAD, 1); - cmStdString local_file = *file; + std::string local_file = *file; if ( !cmSystemTools::FileExists(local_file.c_str()) ) { local_file = localprefix + "/" + *file; } - cmStdString upload_as + std::string upload_as = url + "/" + remoteprefix + cmSystemTools::GetFilenameName(*file); struct stat st; @@ -324,10 +324,10 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix, //---------------------------------------------------------------------------- // Uploading files is simpler -bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url) +bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url) { CURL *curl; CURLcode res; @@ -336,8 +336,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, /* In windows, this will init the winsock stuff */ ::curl_global_init(CURL_GLOBAL_ALL); - cmStdString dropMethod(this->CTest->GetCTestConfiguration("DropMethod")); - cmStdString curlopt(this->CTest->GetCTestConfiguration("CurlOptions")); + std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod")); + std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions")); std::vector args; cmSystemTools::ExpandListArgument(curlopt.c_str(), args); bool verifyPeerOff = false; @@ -354,7 +354,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, verifyHostOff = true; } } - cmStdString::size_type kk; + std::string::size_type kk; cmCTest::SetOfStrings::const_iterator file; for ( file = files.begin(); file != files.end(); ++file ) { @@ -414,18 +414,18 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, ::curl_easy_setopt(curl, CURLOPT_PUT, 1); ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); - cmStdString local_file = *file; + std::string local_file = *file; if ( !cmSystemTools::FileExists(local_file.c_str()) ) { local_file = localprefix + "/" + *file; } - cmStdString remote_file + std::string remote_file = remoteprefix + cmSystemTools::GetFilenameName(*file); *this->LogFile << "\tUpload file: " << local_file.c_str() << " to " << remote_file.c_str() << std::endl; - cmStdString ofile = ""; + std::string ofile = ""; for ( kk = 0; kk < remote_file.size(); kk ++ ) { char c = remote_file[kk]; @@ -448,8 +448,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, ofile.append(hexCh); } } - cmStdString upload_as - = url + ((url.find("?",0) == cmStdString::npos) ? "?" : "&") + std::string upload_as + = url + ((url.find("?",0) == std::string::npos) ? "?" : "&") + "FileName=" + ofile; upload_as += "&MD5="; @@ -666,9 +666,9 @@ void cmCTestSubmitHandler //---------------------------------------------------------------------------- bool cmCTestSubmitHandler::TriggerUsingHTTP( - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url) + const std::set& files, + const std::string& remoteprefix, + const std::string& url) { CURL *curl; char error_buffer[1024]; @@ -721,10 +721,10 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( ::curl_easy_setopt(curl, CURLOPT_FILE, (void *)&chunk); ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void *)&chunkDebug); - cmStdString rfile + std::string rfile = remoteprefix + cmSystemTools::GetFilenameName(*file); - cmStdString ofile = ""; - cmStdString::iterator kk; + std::string ofile = ""; + std::string::iterator kk; for ( kk = rfile.begin(); kk < rfile.end(); ++ kk) { char c = *kk; @@ -747,8 +747,8 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( ofile.append(hexCh); } } - cmStdString turl - = url + ((url.find("?",0) == cmStdString::npos) ? "?" : "&") + std::string turl + = url + ((url.find("?",0) == std::string::npos) ? "?" : "&") + "xmlfile=" + ofile; *this->LogFile << "Trigger url: " << turl.c_str() << std::endl; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Trigger url: " @@ -805,11 +805,11 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( //---------------------------------------------------------------------------- bool cmCTestSubmitHandler::SubmitUsingSCP( - const cmStdString& scp_command, - const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url) + const std::string& scp_command, + const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url) { if ( !scp_command.size() || !localprefix.size() || !files.size() || !remoteprefix.size() || !url.size() ) @@ -906,10 +906,10 @@ bool cmCTestSubmitHandler::SubmitUsingSCP( //---------------------------------------------------------------------------- bool cmCTestSubmitHandler::SubmitUsingCP( - const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& destination) + const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& destination) { if ( !localprefix.size() || !files.size() || !remoteprefix.size() || !destination.size() ) @@ -947,17 +947,17 @@ bool cmCTestSubmitHandler::SubmitUsingCP( //---------------------------------------------------------------------------- #if defined(CTEST_USE_XMLRPC) -bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url) +bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url) { xmlrpc_env env; char ctestString[] = "CTest"; std::string ctestVersionString = cmVersion::GetCMakeVersion(); char* ctestVersion = const_cast(ctestVersionString.c_str()); - cmStdString realURL = url + "/" + remoteprefix + "/Command/"; + std::string realURL = url + "/" + remoteprefix + "/Command/"; /* Start up our XML-RPC client library. */ xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, ctestString, ctestVersion); @@ -973,7 +973,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix, { xmlrpc_value *result; - cmStdString local_file = *file; + std::string local_file = *file; if ( !cmSystemTools::FileExists(local_file.c_str()) ) { local_file = localprefix + "/" + *file; @@ -1045,10 +1045,10 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix, return true; } #else -bool cmCTestSubmitHandler::SubmitUsingXMLRPC(cmStdString const&, - std::set const&, - cmStdString const&, - cmStdString const&) +bool cmCTestSubmitHandler::SubmitUsingXMLRPC(std::string const&, + std::set const&, + std::string const&, + std::string const&) { return false; } @@ -1085,7 +1085,7 @@ int cmCTestSubmitHandler::ProcessHandler() } if ( getenv("HTTP_PROXY_TYPE") ) { - cmStdString type = getenv("HTTP_PROXY_TYPE"); + std::string type = getenv("HTTP_PROXY_TYPE"); // HTTP/SOCKS4/SOCKS5 if ( type == "HTTP" ) { @@ -1122,7 +1122,7 @@ int cmCTestSubmitHandler::ProcessHandler() } if ( getenv("FTP_PROXY_TYPE") ) { - cmStdString type = getenv("FTP_PROXY_TYPE"); + std::string type = getenv("FTP_PROXY_TYPE"); // HTTP/SOCKS4/SOCKS5 if ( type == "HTTP" ) { @@ -1178,7 +1178,7 @@ int cmCTestSubmitHandler::ProcessHandler() this->CTest->AddIfExists(cmCTest::PartTest, "Test.xml"); if(this->CTest->AddIfExists(cmCTest::PartCoverage, "Coverage.xml")) { - cmCTest::VectorOfStrings gfiles; + std::vector gfiles; std::string gpath = buildDirectory + "/Testing/" + this->CTest->GetCurrentTag(); std::string::size_type glen = gpath.size() + 1; @@ -1247,7 +1247,7 @@ int cmCTestSubmitHandler::ProcessHandler() } this->SetLogFile(&ofs); - cmStdString dropMethod(this->CTest->GetCTestConfiguration("DropMethod")); + std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod")); if ( dropMethod == "" || dropMethod == "ftp" ) { diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index 14eac80..accabd1 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -47,33 +47,33 @@ private: /** * Submit file using various ways */ - bool SubmitUsingFTP(const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url); - bool SubmitUsingHTTP(const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url); - bool SubmitUsingSCP(const cmStdString& scp_command, - const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url); - - bool SubmitUsingCP( const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url); - - bool TriggerUsingHTTP(const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url); - - bool SubmitUsingXMLRPC(const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url); + bool SubmitUsingFTP(const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url); + bool SubmitUsingHTTP(const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url); + bool SubmitUsingSCP(const std::string& scp_command, + const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url); + + bool SubmitUsingCP( const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url); + + bool TriggerUsingHTTP(const std::set& files, + const std::string& remoteprefix, + const std::string& url); + + bool SubmitUsingXMLRPC(const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url); typedef std::vector cmCTestSubmitHandlerVectorOfChar; @@ -82,10 +82,10 @@ private: std::string GetSubmitResultsPrefix(); class ResponseParser; - cmStdString HTTPProxy; + std::string HTTPProxy; int HTTPProxyType; - cmStdString HTTPProxyAuth; - cmStdString FTPProxy; + std::string HTTPProxyAuth; + std::string FTPProxy; int FTPProxyType; std::ostream* LogFile; bool SubmitPart[cmCTest::PartCount]; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 3a04b33..b1dddcb 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -540,8 +540,8 @@ int cmCTestTestHandler::ProcessHandler() this->StartLogFile((this->MemCheck ? "DynamicAnalysis" : "Test"), mLogFile); this->LogFile = &mLogFile; - std::vector passed; - std::vector failed; + std::vector passed; + std::vector failed; int total; //start the real time clock @@ -569,7 +569,7 @@ int cmCTestTestHandler::ProcessHandler() { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl << "The following tests passed:" << std::endl); - for(std::vector::iterator j = passed.begin(); + for(std::vector::iterator j = passed.begin(); j != passed.end(); ++j) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\t" << *j @@ -661,8 +661,8 @@ void cmCTestTestHandler::PrintLabelSummary() cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin(); cmCTestTestHandler::TestResultsVector::iterator ri = this->TestResults.begin(); - std::map labelTimes; - std::set labels; + std::map labelTimes; + std::set labels; // initialize maps std::string::size_type maxlen = 0; for(; it != this->TestList.end(); ++it) @@ -702,7 +702,7 @@ void cmCTestTestHandler::PrintLabelSummary() { cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:"); } - for(std::set::const_iterator i = labels.begin(); + for(std::set::const_iterator i = labels.begin(); i != labels.end(); ++i) { std::string label = *i; @@ -1050,8 +1050,8 @@ bool cmCTestTestHandler::GetValue(const char* tag, } //--------------------------------------------------------------------- -void cmCTestTestHandler::ProcessDirectory(std::vector &passed, - std::vector &failed) +void cmCTestTestHandler::ProcessDirectory(std::vector &passed, + std::vector &failed) { this->ComputeTestList(); this->StartTest = this->CTest->CurrentTime(); @@ -1216,7 +1216,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os) << "name=\"Command Line\">" << cmXMLSafe(result->FullCommandLine) << "\n"; - std::map::iterator measureIt; + std::map::iterator measureIt; for ( measureIt = result->Properties->Measurements.begin(); measureIt != result->Properties->Measurements.end(); ++ measureIt ) @@ -1328,9 +1328,9 @@ void cmCTestTestHandler::AttachFiles(std::ostream& os, } //---------------------------------------------------------------------- -int cmCTestTestHandler::ExecuteCommands(std::vector& vec) +int cmCTestTestHandler::ExecuteCommands(std::vector& vec) { - std::vector::iterator it; + std::vector::iterator it; for ( it = vec.begin(); it != vec.end(); ++it ) { int retVal = 0; @@ -2112,7 +2112,7 @@ bool cmCTestTestHandler::SetTestsProperties( const std::vector& args) { std::vector::const_iterator it; - std::vector tests; + std::vector tests; bool found = false; for ( it = args.begin(); it != args.end(); ++ it ) { @@ -2137,7 +2137,7 @@ bool cmCTestTestHandler::SetTestsProperties( break; } std::string val = *it; - std::vector::const_iterator tit; + std::vector::const_iterator tit; for ( tit = tests.begin(); tit != tests.end(); ++ tit ) { cmCTestTestHandler::ListOfTests::iterator rtit; @@ -2319,7 +2319,7 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) } if ( this->MemCheck ) { - std::vector::iterator it; + std::vector::iterator it; bool found = false; for ( it = this->CustomTestsIgnore.begin(); it != this->CustomTestsIgnore.end(); ++ it ) @@ -2339,7 +2339,7 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) } else { - std::vector::iterator it; + std::vector::iterator it; bool found = false; for ( it = this->CustomTestsIgnore.begin(); it != this->CustomTestsIgnore.end(); ++ it ) diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 63f9c93..fe43bb8 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -87,8 +87,8 @@ public: // ctest -j N will break for that feature struct cmCTestTestProperties { - cmStdString Name; - cmStdString Directory; + std::string Name; + std::string Directory; std::vector Args; std::vector RequiredFiles; std::vector Depends; @@ -98,7 +98,7 @@ public: std::string> > ErrorRegularExpressions; std::vector > RequiredRegularExpressions; - std::map Measurements; + std::map Measurements; bool IsInBasedOnREOptions; bool WillFail; float Cost; @@ -162,7 +162,7 @@ protected: virtual int PreProcessHandler(); virtual int PostProcessHandler(); virtual void GenerateTestCommand(std::vector& args, int test); - int ExecuteCommands(std::vector& vec); + int ExecuteCommands(std::vector& vec); void WriteTestResultHeader(std::ostream& os, cmCTestTestResult* result); void WriteTestResultFooter(std::ostream& os, cmCTestTestResult* result); @@ -177,7 +177,7 @@ protected: typedef std::vector TestResultsVector; TestResultsVector TestResults; - std::vector CustomTestsIgnore; + std::vector CustomTestsIgnore; std::string StartTest; std::string EndTest; unsigned int StartTestTime; @@ -210,8 +210,8 @@ private: /** * Run the tests for a directory and any subdirectories */ - void ProcessDirectory(std::vector &passed, - std::vector &failed); + void ProcessDirectory(std::vector &passed, + std::vector &failed); /** * Get the list of tests in directory and subdirectories. @@ -251,8 +251,8 @@ private: void ExpandTestsToRunInformation(size_t numPossibleTests); void ExpandTestsToRunInformationForRerunFailed(); - std::vector CustomPreTest; - std::vector CustomPostTest; + std::vector CustomPreTest; + std::vector CustomPostTest; std::vector TestsToRun; diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx index 731c1c7..f7de294 100644 --- a/Source/CTest/cmCTestUploadCommand.cxx +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -47,7 +47,7 @@ bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg) { if(this->ArgumentDoing == ArgumentDoingFiles) { - cmStdString filename(arg); + std::string filename(arg); if(cmSystemTools::FileExists(filename.c_str())) { this->Files.insert(filename); diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index fbee227..f89fa2b 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -63,9 +63,9 @@ bool cmCTestVC::InitialCheckout(const char* command) } // Construct the initial checkout command line. - std::vector args = cmSystemTools::ParseArguments(command); + std::vector args = cmSystemTools::ParseArguments(command); std::vector vc_co; - for(std::vector::const_iterator ai = args.begin(); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { vc_co.push_back(ai->c_str()); diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx index 528d0db..5bcfeac 100644 --- a/Source/CTest/cmParseGTMCoverage.cxx +++ b/Source/CTest/cmParseGTMCoverage.cxx @@ -182,7 +182,7 @@ bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line, // ( file , entry ) = "number_executed:timing_info" // ^COVERAGE("%RSEL","init",8,"FOR_LOOP",1)=1 // ( file , entry, line, IGNORE ) =number_executed - std::vector args; + std::vector args; std::string::size_type pos = line.find('(', 0); // if no ( is found, then return line has no coverage if(pos == std::string::npos) diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index 6226feb..fe98964 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -140,7 +140,7 @@ bool cmParseMumpsCoverage::LoadPackages(const char* d) bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine, std::string& filepath) { - std::map::iterator i = + std::map::iterator i = this->RoutineToDirectory.find(routine); if(i != this->RoutineToDirectory.end()) { diff --git a/Source/CTest/cmParseMumpsCoverage.h b/Source/CTest/cmParseMumpsCoverage.h index c1effa7..bc71891 100644 --- a/Source/CTest/cmParseMumpsCoverage.h +++ b/Source/CTest/cmParseMumpsCoverage.h @@ -44,7 +44,7 @@ protected: bool FindMumpsFile(std::string const& routine, std::string& filepath); protected: - std::map RoutineToDirectory; + std::map RoutineToDirectory; cmCTestCoverageHandlerContainer& Coverage; cmCTest* CTest; }; diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx index 1c26c1c..3b7f968 100644 --- a/Source/CTest/cmParsePHPCoverage.cxx +++ b/Source/CTest/cmParsePHPCoverage.cxx @@ -34,7 +34,7 @@ bool cmParsePHPCoverage::ReadUntil(std::istream& in, char until) return true; } bool cmParsePHPCoverage::ReadCoverageArray(std::istream& in, - cmStdString const& fileName) + std::string const& fileName) { cmCTestCoverageHandlerContainer::SingleFileCoverageVector& coverageVector = this->Coverage.TotalCoverage[fileName]; @@ -166,7 +166,7 @@ bool cmParsePHPCoverage::ReadFileInformation(std::istream& in) // read the string data in.read(s, size-1); s[size-1] = 0; - cmStdString fileName = s; + std::string fileName = s; delete [] s; // read close quote if(in.get(c) && c != '"') diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h index 035a093..92a7634 100644 --- a/Source/CTest/cmParsePHPCoverage.h +++ b/Source/CTest/cmParsePHPCoverage.h @@ -35,7 +35,7 @@ private: bool ReadArraySize(std::istream& in, int& size); bool ReadFileInformation(std::istream& in); bool ReadInt(std::istream& in, int& v); - bool ReadCoverageArray(std::istream& in, cmStdString const&); + bool ReadCoverageArray(std::istream& in, std::string const&); bool ReadUntil(std::istream& in, char until); cmCTestCoverageHandlerContainer& Coverage; cmCTest* CTest; diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx index 14c325b..893ca99 100644 --- a/Source/CursesDialog/cmCursesPathWidget.cxx +++ b/Source/CursesDialog/cmCursesPathWidget.cxx @@ -57,7 +57,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) { glob = cstr + "*"; } - std::vector dirs; + std::vector dirs; cmSystemTools::SimpleGlob(glob.c_str(), dirs, (this->Type == cmCacheManager::PATH?-1:0)); if ( this->CurrentIndex < dirs.size() ) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 72bb7fd..ee9b664 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1153,7 +1153,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output, int* retVal, const char* dir, int timeout, std::ostream& ofs) { // First generate the command and arguments - std::vector args = cmSystemTools::ParseArguments(command); + std::vector args = cmSystemTools::ParseArguments(command); if(args.size() < 1) { @@ -1161,7 +1161,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output, } std::vector argv; - for(std::vector::const_iterator a = args.begin(); + for(std::vector::const_iterator a = args.begin(); a != args.end(); ++a) { argv.push_back(a->c_str()); @@ -1637,7 +1637,7 @@ int cmCTest::GenerateCTestNotesOutput(std::ostream& os, } //---------------------------------------------------------------------- -int cmCTest::GenerateNotesFile(const std::vector &files) +int cmCTest::GenerateNotesFile(const VectorOfStrings &files) { cmGeneratedFileStream ofs; if ( !this->OpenOutputFile(this->CurrentTag, "Notes.xml", ofs) ) @@ -1658,7 +1658,7 @@ int cmCTest::GenerateNotesFile(const char* cfiles) return 1; } - std::vector files; + VectorOfStrings files; cmCTestLog(this, OUTPUT, "Create notes file" << std::endl); @@ -1675,7 +1675,7 @@ int cmCTest::GenerateNotesFile(const char* cfiles) std::string cmCTest::Base64GzipEncodeFile(std::string file) { std::string tarFile = file + "_temp.tar.gz"; - std::vector files; + std::vector files; files.push_back(file); if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false, false)) @@ -1722,9 +1722,9 @@ std::string cmCTest::Base64EncodeFile(std::string file) //---------------------------------------------------------------------- -bool cmCTest::SubmitExtraFiles(const std::vector &files) +bool cmCTest::SubmitExtraFiles(const VectorOfStrings &files) { - std::vector::const_iterator it; + VectorOfStrings::const_iterator it; for ( it = files.begin(); it != files.end(); ++ it ) @@ -1749,7 +1749,7 @@ bool cmCTest::SubmitExtraFiles(const char* cfiles) return 1; } - std::vector files; + VectorOfStrings files; cmCTestLog(this, OUTPUT, "Submit extra files" << std::endl); @@ -2594,7 +2594,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) //---------------------------------------------------------------------- void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def, - VectorOfStrings& vec) + std::vector& vec) { const char* dval = mf->GetDefinition(def); if ( !dval ) @@ -2892,7 +2892,7 @@ bool cmCTest::RunCommand( const char* dir, double timeout) { - std::vector args = cmSystemTools::ParseArguments(command); + std::vector args = cmSystemTools::ParseArguments(command); if(args.size() < 1) { @@ -2900,7 +2900,7 @@ bool cmCTest::RunCommand( } std::vector argv; - for(std::vector::const_iterator a = args.begin(); + for(std::vector::const_iterator a = args.begin(); a != args.end(); ++a) { argv.push_back(a->c_str()); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 1eb0e01..836e41d 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -101,8 +101,8 @@ public: if the string does not name a valid part. */ Part GetPartFromName(const char* name); - typedef std::vector VectorOfStrings; - typedef std::set SetOfStrings; + typedef std::vector VectorOfStrings; + typedef std::set SetOfStrings; ///! Process Command line arguments int Run(std::vector &, std::string* output = 0); @@ -186,7 +186,7 @@ public: void SetNotesFiles(const char* notes); void PopulateCustomVector(cmMakefile* mf, const std::string& definition, - VectorOfStrings& vec); + std::vector& vec); void PopulateCustomInteger(cmMakefile* mf, const std::string& def, int& val); @@ -352,11 +352,11 @@ public: void AddCTestConfigurationOverwrite(const std::string& encstr); //! Create XML file that contains all the notes specified - int GenerateNotesFile(const std::vector &files); + int GenerateNotesFile(const VectorOfStrings &files); //! Submit extra files to the server bool SubmitExtraFiles(const char* files); - bool SubmitExtraFiles(const std::vector &files); + bool SubmitExtraFiles(const VectorOfStrings &files); //! Set the output log file name void SetOutputLogFileName(const char* name); @@ -391,7 +391,7 @@ public: //! Read the custom configuration files and apply them to the current ctest int ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf); - std::vector &GetInitialCommandLineArguments() + std::vector &GetInitialCommandLineArguments() { return this->InitialCommandLineArguments; }; //! Set the track to submit to @@ -447,13 +447,13 @@ private: void DetermineNextDayStop(); // these are helper classes - typedef std::map t_TestingHandlers; + typedef std::map t_TestingHandlers; t_TestingHandlers TestingHandlers; bool ShowOnly; //! Map of configuration properties - typedef std::map CTestConfigurationMap; + typedef std::map CTestConfigurationMap; std::string CTestConfigFile; // TODO: The ctest configuration should be a hierarchy of @@ -463,7 +463,7 @@ private: CTestConfigurationMap CTestConfiguration; CTestConfigurationMap CTestConfigurationOverwrites; PartInfo Parts[PartCount]; - typedef std::map PartMapType; + typedef std::map PartMapType; PartMapType PartMap; std::string CurrentTag; @@ -556,7 +556,7 @@ private: int DartVersion; bool DropSiteCDash; - std::vector InitialCommandLineArguments; + std::vector InitialCommandLineArguments; int SubmitIndex; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 141fde5..39b9ae5 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -90,7 +90,7 @@ bool cmCacheManager::LoadCache(const std::string& path) bool cmCacheManager::LoadCache(const std::string& path, bool internal) { - std::set emptySet; + std::set emptySet; return this->LoadCache(path, internal, emptySet, emptySet); } @@ -195,8 +195,8 @@ void cmCacheManager::CleanCMakeFiles(const std::string& path) bool cmCacheManager::LoadCache(const std::string& path, bool internal, - std::set& excludes, - std::set& includes) + std::set& excludes, + std::set& includes) { std::string cacheFile = path; cacheFile += "/CMakeCache.txt"; @@ -500,7 +500,7 @@ bool cmCacheManager::SaveCache(const std::string& path) fout << "########################\n"; fout << "\n"; - for( std::map::const_iterator i = + for( std::map::const_iterator i = this->Cache.begin(); i != this->Cache.end(); ++i) { const CacheEntry& ce = (*i).second; @@ -693,7 +693,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const { out << "=================================================" << std::endl; out << "CMakeCache Contents:" << std::endl; - for(std::map::const_iterator i = + for(std::map::const_iterator i = this->Cache.begin(); i != this->Cache.end(); ++i) { if((*i).second.Type != INTERNAL) diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 14cb1d9..573f828 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -72,7 +72,7 @@ public: void SetType(CacheEntryType ty) { this->GetEntry().Type = ty; } bool Initialized() { return this->GetEntry().Initialized; } cmCacheManager &Container; - std::map::iterator Position; + std::map::iterator Position; CacheIterator(cmCacheManager &cm) : Container(cm) { this->Begin(); } @@ -111,8 +111,8 @@ public: bool LoadCache(const std::string& path); bool LoadCache(const std::string& path, bool internal); bool LoadCache(const std::string& path, bool internal, - std::set& excludes, - std::set& includes); + std::set& excludes, + std::set& includes); ///! Save cache for given makefile. Saves to ouput home CMakeCache.txt. bool SaveCache(cmMakefile*) ; @@ -166,7 +166,7 @@ protected: unsigned int CacheMinorVersion; private: cmake* CMakeInstance; - typedef std::map CacheEntryMap; + typedef std::map CacheEntryMap; static void OutputHelpString(std::ostream& fout, const std::string& helpString); static void OutputKey(std::ostream& fout, std::string const& key); diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index da00124..d375ae6 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -77,8 +77,8 @@ public: char BSLASHVariable[3]; private: - cmStdString::size_type InputBufferPos; - cmStdString InputBuffer; + std::string::size_type InputBufferPos; + std::string InputBuffer; std::vector OutputBuffer; int CurrentLine; int Verbose; diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index d51e6e6..6c1c1de 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -279,12 +279,12 @@ cmComputeLinkDepends::Compute() } //---------------------------------------------------------------------------- -std::map::iterator +std::map::iterator cmComputeLinkDepends::AllocateLinkEntry(std::string const& item) { - std::map::value_type + std::map::value_type index_entry(item, static_cast(this->EntryList.size())); - std::map::iterator + std::map::iterator lei = this->LinkEntryIndex.insert(index_entry).first; this->EntryList.push_back(LinkEntry()); this->InferredDependSets.push_back(0); @@ -297,7 +297,7 @@ int cmComputeLinkDepends::AddLinkEntry(int depender_index, std::string const& item) { // Check if the item entry has already been added. - std::map::iterator lei = this->LinkEntryIndex.find(item); + std::map::iterator lei = this->LinkEntryIndex.find(item); if(lei != this->LinkEntryIndex.end()) { // Yes. We do not need to follow the item's dependencies again. @@ -423,7 +423,7 @@ cmComputeLinkDepends void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) { // Check if the target already has an entry. - std::map::iterator lei = + std::map::iterator lei = this->LinkEntryIndex.find(dep.Item); if(lei == this->LinkEntryIndex.end()) { diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 26bf6db..ac5e368 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -76,7 +76,7 @@ private: typedef cmTarget::LinkLibraryVectorType LinkLibraryVectorType; - std::map::iterator + std::map::iterator AllocateLinkEntry(std::string const& item); int AddLinkEntry(int depender_index, std::string const& item); void AddVarLinkEntries(int depender_index, const char* value); @@ -88,7 +88,7 @@ private: // One entry for each unique item. std::vector EntryList; - std::map LinkEntryIndex; + std::map LinkEntryIndex; // BFS of initial dependencies. struct BFSEntry diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 23a6671..32b23b8 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -902,7 +902,7 @@ void cmComputeLinkInformation::ComputeItemParserInfo() // be the library name. Match index 3 will be the library // extension. reg = "^("; - for(std::set::iterator p = this->LinkPrefixes.begin(); + for(std::set::iterator p = this->LinkPrefixes.begin(); p != this->LinkPrefixes.end(); ++p) { reg += *p; @@ -1640,7 +1640,7 @@ void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os) // List the paths old behavior is adding. os << "and other libraries with known full path:\n"; - std::set emitted; + std::set emitted; for(std::vector::const_iterator i = this->OldLinkDirItems.begin(); i != this->OldLinkDirItems.end(); ++i) @@ -1856,7 +1856,7 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath) //---------------------------------------------------------------------------- static void cmCLI_ExpandListUnique(const char* str, std::vector& out, - std::set& emitted) + std::set& emitted) { std::vector tmp; cmSystemTools::ExpandListArgument(str, tmp); @@ -1894,7 +1894,7 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, this->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH"); // Construct the RPATH. - std::set emitted; + std::set emitted; if(use_install_rpath) { const char* install_rpath = this->Target->GetProperty("INSTALL_RPATH"); diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 26ee8f0..b5a8bec 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -126,7 +126,7 @@ private: std::vector StaticLinkExtensions; std::vector SharedLinkExtensions; std::vector LinkExtensions; - std::set LinkPrefixes; + std::set LinkPrefixes; cmsys::RegularExpression ExtractStaticLibraryName; cmsys::RegularExpression ExtractSharedLibraryName; cmsys::RegularExpression ExtractAnyLibraryName; @@ -153,7 +153,7 @@ private: // Framework info. void ComputeFrameworkInfo(); void AddFrameworkPath(std::string const& p); - std::set FrameworkPathsEmmitted; + std::set FrameworkPathsEmmitted; cmsys::RegularExpression SplitFramework; // Linker search path computation. @@ -165,14 +165,14 @@ private: void LoadImplicitLinkInfo(); void AddImplicitLinkInfo(); void AddImplicitLinkInfo(std::string const& lang); - std::set ImplicitLinkDirs; - std::set ImplicitLinkLibs; + std::set ImplicitLinkDirs; + std::set ImplicitLinkLibs; // Additional paths configured by the runtime linker std::vector RuntimeLinkDirs; // Linker search path compatibility mode. - std::set OldLinkDirMask; + std::set OldLinkDirMask; std::vector OldLinkDirItems; std::vector OldUserFlagItems; bool OldLinkDirMode; diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 83d1e2e..405643e 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -211,7 +211,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // dependencies in all targets, because the generated build-systems can't // deal with config-specific dependencies. { - std::set emitted; + std::set emitted; { std::vector tlibs; depender->GetDirectLinkLibraries(0, tlibs, depender); @@ -255,11 +255,11 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Loop over all utility dependencies. { - std::set const& tutils = depender->GetUtilities(); - std::set emitted; + std::set const& tutils = depender->GetUtilities(); + std::set emitted; // A target should not depend on itself. emitted.insert(depender->GetName()); - for(std::set::const_iterator util = tutils.begin(); + for(std::set::const_iterator util = tutils.begin(); util != tutils.end(); ++util) { // Don't emit the same utility twice for this target. @@ -275,7 +275,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, cmTarget const* dependee, const char *config, - std::set &emitted) + std::set &emitted) { cmTarget const* depender = this->Targets[depender_index]; if(cmTarget::LinkInterface const* iface = @@ -300,7 +300,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, const std::string& dependee_name, bool linking, - std::set &emitted) + std::set &emitted) { cmTarget const* depender = this->Targets[depender_index]; cmTarget const* dependee = @@ -406,8 +406,8 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, if(dependee->IsImported()) { // Skip imported targets but follow their utility dependencies. - std::set const& utils = dependee->GetUtilities(); - for(std::set::const_iterator i = utils.begin(); + std::set const& utils = dependee->GetUtilities(); + for(std::set::const_iterator i = utils.begin(); i != utils.end(); ++i) { if(cmTarget const* transitive_dependee = diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index dcb450a..db76a18 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -53,10 +53,10 @@ private: bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); void AddInterfaceDepends(int depender_index, const std::string& dependee_name, - bool linking, std::set &emitted); + bool linking, std::set &emitted); void AddInterfaceDepends(int depender_index, cmTarget const* dependee, const char *config, - std::set &emitted); + std::set &emitted); cmGlobalGenerator* GlobalGenerator; bool DebugMode; bool NoCycles; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index b0e2b6f..ea3e814 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -566,7 +566,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir) cmsys::Directory dir; dir.Load(binDir); size_t fileNum; - std::set deletedFiles; + std::set deletedFiles; for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) { if (strcmp(dir.GetFile(static_cast(fileNum)),".") && diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index 6851105..67c305e 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -72,7 +72,7 @@ public: /** Backtrace of the command that created this custom command. */ cmListFileBacktrace const& GetBacktrace() const; - typedef std::pair ImplicitDependsPair; + typedef std::pair ImplicitDependsPair; class ImplicitDependsList: public std::vector {}; void SetImplicitDepends(ImplicitDependsList const&); void AppendImplicitDepends(ImplicitDependsList const&); diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 5fa3877..babf1c4 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -85,9 +85,9 @@ const char* cmDefinitions::Set(const std::string& key, const char* value) } //---------------------------------------------------------------------------- -std::set cmDefinitions::LocalKeys() const +std::set cmDefinitions::LocalKeys() const { - std::set keys; + std::set keys; // Consider local definitions. for(MapType::const_iterator mi = this->Map.begin(); mi != this->Map.end(); ++mi) @@ -110,12 +110,12 @@ cmDefinitions cmDefinitions::Closure() const cmDefinitions::cmDefinitions(ClosureTag const&, cmDefinitions const* root): Up(0) { - std::set undefined; + std::set undefined; this->ClosureImpl(undefined, root); } //---------------------------------------------------------------------------- -void cmDefinitions::ClosureImpl(std::set& undefined, +void cmDefinitions::ClosureImpl(std::set& undefined, cmDefinitions const* defs) { // Consider local definitions. @@ -145,17 +145,17 @@ void cmDefinitions::ClosureImpl(std::set& undefined, } //---------------------------------------------------------------------------- -std::set cmDefinitions::ClosureKeys() const +std::set cmDefinitions::ClosureKeys() const { - std::set defined; - std::set undefined; + std::set defined; + std::set undefined; this->ClosureKeys(defined, undefined); return defined; } //---------------------------------------------------------------------------- -void cmDefinitions::ClosureKeys(std::set& defined, - std::set& undefined) const +void cmDefinitions::ClosureKeys(std::set& defined, + std::set& undefined) const { // Consider local definitions. for(MapType::const_iterator mi = this->Map.begin(); @@ -165,7 +165,7 @@ void cmDefinitions::ClosureKeys(std::set& defined, if(defined.find(mi->first) == defined.end() && undefined.find(mi->first) == undefined.end()) { - std::set& m = mi->second.Exists? defined : undefined; + std::set& m = mi->second.Exists? defined : undefined; m.insert(mi->first); } } diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 24dad29..4c1ad0a 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -41,22 +41,25 @@ public: const char* Set(const std::string& key, const char* value); /** Get the set of all local keys. */ - std::set LocalKeys() const; + std::set LocalKeys() const; /** Compute the closure of all defined keys with values. This flattens the scope. The result has no parent. */ cmDefinitions Closure() const; /** Compute the set of all defined keys. */ - std::set ClosureKeys() const; + std::set ClosureKeys() const; private: // String with existence boolean. - struct Def: public cmStdString + struct Def: public std::string { - Def(): cmStdString(), Exists(false) {} - Def(const char* v): cmStdString(v?v:""), Exists(v?true:false) {} - Def(Def const& d): cmStdString(d), Exists(d.Exists) {} + private: + typedef std::string std_string; + public: + Def(): std_string(), Exists(false) {} + Def(const char* v): std_string(v?v:""), Exists(v?true:false) {} + Def(Def const& d): std_string(d), Exists(d.Exists) {} bool Exists; }; static Def NoDef; @@ -65,7 +68,7 @@ private: cmDefinitions* Up; // Local definitions, set or unset. - typedef std::map MapType; + typedef std::map MapType; MapType Map; // Internal query and update methods. @@ -75,12 +78,12 @@ private: // Implementation of Closure() method. struct ClosureTag {}; cmDefinitions(ClosureTag const&, cmDefinitions const* root); - void ClosureImpl(std::set& undefined, + void ClosureImpl(std::set& undefined, cmDefinitions const* defs); // Implementation of ClosureKeys() method. - void ClosureKeys(std::set& defined, - std::set& undefined) const; + void ClosureKeys(std::set& defined, + std::set& undefined) const; }; #endif diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 585f959..57a66da 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -91,7 +91,7 @@ cmDependsC::~cmDependsC() { this->WriteCacheFile(); - for (std::map::iterator it= + for (std::map::iterator it= this->FileCache.begin(); it!=this->FileCache.end(); ++it) { delete it->second; @@ -116,7 +116,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, return false; } - std::set dependencies; + std::set dependencies; bool haveDeps = false; if (this->ValidDeps != 0) @@ -149,7 +149,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, this->Encountered.insert(*srcIt); } - std::set scanned; + std::set scanned; // Use reserve to allocate enough memory for tempPathStr // so that during the loops no memory is allocated or freed @@ -182,7 +182,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, } else { - std::map::iterator + std::map::iterator headerLocationIt=this->HeaderLocationCache.find(current.FileName); if (headerLocationIt!=this->HeaderLocationCache.end()) { @@ -224,7 +224,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, scanned.insert(fullName); // Check whether this file is already in the cache - std::map::iterator fileIt= + std::map::iterator fileIt= this->FileCache.find(fullName); if (fileIt!=this->FileCache.end()) { @@ -270,7 +270,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, // convert the dependencies to paths relative to the home output // directory. We must do the same here. internalDepends << obj << std::endl; - for(std::set::const_iterator i=dependencies.begin(); + for(std::set::const_iterator i=dependencies.begin(); i != dependencies.end(); ++i) { makeDepends << obj << ": " << @@ -392,7 +392,7 @@ void cmDependsC::WriteCacheFile() const cacheOut << this->IncludeRegexComplainString << "\n\n"; cacheOut << this->IncludeRegexTransformString << "\n\n"; - for (std::map::const_iterator fileIt= + for (std::map::const_iterator fileIt= this->FileCache.begin(); fileIt!=this->FileCache.end(); ++fileIt) { @@ -421,7 +421,7 @@ void cmDependsC::WriteCacheFile() const //---------------------------------------------------------------------------- void cmDependsC::Scan(std::istream& is, const char* directory, - const cmStdString& fullName) + const std::string& fullName) { cmIncludeLines* newCacheEntry=new cmIncludeLines; newCacheEntry->Used=true; diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index cd1e7a4..07d3c21 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -41,7 +41,7 @@ protected: // Method to scan a single file. void Scan(std::istream& is, const char* directory, - const cmStdString& fullName); + const std::string& fullName); // Regular expression to identify C preprocessor include directives. cmsys::RegularExpression IncludeRegexLine; @@ -57,7 +57,7 @@ protected: // Regex to transform #include lines. std::string IncludeRegexTransformString; cmsys::RegularExpression IncludeRegexTransform; - typedef std::map TransformRulesType; + typedef std::map TransformRulesType; TransformRulesType TransformRules; void SetupTransforms(); void ParseTransform(std::string const& xform); @@ -67,8 +67,8 @@ public: // Data structures for dependency graph walk. struct UnscannedEntry { - cmStdString FileName; - cmStdString QuotedLocation; + std::string FileName; + std::string QuotedLocation; }; struct cmIncludeLines @@ -79,13 +79,13 @@ public: }; protected: const std::map* ValidDeps; - std::set Encountered; + std::set Encountered; std::queue Unscanned; - std::map FileCache; - std::map HeaderLocationCache; + std::map FileCache; + std::map HeaderLocationCache; - cmStdString CacheFileName; + std::string CacheFileName; void WriteCacheFile() const; void ReadCacheFile(); diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index d5472a1..b3fbaa2 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -34,11 +34,11 @@ public: std::string Source; // Set of provided and required modules. - std::set Provides; - std::set Requires; + std::set Provides; + std::set Requires; // Set of files included in the translation unit. - std::set Includes; + std::set Includes; }; //---------------------------------------------------------------------------- @@ -98,24 +98,24 @@ class cmDependsFortranInternals { public: // The set of modules provided by this target. - std::set TargetProvides; + std::set TargetProvides; // Map modules required by this target to locations. - typedef std::map TargetRequiresMap; + typedef std::map TargetRequiresMap; TargetRequiresMap TargetRequires; // Information about each object file. - typedef std::map ObjectInfoMap; + typedef std::map ObjectInfoMap; ObjectInfoMap ObjectInfo; cmDependsFortranSourceInfo& CreateObjectInfo(const char* obj, const char* src) { - std::map::iterator i = + std::map::iterator i = this->ObjectInfo.find(obj); if(i == this->ObjectInfo.end()) { - std::map::value_type + std::map::value_type entry(obj, cmDependsFortranSourceInfo()); i = this->ObjectInfo.insert(entry).first; i->second.Source = src; @@ -260,8 +260,8 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, cmGeneratedFileStream fiStream(fiName.c_str()); fiStream << "# The fortran modules provided by this target.\n"; fiStream << "provides\n"; - std::set const& provides = this->Internal->TargetProvides; - for(std::set::const_iterator i = provides.begin(); + std::set const& provides = this->Internal->TargetProvides; + for(std::set::const_iterator i = provides.begin(); i != provides.end(); ++i) { fiStream << " " << *i << "\n"; @@ -275,7 +275,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, cmGeneratedFileStream fcStream(fcName.c_str()); fcStream << "# Remove fortran modules provided by this target.\n"; fcStream << "FILE(REMOVE"; - for(std::set::const_iterator i = provides.begin(); + for(std::set::const_iterator i = provides.begin(); i != provides.end(); ++i) { std::string mod_upper = mod_dir; @@ -319,14 +319,14 @@ void cmDependsFortran::LocateModules() infoI != objInfo.end(); ++infoI) { cmDependsFortranSourceInfo const& info = infoI->second; - for(std::set::const_iterator i = info.Provides.begin(); + for(std::set::const_iterator i = info.Provides.begin(); i != info.Provides.end(); ++i) { // Include this module in the set provided by this target. this->Internal->TargetProvides.insert(*i); } - for(std::set::const_iterator i = info.Requires.begin(); + for(std::set::const_iterator i = info.Requires.begin(); i != info.Requires.end(); ++i) { // Include this module in the set required by this target. @@ -368,8 +368,8 @@ void cmDependsFortran::LocateModules() void cmDependsFortran::MatchLocalModules() { const char* stampDir = this->TargetDirectory.c_str(); - std::set const& provides = this->Internal->TargetProvides; - for(std::set::const_iterator i = provides.begin(); + std::set const& provides = this->Internal->TargetProvides; + for(std::set::const_iterator i = provides.begin(); i != provides.end(); ++i) { this->ConsiderModule(i->c_str(), stampDir); @@ -445,7 +445,7 @@ cmDependsFortran // Write the include dependencies to the output stream. internalDepends << obj << std::endl; internalDepends << " " << src << std::endl; - for(std::set::const_iterator i = info.Includes.begin(); + for(std::set::const_iterator i = info.Includes.begin(); i != info.Includes.end(); ++i) { makeDepends << obj << ": " << @@ -458,11 +458,11 @@ cmDependsFortran makeDepends << std::endl; // Write module requirements to the output stream. - for(std::set::const_iterator i = info.Requires.begin(); + for(std::set::const_iterator i = info.Requires.begin(); i != info.Requires.end(); ++i) { // Require only modules not provided in the same source. - if(std::set::const_iterator(info.Provides.find(*i)) != + if(std::set::const_iterator(info.Provides.find(*i)) != info.Provides.end()) { continue; @@ -519,7 +519,7 @@ cmDependsFortran } // Write provided modules to the output stream. - for(std::set::const_iterator i = info.Provides.begin(); + for(std::set::const_iterator i = info.Provides.begin(); i != info.Provides.end(); ++i) { std::string proxy = stamp_dir; @@ -538,7 +538,7 @@ cmDependsFortran // Create a target to copy the module after the object file // changes. makeDepends << obj << ".provides.build:\n"; - for(std::set::const_iterator i = info.Provides.begin(); + for(std::set::const_iterator i = info.Provides.begin(); i != info.Provides.end(); ++i) { // Include this module in the set provided by this target. diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index c30d4bd..e23e4b7 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -36,10 +36,10 @@ cmDependsJavaParserHelper::~cmDependsJavaParserHelper() } void cmDependsJavaParserHelper::CurrentClass -::AddFileNamesForPrinting(std::vector *files, +::AddFileNamesForPrinting(std::vector *files, const char* prefix, const char* sep) { - cmStdString rname = ""; + std::string rname = ""; if ( prefix ) { rname += prefix; @@ -76,7 +76,7 @@ void cmDependsJavaParserHelper::AddClassFound(const char* sclass) { return; } - std::vector::iterator it; + std::vector::iterator it; for ( it = this->ClassesFound.begin(); it != this->ClassesFound.end(); it ++ ) @@ -91,7 +91,7 @@ void cmDependsJavaParserHelper::AddClassFound(const char* sclass) void cmDependsJavaParserHelper::AddPackagesImport(const char* sclass) { - std::vector::iterator it; + std::vector::iterator it; for ( it = this->PackagesImport.begin(); it != this->PackagesImport.end(); it ++ ) @@ -256,8 +256,8 @@ void cmDependsJavaParserHelper::PrintClasses() std::cerr << "Error when parsing. No classes on class stack" << std::endl; abort(); } - std::vector files = this->GetFilesProduced(); - std::vector::iterator sit; + std::vector files = this->GetFilesProduced(); + std::vector::iterator sit; for ( sit = files.begin(); sit != files.end(); ++ sit ) @@ -266,9 +266,9 @@ void cmDependsJavaParserHelper::PrintClasses() } } -std::vector cmDependsJavaParserHelper::GetFilesProduced() +std::vector cmDependsJavaParserHelper::GetFilesProduced() { - std::vector files; + std::vector files; CurrentClass* toplevel = &(*(this->ClassStack.begin())); std::vector::iterator it; for ( it = toplevel->NestedClasses->begin(); @@ -313,7 +313,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) std::cout << "Imports packages:"; if ( this->PackagesImport.size() > 0 ) { - std::vector::iterator it; + std::vector::iterator it; for ( it = this->PackagesImport.begin(); it != this->PackagesImport.end(); ++ it ) @@ -325,7 +325,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) std::cout << "Depends on:"; if ( this->ClassesFound.size() > 0 ) { - std::vector::iterator it; + std::vector::iterator it; for ( it = this->ClassesFound.begin(); it != this->ClassesFound.end(); ++ it ) @@ -419,8 +419,8 @@ int cmDependsJavaParserHelper::ParseFile(const char* file) return 0; } - cmStdString fullfile = ""; - cmStdString line; + std::string fullfile = ""; + std::string line; while ( cmSystemTools::GetLineFromStream(ifs, line) ) { fullfile += line + "\n"; diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h index 9807a04..5542018 100644 --- a/Source/cmDependsJavaParserHelper.h +++ b/Source/cmDependsJavaParserHelper.h @@ -59,15 +59,15 @@ public: const char* GetCurrentCombine() { return this->CurrentCombine.c_str(); } void UpdateCombine(const char* str1, const char* str2); - std::vector& GetClassesFound() { return this->ClassesFound; } + std::vector& GetClassesFound() { return this->ClassesFound; } - std::vector GetFilesProduced(); + std::vector GetFilesProduced(); private: class CurrentClass { public: - cmStdString Name; + std::string Name; std::vector* NestedClasses; CurrentClass() { @@ -93,16 +93,16 @@ private: { (*this) = c; } - void AddFileNamesForPrinting(std::vector *files, + void AddFileNamesForPrinting(std::vector *files, const char* prefix, const char* sep); }; - cmStdString CurrentPackage; - cmStdString::size_type InputBufferPos; - cmStdString InputBuffer; + std::string CurrentPackage; + std::string::size_type InputBufferPos; + std::string InputBuffer; std::vector OutputBuffer; - std::vector ClassesFound; - std::vector PackagesImport; - cmStdString CurrentCombine; + std::vector ClassesFound; + std::vector PackagesImport; + std::string CurrentCombine; std::vector ClassStack; diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx index 6a0ab7b..944a000 100644 --- a/Source/cmDynamicLoader.cxx +++ b/Source/cmDynamicLoader.cxx @@ -23,7 +23,7 @@ public: static cmDynamicLoaderCache* GetInstance(); private: - std::map CacheMap; + std::map CacheMap; static cmDynamicLoaderCache* Instance; }; @@ -47,7 +47,7 @@ void cmDynamicLoaderCache::CacheFile(const char* path, bool cmDynamicLoaderCache::GetCacheFile(const char* path, cmsys::DynamicLoader::LibraryHandle& p) { - std::map::iterator it + std::map::iterator it = this->CacheMap.find(path); if ( it != this->CacheMap.end() ) { @@ -59,7 +59,7 @@ bool cmDynamicLoaderCache::GetCacheFile(const char* path, bool cmDynamicLoaderCache::FlushCache(const char* path) { - std::map::iterator it + std::map::iterator it = this->CacheMap.find(path); bool ret = false; if ( it != this->CacheMap.end() ) @@ -73,7 +73,7 @@ bool cmDynamicLoaderCache::FlushCache(const char* path) void cmDynamicLoaderCache::FlushCache() { - for ( std::map::iterator it = this->CacheMap.begin(); it != this->CacheMap.end(); it++ ) diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index f93e72a..9e3ce0b 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -63,7 +63,7 @@ public: bool GenerateImportFile(); protected: - typedef std::map ImportPropertyMap; + typedef std::map ImportPropertyMap; // Generate per-configuration target information to the given output // stream. diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index 7c634a4..5ee2a78 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -41,7 +41,7 @@ public: /** Get the per-config file generated for each configuraiton. This maps from the configuration name to the file temporary location for installation. */ - std::map const& GetConfigImportFiles() + std::map const& GetConfigImportFiles() { return this->ConfigImportFiles; } /** Compute the globbing expression used to load per-config import @@ -92,7 +92,7 @@ protected: std::string ImportPrefix; // The import file generated for each configuration. - std::map ConfigImportFiles; + std::map ConfigImportFiles; }; #endif diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index 469a661..b04b937 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -83,9 +83,9 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const cmake* cm = this->Makefile->GetCMakeInstance(); cmGlobalGenerator* global = cm->GetGlobalGenerator(); const std::vector& locals = global->GetLocalGenerators(); - std::map libDepsOld; - std::map libDepsNew; - std::map libTypes; + std::map libDepsOld; + std::map libDepsNew; + std::map libTypes; for(std::vector::const_iterator i = locals.begin(); i != locals.end(); ++i) { @@ -175,7 +175,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; fout << "if(" << vertest << ")\n"; fout << " # Information for CMake 2.6 and above.\n"; - for(std::map::const_iterator + for(std::map::const_iterator i = libDepsNew.begin(); i != libDepsNew.end(); ++i) { @@ -186,7 +186,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const } fout << "else()\n"; fout << " # Information for CMake 2.4 and lower.\n"; - for(std::map::const_iterator + for(std::map::const_iterator i = libDepsOld.begin(); i != libDepsOld.end(); ++i) { @@ -195,7 +195,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; } } - for(std::map::const_iterator i = libTypes.begin(); + for(std::map::const_iterator i = libTypes.begin(); i != libTypes.end(); ++i) { if(i->second != "general") diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index 4b76b33..8d6b2cd 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -49,8 +49,8 @@ public: const char* GetError() { return this->ErrorString.c_str(); } private: - cmStdString::size_type InputBufferPos; - cmStdString InputBuffer; + std::string::size_type InputBufferPos; + std::string InputBuffer; std::vector OutputBuffer; int CurrentLine; int Verbose; diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 1339969..01d1155 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -61,7 +61,7 @@ cmExtraCodeBlocksGenerator::cmExtraCodeBlocksGenerator() void cmExtraCodeBlocksGenerator::Generate() { // for each sub project in the project create a codeblocks project - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it!= this->GlobalGenerator->GetProjectMap().end(); ++it) @@ -243,7 +243,7 @@ void cmExtraCodeBlocksGenerator Tree tree; // build tree of virtual folders - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it != this->GlobalGenerator->GetProjectMap().end(); ++it) diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 028d3d5..1e34fe0 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -60,7 +60,7 @@ void cmExtraCodeLiteGenerator::Generate() // loop projects and locate the root project. // and extract the information for creating the worspace - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it!= this->GlobalGenerator->GetProjectMap().end(); ++it) @@ -85,7 +85,7 @@ void cmExtraCodeLiteGenerator::Generate() } // for each sub project in the workspace create a codelite project - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it!= this->GlobalGenerator->GetProjectMap().end(); ++it) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 74ba9a6..38a2470 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -624,7 +624,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects( this->AppendLinkedResource(fout, "[Subprojects]", "virtual:/virtual", VirtualFolder); - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it != this->GlobalGenerator->GetProjectMap().end(); ++it) diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 3cfafa7..9c2849c 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -64,7 +64,7 @@ cmExtraSublimeTextGenerator::cmExtraSublimeTextGenerator() void cmExtraSublimeTextGenerator::Generate() { // for each sub project in the project create a sublime text 2 project - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it!= this->GlobalGenerator->GetProjectMap().end(); ++it) diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx index 02f10c0..5727470 100644 --- a/Source/cmFileTimeComparison.cxx +++ b/Source/cmFileTimeComparison.cxx @@ -43,13 +43,13 @@ private: class HashString { public: - size_t operator()(const cmStdString& s) const + size_t operator()(const std::string& s) const { return h(s.c_str()); } cmsys::hash h; }; - typedef cmsys::hash_map FileStatsMap; FileStatsMap Files; #endif diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h index e590d6e..42d9bc1 100644 --- a/Source/cmFindBase.h +++ b/Source/cmFindBase.h @@ -42,14 +42,14 @@ protected: bool CheckForVariableInCache(); // use by command during find - cmStdString VariableDocumentation; - cmStdString VariableName; + std::string VariableDocumentation; + std::string VariableName; std::vector Names; bool NamesPerDir; bool NamesPerDirAllowed; // CMAKE_*_PATH CMAKE_SYSTEM_*_PATH FRAMEWORK|LIBRARY|INCLUDE|PROGRAM - cmStdString EnvironmentPath; // LIB,INCLUDE + std::string EnvironmentPath; // LIB,INCLUDE bool AlreadyInCache; bool AlreadyInCacheWithoutMetaInfo; diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index ba90a84..5a905cd 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -56,7 +56,7 @@ protected: /** Compute the current default bundle/framework search policy. */ void SelectDefaultMacMode(); - cmStdString CMakePathName; + std::string CMakePathName; RootPathMode FindRootPathMode; bool CheckCommonArgument(std::string const& arg); @@ -81,7 +81,7 @@ protected: std::vector UserPaths; std::vector UserHints; std::vector SearchPaths; - std::set SearchPathsEmitted; + std::set SearchPathsEmitted; bool SearchFrameworkFirst; bool SearchFrameworkOnly; diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index de52df7..9345d15 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -368,8 +368,8 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path, // Search for a file matching the library name regex. std::string dir = path; cmSystemTools::ConvertToUnixSlashes(dir); - std::set const& files = this->GG->GetDirectoryContent(dir); - for(std::set::const_iterator fi = files.begin(); + std::set const& files = this->GG->GetDirectoryContent(dir); + for(std::set::const_iterator fi = files.begin(); fi != files.end(); ++fi) { std::string const& origName = *fi; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index d557fba..7a4e7f4 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -553,7 +553,7 @@ void cmFindPackageCommand::AddFindDefinition(const std::string& var, //---------------------------------------------------------------------------- void cmFindPackageCommand::RestoreFindDefinitions() { - for(std::map::iterator + for(std::map::iterator i = this->OriginalDefs.begin(); i != this->OriginalDefs.end(); ++i) { OriginalDef const& od = i->second; diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 9819d4f..72c1e3c 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -96,19 +96,19 @@ private: friend class cmFindPackageFileList; struct OriginalDef { bool exists; std::string value; }; - std::map OriginalDefs; + std::map OriginalDefs; - cmStdString Name; - cmStdString Variable; - cmStdString Version; + std::string Name; + std::string Variable; + std::string Version; unsigned int VersionMajor; unsigned int VersionMinor; unsigned int VersionPatch; unsigned int VersionTweak; unsigned int VersionCount; bool VersionExact; - cmStdString FileFound; - cmStdString VersionFound; + std::string FileFound; + std::string VersionFound; unsigned int VersionFoundMajor; unsigned int VersionFoundMinor; unsigned int VersionFoundPatch; diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 8459995..caaf1d3 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -89,9 +89,9 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file, std::string const& dir) { - cmStdString fileName = file; - cmStdString frameWorkName; - cmStdString::size_type pos = fileName.find("/"); + std::string fileName = file; + std::string frameWorkName; + std::string::size_type pos = fileName.find("/"); // if there is a / in the name try to find the header as a framework // For example bar/foo.h would look for: // bar.framework/Headers/foo.h @@ -128,7 +128,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file, } // if it is not found yet or not a framework header, then do a glob search // for all frameworks in the directory: dir/*.framework/Headers/ - cmStdString glob = dir; + std::string glob = dir; glob += "*.framework/Headers/"; glob += file; cmsys::Glob globIt; @@ -136,7 +136,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file, std::vector files = globIt.GetFiles(); if(files.size()) { - cmStdString fheader = cmSystemTools::CollapseFullPath(files[0].c_str()); + std::string fheader = cmSystemTools::CollapseFullPath(files[0].c_str()); if(this->IncludeFileInPath) { return fheader; diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index cd30546..3ebb1b6 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -97,7 +97,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( { this->Output += (*it)->Evaluate(&context, dagChecker); - for(std::set::const_iterator + for(std::set::const_iterator p = context.SeenTargetProperties.begin(); p != context.SeenTargetProperties.end(); ++p) { diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 4992e93..58abf14 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -92,7 +92,7 @@ public: std::set const& GetTargets() const { return this->DependTargets; } - std::set const& GetSeenTargetProperties() const + std::set const& GetSeenTargetProperties() const { return this->SeenTargetProperties; } std::set const& GetAllTargetsSeen() const @@ -130,7 +130,7 @@ private: mutable std::set DependTargets; mutable std::set AllTargetsSeen; - mutable std::set SeenTargetProperties; + mutable std::set SeenTargetProperties; mutable std::string Output; mutable bool HadContextSensitiveCondition; }; diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index e7e1d34..04f36b4 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -42,12 +42,12 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( ) #undef TEST_TRANSITIVE_PROPERTY_METHOD { - std::map >::const_iterator it + std::map >::const_iterator it = top->Seen.find(target); if (it != top->Seen.end()) { - const std::set &propSet = it->second; - const std::set::const_iterator i = propSet.find(property); + const std::set &propSet = it->second; + const std::set::const_iterator i = propSet.find(property); if (i != propSet.end()) { this->CheckResult = ALREADY_SEEN; diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h index b6effa1..6cbbd2a 100644 --- a/Source/cmGeneratorExpressionDAGChecker.h +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -77,7 +77,7 @@ private: const cmGeneratorExpressionDAGChecker * const Parent; const std::string Target; const std::string Property; - std::map > Seen; + std::map > Seen; const GeneratorExpressionContent * const Content; const cmListFileBacktrace Backtrace; Result CheckResult; diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 49e52df..0c8a9cf 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -25,7 +25,7 @@ struct cmGeneratorExpressionContext cmListFileBacktrace Backtrace; std::set DependTargets; std::set AllTargets; - std::set SeenTargetProperties; + std::set SeenTargetProperties; cmMakefile *Makefile; const char *Config; cmTarget const* HeadTarget; // The target whose property is being evaluated. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 7f22e00..a7b2efa 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -422,7 +422,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, = this->Target->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED"); std::vector result; - for (std::set::const_iterator + for (std::set::const_iterator it = this->Target->GetSystemIncludeDirectories().begin(); it != this->Target->GetSystemIncludeDirectories().end(); ++it) { @@ -462,7 +462,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, } } } - std::set unique; + std::set unique; for(std::vector::iterator li = result.begin(); li != result.end(); ++li) { @@ -470,7 +470,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, unique.insert(*li); } result.clear(); - for(std::set::iterator li = unique.begin(); + for(std::set::iterator li = unique.begin(); li != unique.end(); ++li) { result.push_back(*li); @@ -594,7 +594,7 @@ private: SourceEntry* CurrentEntry; std::queue SourceQueue; std::set SourcesQueued; - typedef std::map NameMapType; + typedef std::map NameMapType; NameMapType NameMap; void QueueSource(cmSourceFile* sf); diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index e7ad91a..5aaf1c6 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -49,10 +49,10 @@ bool cmGetCMakePropertyCommand } else if ( args[1] == "COMPONENTS" ) { - const std::set* components + const std::set* components = this->Makefile->GetLocalGenerator()->GetGlobalGenerator() ->GetInstallComponents(); - std::set::const_iterator compIt; + std::set::const_iterator compIt; output = ""; for (compIt = components->begin(); compIt != components->end(); ++compIt) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ba4cce8..9748c61 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -432,8 +432,8 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, fpath += "/CMakeSystem.cmake"; mf->ReadListFile(0,fpath.c_str()); } - std::map needTestLanguage; - std::map needSetLanguageEnabledMaps; + std::map needTestLanguage; + std::map needSetLanguageEnabledMaps; // foreach language // load the CMakeDetermine(LANG)Compiler.cmake file to find // the compiler @@ -823,7 +823,7 @@ cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const const std::string& lang = source.GetLanguage(); if(!lang.empty()) { - std::map::const_iterator it = + std::map::const_iterator it = this->LanguageToOutputExtension.find(lang); if(it != this->LanguageToOutputExtension.end()) @@ -857,7 +857,7 @@ std::string cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const { ++ext; } - std::map::const_iterator it + std::map::const_iterator it = this->ExtensionToLanguage.find(ext); if(it != this->ExtensionToLanguage.end()) { @@ -1011,7 +1011,7 @@ bool cmGlobalGenerator::IsDependedOn(const std::string& project, cmTarget const* targetIn) { // Get all local gens for this project - std::map >::const_iterator it = + std::map >::const_iterator it = this->ProjectMap.find(project); if (it == this->ProjectMap.end()) { @@ -1516,8 +1516,8 @@ void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const void cmGlobalGenerator::CheckLocalGenerators() { - std::map notFoundMap; -// std::set notFoundMap; + std::map notFoundMap; +// std::set notFoundMap; // after it is all done do a ConfigureFinalPass cmCacheManager* manager = 0; for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) @@ -1597,7 +1597,7 @@ void cmGlobalGenerator::CheckLocalGenerators() if(notFoundMap.size()) { std::string notFoundVars; - for(std::map::const_iterator + for(std::map::const_iterator ii = notFoundMap.begin(); ii != notFoundMap.end(); ++ii) @@ -1956,7 +1956,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, void cmGlobalGenerator::GetEnabledLanguages(std::vector& lang) const { - for(std::map::const_iterator i = + for(std::map::const_iterator i = this->LanguageEnabled.begin(); i != this->LanguageEnabled.end(); ++i) { lang.push_back(i->first); @@ -1965,7 +1965,7 @@ cmGlobalGenerator::GetEnabledLanguages(std::vector& lang) const int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const { - std::map::const_iterator it = + std::map::const_iterator it = this->LanguageToLinkerPreference.find(lang); if (it != this->LanguageToLinkerPreference.end()) { @@ -2075,14 +2075,14 @@ cmGlobalGenerator::FindTarget(const std::string& name, { if (!excludeAliases) { - std::map::const_iterator ai + std::map::const_iterator ai = this->AliasTargets.find(name); if (ai != this->AliasTargets.end()) { return ai->second; } } - std::map::const_iterator i = + std::map::const_iterator i = this->TotalTargets.find ( name ); if ( i != this->TotalTargets.end() ) { @@ -2294,7 +2294,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) { if(!cmakeCfgIntDir || !*cmakeCfgIntDir || cmakeCfgIntDir[0] == '.') { - std::set* componentsSet = &this->InstallComponents; + std::set* componentsSet = &this->InstallComponents; cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end()); depends.erase(depends.begin(), depends.end()); @@ -2302,7 +2302,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) if ( componentsSet->size() > 0 ) { ostr << "Available install components are:"; - std::set::iterator it; + std::set::iterator it; for ( it = componentsSet->begin(); it != componentsSet->end(); @@ -2516,7 +2516,7 @@ cmGlobalGenerator::GenerateRuleFile(std::string const& output) const std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage( std::string const& l) const { - std::map::const_iterator it = + std::map::const_iterator it = this->LanguageToOriginalSharedLibFlags.find(l); if(it != this->LanguageToOriginalSharedLibFlags.end()) { @@ -2690,7 +2690,7 @@ void cmGlobalGenerator::AddToManifest(const char* config, } //---------------------------------------------------------------------------- -std::set const& +std::set const& cmGlobalGenerator::GetDirectoryContent(std::string const& dir, bool needDisk) { DirectoryContent& dc = this->DirectoryContentMap[dir]; @@ -2796,7 +2796,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile, fname = line.substr(33, line.npos); // Look for a hash for this file's rule. - std::map::const_iterator rhi = + std::map::const_iterator rhi = this->RuleHashes.find(fname); if(rhi != this->RuleHashes.end()) { @@ -2841,7 +2841,7 @@ void cmGlobalGenerator::WriteRuleHashes(std::string const& pfile) { cmGeneratedFileStream fout(pfile.c_str()); fout << "# Hashes of file build rules.\n"; - for(std::map::const_iterator + for(std::map::const_iterator rhi = this->RuleHashes.begin(); rhi != this->RuleHashes.end(); ++rhi) { fout.write(rhi->second.Data, 32); @@ -2862,7 +2862,7 @@ void cmGlobalGenerator::WriteSummary() cmGeneratedFileStream fout(fname.c_str()); // Generate summary information files for each target. - for(std::map::const_iterator ti = + for(std::map::const_iterator ti = this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti) { if ((ti->second)->GetType() == cmTarget::INTERFACE_LIBRARY) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 746f715..f06162c 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -167,7 +167,7 @@ public: void AddInstallComponent(const char* component); - const std::set* GetInstallComponents() const + const std::set* GetInstallComponents() const { return &this->InstallComponents; } cmExportSetMap& GetExportSets() {return this->ExportSets;} @@ -244,7 +244,7 @@ public: from disk at most once and cached. During the generation step the content will include the target files to be built even if they do not yet exist. */ - std::set const& GetDirectoryContent(std::string const& dir, + std::set const& GetDirectoryContent(std::string const& dir, bool needDisk = true); void AddTarget(cmTarget* t); @@ -276,7 +276,7 @@ public: /** Get per-target generator information. */ cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const; - const std::map >& GetProjectMap() + const std::map >& GetProjectMap() const {return this->ProjectMap;} // track files replaced during a Generate @@ -364,18 +364,18 @@ protected: bool UseLinkScript; bool ForceUnixPaths; bool ToolSupportsColor; - cmStdString FindMakeProgramFile; - cmStdString ConfiguredFilesPath; + std::string FindMakeProgramFile; + std::string ConfiguredFilesPath; cmake *CMakeInstance; std::vector LocalGenerators; cmLocalGenerator* CurrentLocalGenerator; // map from project name to vector of local generators in that project - std::map > ProjectMap; + std::map > ProjectMap; std::map > LocalGeneratorToTargetMap; // Set of named installation components requested by the project. - std::set InstallComponents; + std::set InstallComponents; bool InstallTargetEnabled; // Sets of named target exports cmExportSetMap ExportSets; @@ -387,9 +387,9 @@ protected: cmTargetManifest TargetManifest; // All targets in the entire project. - std::map TotalTargets; - std::map AliasTargets; - std::map ImportedTargets; + std::map TotalTargets; + std::map AliasTargets; + std::map ImportedTargets; std::vector EvaluationFiles; virtual const char* GetPredefinedTargetsFolder(); @@ -401,18 +401,18 @@ private: float FirstTimeProgress; // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator - std::map IgnoreExtensions; - std::map LanguageEnabled; - std::set LanguagesReady; // Ready for try_compile - std::map OutputExtensions; - std::map LanguageToOutputExtension; - std::map ExtensionToLanguage; - std::map LanguageToLinkerPreference; - std::map LanguageToOriginalSharedLibFlags; + std::map IgnoreExtensions; + std::map LanguageEnabled; + std::set LanguagesReady; // Ready for try_compile + std::map OutputExtensions; + std::map LanguageToOutputExtension; + std::map ExtensionToLanguage; + std::map LanguageToLinkerPreference; + std::map LanguageToOriginalSharedLibFlags; // Record hashes for rules and outputs. struct RuleHash { char Data[32]; }; - std::map RuleHashes; + std::map RuleHashes; void CheckRuleHashes(); void CheckRuleHashes(std::string const& pfile, std::string const& home); void WriteRuleHashes(std::string const& pfile); @@ -448,18 +448,18 @@ private: virtual const char* GetBuildIgnoreErrorsFlag() const { return 0; } // Cache directory content and target files to be built. - struct DirectoryContent: public std::set + struct DirectoryContent: public std::set { - typedef std::set derived; + typedef std::set derived; bool LoadedFromDisk; DirectoryContent(): LoadedFromDisk(false) {} DirectoryContent(DirectoryContent const& dc): derived(dc), LoadedFromDisk(dc.LoadedFromDisk) {} }; - std::map DirectoryContentMap; + std::map DirectoryContentMap; // Set of binary directories on disk. - std::set BinaryDirectories; + std::set BinaryDirectories; // track targets to issue CMP0042 warning for. std::set CMP0042WarnTargets; diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index ed0e15b..25df953 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -44,7 +44,7 @@ void cmGlobalKdevelopGenerator::Generate() { // for each sub project in the project create // a kdevelop project - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it!= this->GlobalGenerator->GetProjectMap().end(); ++it) @@ -103,7 +103,7 @@ bool cmGlobalKdevelopGenerator std::string projectDir = projectDirIn + "/"; std::string filename = outputDir+ "/" + projectname +".kdevelop.filelist"; - std::set files; + std::set files; std::string tmp; for (std::vector::const_iterator it=lgs.begin(); @@ -217,7 +217,7 @@ bool cmGlobalKdevelopGenerator } fileToOpen=""; - for (std::set::const_iterator it=files.begin(); + for (std::set::const_iterator it=files.begin(); it!=files.end(); it++) { // get the full path to the file diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 954fb17..977b3a1 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -886,7 +886,7 @@ cmGlobalNinjaGenerator if (target->GetType() == cmTarget::GLOBAL_TARGET) { // Global targets only depend on other utilities, which may not appear in // the TargetDepends set (e.g. "all"). - std::set const& utils = target->GetUtilities(); + std::set const& utils = target->GetUtilities(); std::copy(utils.begin(), utils.end(), std::back_inserter(outputs)); } else { cmTargetDependSet const& targetDeps = diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 735887e..a392aa6 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -624,7 +624,7 @@ void cmGlobalUnixMakefileGenerator3 void cmGlobalUnixMakefileGenerator3 ::WriteConvenienceRules(std::ostream& ruleFileStream, - std::set &emitted) + std::set &emitted) { std::vector depends; std::vector commands; @@ -1049,7 +1049,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule lg->AppendEcho(commands,"... depend"); // Keep track of targets already listed. - std::set emittedTargets; + std::set emittedTargets; // for each local generator unsigned int i; @@ -1084,8 +1084,8 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule } } } - std::vector const& localHelp = lg->GetLocalHelp(); - for(std::vector::const_iterator o = localHelp.begin(); + std::vector const& localHelp = lg->GetLocalHelp(); + for(std::vector::const_iterator o = localHelp.begin(); o != localHelp.end(); ++o) { path = "... "; @@ -1102,9 +1102,9 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule bool cmGlobalUnixMakefileGenerator3 ::NeedRequiresStep(cmTarget const& target) { - std::set languages; + std::set languages; target.GetLanguages(languages); - for(std::set::const_iterator l = languages.begin(); + for(std::set::const_iterator l = languages.begin(); l != languages.end(); ++l) { std::string var = "CMAKE_NEEDS_REQUIRES_STEP_"; diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index ffdf6fb..b61619d 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -96,7 +96,7 @@ public: // write the top level target rules void WriteConvenienceRules(std::ostream& ruleFileStream, - std::set &emitted); + std::set &emitted); /** Get the command to use for a target that has no rule. This is used for multiple output dependencies and for cmake_force. */ diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 214b9ea..a7f6587 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -260,7 +260,7 @@ void cmGlobalVisualStudio6Generator // output the DSW file void cmGlobalVisualStudio6Generator::OutputDSWFile() { - std::map >::iterator it; + std::map >::iterator it; for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) { this->OutputDSWFile(it->second[0], it->second); @@ -318,7 +318,7 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, void cmGlobalVisualStudio6Generator::WriteExternalProject(std::ostream& fout, const std::string& name, const char* location, - const std::set& dependencies) + const std::set& dependencies) { fout << "#########################################################" "######################\n\n"; @@ -329,7 +329,7 @@ void cmGlobalVisualStudio6Generator::WriteExternalProject(std::ostream& fout, fout << "{{{\n"; - std::set::const_iterator i, end; + std::set::const_iterator i, end; // write dependencies. i = dependencies.begin(); end = dependencies.end(); diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index f1c70e4..3665f7b 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -103,7 +103,7 @@ private: cmTarget const& t); void WriteExternalProject(std::ostream& fout, const std::string& name, const char* path, - const std::set& dependencies); + const std::set& dependencies); void WriteDSWFooter(std::ostream& fout); virtual std::string WriteUtilityDepend(cmTarget const* target); std::string MSDevCommand; diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index af1a5c5..08bcc5b 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -237,7 +237,7 @@ void cmGlobalVisualStudio71Generator const std::string& name, const char* location, const char* typeGuid, - const std::set& depends) + const std::set& depends) { fout << "Project(\"{" << (typeGuid ? typeGuid : this->ExternalProjectType(location)) @@ -252,7 +252,7 @@ void cmGlobalVisualStudio71Generator if(!depends.empty()) { fout << "\tProjectSection(ProjectDependencies) = postProject\n"; - std::set::const_iterator it; + std::set::const_iterator it; for(it = depends.begin(); it != depends.end(); ++it) { if(it->size() > 0) diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 8791468..75cc6ae 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -72,7 +72,7 @@ protected: const std::string& name, const char* path, const char* typeGuid, - const std::set& depends); + const std::set& depends); virtual void WriteSLNHeader(std::ostream& fout); std::string ProjectConfigurationSectionName; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index cf84fe3..2a97edc 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -353,7 +353,7 @@ void cmGlobalVisualStudio7Generator // output the SLN file void cmGlobalVisualStudio7Generator::OutputSLNFile() { - std::map >::iterator it; + std::map >::iterator it; for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) { this->OutputSLNFile(it->second[0], it->second); @@ -761,7 +761,7 @@ void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout, const std::string& name, const char* location, const char* typeGuid, - const std::set&) + const std::set&) { std::string d = cmSystemTools::ConvertToOutputPath(location); fout << "Project(" diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 6fb3731..2e58f6c 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -156,7 +156,7 @@ protected: const std::string& name, const char* path, const char* typeGuid, - const std::set& + const std::set& dependencies); std::string ConvertToSolutionPath(const char* path); @@ -164,7 +164,7 @@ protected: std::set IsPartOfDefaultBuild(const std::string& project, cmTarget const* target); std::vector Configurations; - std::map GUIDMap; + std::map GUIDMap; virtual void WriteFolders(std::ostream& fout); virtual void WriteFoldersContent(std::ostream& fout); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 51825ee..2ae1bbc 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -338,7 +338,7 @@ void cmGlobalVisualStudio8Generator::Generate() if(this->AddCheckTarget()) { // All targets depend on the build-system check target. - for(std::map::const_iterator + for(std::map::const_iterator ti = this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti) { @@ -436,7 +436,7 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies( cmTarget& target) { // Look for utility dependencies that magically link. - for(std::set::const_iterator ui = + for(std::set::const_iterator ui = target.GetUtilities().begin(); ui != target.GetUtilities().end(); ++ui) { diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index d388034..b2a705e 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -53,7 +53,7 @@ void cmGlobalVisualStudioGenerator::Generate() const char* no_working_dir = 0; std::vector no_depends; cmCustomCommandLines no_commands; - std::map >::iterator it; + std::map >::iterator it; for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) { std::vector& gen = it->second; @@ -128,7 +128,7 @@ cmGlobalVisualStudioGenerator // Count the number of object files with each name. Note that // windows file names are not case sensitive. - std::map counts; + std::map counts; std::vector objectSources; gt->GetObjectSources(objectSources); for(std::vector::const_iterator @@ -380,7 +380,7 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends() { return false; } - std::map >::iterator it; + std::map >::iterator it; for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) { std::vector& gen = it->second; @@ -852,7 +852,7 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget const& target) { // check to see if this is a fortran build - std::set languages; + std::set languages; target.GetLanguages(languages); if(languages.size() == 1) { diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index b1fa838..dc0f9c7 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -99,7 +99,7 @@ protected: virtual void AddPlatformDefinitions(cmMakefile* mf); virtual bool ComputeTargetDepends(); - class VSDependSet: public std::set {}; + class VSDependSet: public std::set {}; class VSDependMap: public std::map {}; VSDependMap VSTargetDepends; void ComputeVSTargetDepends(cmTarget&); @@ -108,7 +108,7 @@ protected: std::string GetUtilityForTarget(cmTarget& target, const std::string&); virtual std::string WriteUtilityDepend(cmTarget const*) = 0; std::string GetUtilityDepend(cmTarget const* target); - typedef std::map UtilityDependsMap; + typedef std::map UtilityDependsMap; UtilityDependsMap UtilityDepends; const char* AdditionalPlatformDefinition; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index a1255a0..08e9adf 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -337,7 +337,7 @@ cmLocalGenerator *cmGlobalXCodeGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::Generate() { - std::map >::iterator it; + std::map >::iterator it; // make sure extra targets are added before calling // the parent generate which will call trace depends for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) @@ -570,7 +570,7 @@ void cmGlobalXCodeGenerator::addObject(cmXCodeObject *obj) { if(obj->GetType() == cmXCodeObject::OBJECT) { - cmStdString id = obj->GetId(); + std::string id = obj->GetId(); // If this is a duplicate id, it's an error: // @@ -631,17 +631,17 @@ cmXCodeObject* cmGlobalXCodeGenerator } //---------------------------------------------------------------------------- -cmStdString +std::string GetGroupMapKeyFromPath(cmTarget& cmtarget, const std::string& fullpath) { - cmStdString key(cmtarget.GetName()); + std::string key(cmtarget.GetName()); key += "-"; key += fullpath; return key; } //---------------------------------------------------------------------------- -cmStdString +std::string GetGroupMapKey(cmTarget& cmtarget, cmSourceFile* sf) { return GetGroupMapKeyFromPath(cmtarget, sf->GetFullPath()); @@ -844,7 +844,7 @@ cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath( fileRef->SetComment(fname.c_str()); this->FileRefs[fname] = fileRef; } - cmStdString key = GetGroupMapKeyFromPath(cmtarget, fullpath); + std::string key = GetGroupMapKeyFromPath(cmtarget, fullpath); cmXCodeObject* group = this->GroupMap[key]; cmXCodeObject* children = group->GetObject("children"); if (!children->HasObject(fileRef)) @@ -1127,7 +1127,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, std::vector contentBuildPhases; if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { - typedef std::map > + typedef std::map > mapOfVectorOfSourceFiles; mapOfVectorOfSourceFiles bundleFiles; for(std::vector::const_iterator i = classes.begin(); @@ -1216,7 +1216,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, void cmGlobalXCodeGenerator::ForceLinkerLanguages() { // This makes sure all targets link using the proper language. - for(std::map::const_iterator + for(std::map::const_iterator ti = this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti) { this->ForceLinkerLanguage(*ti->second); @@ -1477,7 +1477,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, // collect multiple outputs of custom commands into a set // which will be used for every configuration - std::map multipleOutputPairs; + std::map multipleOutputPairs; for(std::vector::const_iterator i = commands.begin(); i != commands.end(); ++i) { @@ -1548,8 +1548,8 @@ void cmGlobalXCodeGenerator std::vector const & commands, const char* configName, - const std::map& multipleOutputPairs + const std::map& multipleOutputPairs ) { std::string makefileName=makefileBasename; @@ -1571,7 +1571,7 @@ void cmGlobalXCodeGenerator // have all depend on all outputs makefileStream << "all: "; - std::map tname; + std::map tname; int count = 0; for(std::vector::const_iterator i = commands.begin(); i != commands.end(); ++i) @@ -1669,7 +1669,7 @@ void cmGlobalXCodeGenerator makefileStream << "\n# Dependencies of multiple outputs to their primary outputs \n"; - for(std::map::const_iterator o = + for(std::map::const_iterator o = multipleOutputPairs.begin(); o != multipleOutputPairs.end(); ++o) { makefileStream << o->first << ": " << o->second << "\n"; @@ -1678,7 +1678,7 @@ void cmGlobalXCodeGenerator makefileStream << "\n" "cmake_check_multiple_outputs:\n"; - for(std::map::const_iterator o = + for(std::map::const_iterator o = multipleOutputPairs.begin(); o != multipleOutputPairs.end(); ++o) { makefileStream << "\t@if [ ! -f " @@ -2088,7 +2088,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, std::vector includes; this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, "C", configName); - std::set emitted; + std::set emitted; emitted.insert("/System/Library/Frameworks"); for(std::vector::iterator i = includes.begin(); i != includes.end(); ++i) @@ -2357,18 +2357,18 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { if(i->first.find("XCODE_ATTRIBUTE_") == 0) { - cmStdString attribute = i->first.substr(16); + std::string attribute = i->first.substr(16); // Handle [variant=] condition explicitly here. - cmStdString::size_type beginVariant = + std::string::size_type beginVariant = attribute.find("[variant="); - if (beginVariant != cmStdString::npos) + if (beginVariant != std::string::npos) { - cmStdString::size_type endVariant = + std::string::size_type endVariant = attribute.find("]", beginVariant+9); - if (endVariant != cmStdString::npos) + if (endVariant != std::string::npos) { // Compare the variant to the configuration. - cmStdString variant = + std::string variant = attribute.substr(beginVariant+9, endVariant-beginVariant-9); if (variant == configName) { @@ -2969,7 +2969,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, mf->FindSourceGroup(source.c_str(), sourceGroups); cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(cmtarget, sourceGroup); - cmStdString key = GetGroupMapKey(cmtarget, sf); + std::string key = GetGroupMapKey(cmtarget, sf); this->GroupMap[key] = pbxgroup; } @@ -2984,7 +2984,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, mf->FindSourceGroup(source.c_str(), sourceGroups); cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(cmtarget, sourceGroup); - cmStdString key = GetGroupMapKeyFromPath(cmtarget, source); + std::string key = GetGroupMapKeyFromPath(cmtarget, source); this->GroupMap[key] = pbxgroup; } } @@ -2992,7 +2992,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, } cmXCodeObject *cmGlobalXCodeGenerator -::CreatePBXGroup(cmXCodeObject *parent, cmStdString name) +::CreatePBXGroup(cmXCodeObject *parent, std::string name) { cmXCodeObject* parentChildren = NULL; if(parent) @@ -3016,8 +3016,8 @@ cmXCodeObject *cmGlobalXCodeGenerator cmXCodeObject* cmGlobalXCodeGenerator ::CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg) { - cmStdString s; - cmStdString target; + std::string s; + std::string target; const char *targetFolder= cmtarget.GetProperty("FOLDER"); if(targetFolder) { target = targetFolder; @@ -3026,7 +3026,7 @@ cmXCodeObject* cmGlobalXCodeGenerator target += cmtarget.GetName(); s = target + "/"; s += sg->GetFullName(); - std::map::iterator it = + std::map::iterator it = this->GroupNameMap.find(s); if(it != this->GroupNameMap.end()) { @@ -3043,7 +3043,7 @@ cmXCodeObject* cmGlobalXCodeGenerator { std::vector tgt_folders = cmSystemTools::tokenize(target, "/"); - cmStdString curr_tgt_folder; + std::string curr_tgt_folder; for(std::vector::size_type i = 0; i < tgt_folders.size();i++) { if (i != 0) @@ -3070,7 +3070,7 @@ cmXCodeObject* cmGlobalXCodeGenerator // If it's the default source group (empty name) then put the source file // directly in the tgroup... // - if (cmStdString(sg->GetFullName()) == "") + if (std::string(sg->GetFullName()) == "") { this->GroupNameMap[s] = tgroup; return tgroup; @@ -3081,12 +3081,12 @@ cmXCodeObject* cmGlobalXCodeGenerator { std::vector folders = cmSystemTools::tokenize(sg->GetFullName(), "\\"); - cmStdString curr_folder = target; + std::string curr_folder = target; curr_folder += "/"; for(std::vector::size_type i = 0; i < folders.size();i++) { curr_folder += folders[i]; - std::map::iterator i_folder = + std::map::iterator i_folder = this->GroupNameMap.find(curr_folder); //Create new folder if(i_folder == this->GroupNameMap.end()) @@ -3466,14 +3466,14 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( makefileStream << "# For each target create a dummy rule " "so the target does not have to exist\n"; - std::set emitted; + std::set emitted; for(std::vector::iterator i = targets.begin(); i != targets.end(); ++i) { cmXCodeObject* target = *i; - std::map const& deplibs = + std::map const& deplibs = target->GetDependLibraries(); - for(std::map::const_iterator ci + for(std::map::const_iterator ci = deplibs.begin(); ci != deplibs.end(); ++ci) { for(cmXCodeObject::StringVec::const_iterator d = ci->second.begin(); @@ -3529,12 +3529,12 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( std::string trel = this->ConvertToRelativeForMake(tfull.c_str()); // Add this target to the post-build phases of its dependencies. - std::map::const_iterator + std::map::const_iterator y = target->GetDependTargets().find(*ct); if(y != target->GetDependTargets().end()) { - std::vector const& deptgts = y->second; - for(std::vector::const_iterator d = deptgts.begin(); + std::vector const& deptgts = y->second; + for(std::vector::const_iterator d = deptgts.begin(); d != deptgts.end(); ++d) { makefileStream << this->PostBuildMakeTarget(*d, *ct) << ": " @@ -3546,12 +3546,12 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( makefileStream << trel << ":"; // List dependencies if any exist. - std::map::const_iterator + std::map::const_iterator x = target->GetDependLibraries().find(*ct); if(x != target->GetDependLibraries().end()) { - std::vector const& deplibs = x->second; - for(std::vector::const_iterator d = deplibs.begin(); + std::vector const& deplibs = x->second; + for(std::vector::const_iterator d = deplibs.begin(); d != deplibs.end(); ++d) { makefileStream << "\\\n\t" << @@ -3960,7 +3960,7 @@ cmGlobalXCodeGenerator // names since Xcode names them uniquely automatically with a numeric suffix // to avoid exact duplicate file names. Note that Mac file names are not // typically case sensitive, hence the LowerCase. - std::map counts; + std::map counts; std::vector objectSources; gt->GetObjectSources(objectSources); for(std::vector::const_iterator diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 8e2de9a..d2dd491 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -95,7 +95,7 @@ private: cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg); cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent, - cmStdString name); + std::string name); void CreateGroups(cmLocalGenerator* root, std::vector& generators); @@ -124,7 +124,7 @@ private: cmTarget& target, std::vector const & commands, const char* configName, - const std::map& + const std::map& multipleOutputPairs ); @@ -211,7 +211,7 @@ protected: unsigned int XcodeVersion; std::string VersionString; - std::set XCodeObjectIDs; + std::set XCodeObjectIDs; std::vector XCodeObjects; cmXCodeObject* RootObject; private: @@ -236,14 +236,14 @@ private: std::string CurrentReRunCMakeMakefile; std::string CurrentXCodeHackMakefile; std::string CurrentProject; - std::set TargetDoneSet; + std::set TargetDoneSet; std::vector CurrentOutputDirectoryComponents; std::vector ProjectSourceDirectoryComponents; std::vector ProjectOutputDirectoryComponents; - std::map GroupMap; - std::map GroupNameMap; - std::map TargetGroup; - std::map FileRefs; + std::map GroupMap; + std::map GroupNameMap; + std::map TargetGroup; + std::map FileRefs; std::vector Architectures; std::string PlatformToolset; }; diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 6173d21..22cba89 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -121,7 +121,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, __set_bool_if_set(this->GeneratePerTarget, "GRAPHVIZ_GENERATE_PER_TARGET"); __set_bool_if_set(this->GenerateDependers, "GRAPHVIZ_GENERATE_DEPENDERS"); - cmStdString ignoreTargetsRegexes; + std::string ignoreTargetsRegexes; __set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS"); this->TargetsToIgnoreRegex.clear(); @@ -135,7 +135,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, itvIt != ignoreTargetsRegExVector.end(); ++ itvIt ) { - cmStdString currentRegexString(*itvIt); + std::string currentRegexString(*itvIt); cmsys::RegularExpression currentRegex; if (!currentRegex.compile(currentRegexString.c_str())) { @@ -160,7 +160,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName) this->CollectTargetsAndLibs(); - for(std::map::const_iterator ptrIt = + for(std::map::const_iterator ptrIt = this->TargetPtrs.begin(); ptrIt != this->TargetPtrs.end(); ++ptrIt) @@ -211,7 +211,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) this->CollectTargetsAndLibs(); - for(std::map::const_iterator ptrIt = + for(std::map::const_iterator ptrIt = this->TargetPtrs.begin(); ptrIt != this->TargetPtrs.end(); ++ptrIt) @@ -265,7 +265,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName) std::set insertedConnections; std::set insertedNodes; - for(std::map::const_iterator ptrIt = + for(std::map::const_iterator ptrIt = this->TargetPtrs.begin(); ptrIt != this->TargetPtrs.end(); ++ptrIt) @@ -305,7 +305,7 @@ void cmGraphVizWriter::WriteConnections(const std::string& targetName, std::set& insertedConnections, cmGeneratedFileStream& str) const { - std::map::const_iterator targetPtrIt = + std::map::const_iterator targetPtrIt = this->TargetPtrs.find(targetName); if (targetPtrIt == this->TargetPtrs.end()) // not found at all @@ -331,7 +331,7 @@ void cmGraphVizWriter::WriteConnections(const std::string& targetName, ++ llit ) { const char* libName = llit->first.c_str(); - std::map::const_iterator libNameIt = + std::map::const_iterator libNameIt = this->TargetNamesNodes.find(libName); // can happen e.g. if GRAPHVIZ_TARGET_IGNORE_REGEX is used @@ -364,7 +364,7 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName, std::set& insertedConnections, cmGeneratedFileStream& str) const { - std::map::const_iterator targetPtrIt = + std::map::const_iterator targetPtrIt = this->TargetPtrs.find(targetName); if (targetPtrIt == this->TargetPtrs.end()) // not found at all @@ -383,7 +383,7 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName, std::string myNodeName = this->TargetNamesNodes.find(targetName)->second; // now search who links against me - for(std::map::const_iterator dependerIt = + for(std::map::const_iterator dependerIt = this->TargetPtrs.begin(); dependerIt != this->TargetPtrs.end(); ++dependerIt) @@ -411,7 +411,7 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName, if (libName == targetName) { // So this target links against targetName. - std::map::const_iterator dependerNodeNameIt = + std::map::const_iterator dependerNodeNameIt = this->TargetNamesNodes.find(dependerIt->first); if(dependerNodeNameIt != this->TargetNamesNodes.end()) @@ -452,7 +452,7 @@ void cmGraphVizWriter::WriteNode(const std::string& targetName, if (insertedNodes.find(targetName) == insertedNodes.end()) { insertedNodes.insert(targetName); - std::map::const_iterator nameIt = + std::map::const_iterator nameIt = this->TargetNamesNodes.find(targetName); str << " \"" << nameIt->second.c_str() << "\" [ label=\"" @@ -540,7 +540,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt) continue; } - std::map::const_iterator tarIt = + std::map::const_iterator tarIt = this->TargetPtrs.find(libName); if ( tarIt == this->TargetPtrs.end() ) { diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index 6af460b..a7acd0e 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -64,10 +64,10 @@ protected: bool GenerateForTargetType(cmTarget::TargetType targetType) const; - cmStdString GraphType; - cmStdString GraphName; - cmStdString GraphHeader; - cmStdString GraphNodePrefix; + std::string GraphType; + std::string GraphName; + std::string GraphHeader; + std::string GraphNodePrefix; bool GenerateForExecutables; bool GenerateForStaticLibs; @@ -81,9 +81,9 @@ protected: const std::vector& LocalGenerators; - std::map TargetPtrs; + std::map TargetPtrs; // maps from the actual target names to node names in dot: - std::map TargetNamesNodes; + std::map TargetNamesNodes; bool HaveTargetsAndLibs; }; diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index 34a9c7c..e03223f 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -108,7 +108,7 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table, { const char *new_value = flag+1+n; - std::map::iterator itr; + std::map::iterator itr; itr = this->FlagMap.find(entry->IDEName); if(itr != this->FlagMap.end()) { @@ -186,7 +186,7 @@ void cmIDEOptions::RemoveFlag(const char* flag) //---------------------------------------------------------------------------- const char* cmIDEOptions::GetFlag(const char* flag) { - std::map::iterator i = this->FlagMap.find(flag); + std::map::iterator i = this->FlagMap.find(flag); if(i != this->FlagMap.end()) { return i->second.c_str(); diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h index e78af3e..691893f 100644 --- a/Source/cmIDEOptions.h +++ b/Source/cmIDEOptions.h @@ -40,13 +40,13 @@ protected: // Then parse the command line flags specified in CMAKE_CXX_FLAGS // and CMAKE_C_FLAGS // and overwrite or add new values to this map - std::map FlagMap; + std::map FlagMap; // Preprocessor definitions. std::vector Defines; // Unrecognized flags that get no special handling. - cmStdString FlagString; + std::string FlagString; bool DoingDefine; bool AllowDefine; diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index e20fe02..df5508e 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -38,7 +38,7 @@ bool cmIncludeDirectoryCommand std::vector beforeIncludes; std::vector afterIncludes; - std::set systemIncludes; + std::set systemIncludes; for(; i != args.end(); ++i) { diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 0878aae..94d2091 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -97,7 +97,7 @@ bool cmInstallCommand::InitialPass(std::vector const& args, } // Unknown mode. - cmStdString e = "called with unknown mode "; + std::string e = "called with unknown mode "; e += args[0]; this->SetError(e.c_str()); return false; diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 1287ea6..045cff6 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -177,7 +177,7 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, // Now create a configuration-specific install rule for the import // file of each configuration. std::vector files; - for(std::map::const_iterator + for(std::map::const_iterator i = this->EFGen->GetConfigImportFiles().begin(); i != this->EFGen->GetConfigImportFiles().end(); ++i) { diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 7a39f45..5df6e4b 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -513,7 +513,7 @@ cmInstallTargetGenerator // Build a map of build-tree install_name to install-tree install_name for // shared libraries linked to this target. - std::map install_name_remap; + std::map install_name_remap; if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config)) { std::set const& sharedLibs @@ -590,7 +590,7 @@ cmInstallTargetGenerator { os << "\n" << indent << " -id \"" << new_id << "\""; } - for(std::map::const_iterator + for(std::map::const_iterator i = install_name_remap.begin(); i != install_name_remap.end(); ++i) { diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index dfd98fa..806d821 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -33,7 +33,7 @@ bool cmLoadCacheCommand // and they can not be overridden. bool excludeFiles=false; unsigned int i; - std::set excludes; + std::set excludes; for(i=0; i includes; + std::set includes; for(i=0; i VariablesToRead; + std::set VariablesToRead; std::string Prefix; bool ReadWithPrefix(std::vector const& args); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 75f2130..e36266a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -617,8 +617,8 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, // Parse the string to get the custom command line. cmCustomCommandLine commandLine; - std::vector cmd = cmSystemTools::ParseArguments(i->c_str()); - for(std::vector::iterator a = cmd.begin(); + std::vector cmd = cmSystemTools::ParseArguments(i->c_str()); + for(std::vector::iterator a = cmd.begin(); a != cmd.end(); ++a) { commandLine.push_back(*a); @@ -656,7 +656,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, cmGeneratorTarget& target) { - cmStdString objs; + std::string objs; std::vector objVector; // Add all the sources outputs to the depends of the target std::vector classes; @@ -728,8 +728,8 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, this->ExpandRuleVariables(*i, vars); // Parse the string to get the custom command line. cmCustomCommandLine commandLine; - std::vector cmd = cmSystemTools::ParseArguments(i->c_str()); - for(std::vector::iterator a = cmd.begin(); + std::vector cmd = cmSystemTools::ParseArguments(i->c_str()); + for(std::vector::iterator a = cmd.begin(); a != cmd.end(); ++a) { commandLine.push_back(*a); @@ -758,7 +758,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, void cmLocalGenerator -::CreateCustomTargetsAndCommands(std::set const& lang) +::CreateCustomTargetsAndCommands(std::set const& lang) { cmGeneratorTargetsType tgts = this->Makefile->GetGeneratorTargets(); for(cmGeneratorTargetsType::iterator l = tgts.begin(); @@ -1344,7 +1344,7 @@ std::string cmLocalGenerator::GetIncludeFlags( this->Makefile->GetDefinition(fwSearchFlagVar.c_str()); bool flagUsed = false; - std::set emitted; + std::set emitted; #ifdef __APPLE__ emitted.insert("/System/Library/Frameworks"); #endif @@ -1488,7 +1488,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } // Do not repeat an include path. - std::set emitted; + std::set emitted; // Store the automatic include paths. if(includeBinaryDir) @@ -2988,7 +2988,7 @@ cmLocalGenerator std::string const& dir_max) { // Look for an existing mapped name for this object file. - std::map::iterator it = + std::map::iterator it = this->UniqueObjectNamesMap.find(sin); // If no entry exists create one. @@ -3071,7 +3071,7 @@ cmLocalGenerator #endif // Insert the newly mapped object file name. - std::map::value_type e(sin, ssin); + std::map::value_type e(sin, ssin); it = this->UniqueObjectNamesMap.insert(e).first; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 633be5d..3fe6a26 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -406,7 +406,7 @@ protected: // generator directly. Any targets containing files that are not // of the types listed will be compiled as custom commands and added // to a custom target. - void CreateCustomTargetsAndCommands(std::set const&); + void CreateCustomTargetsAndCommands(std::set const&); // Handle old-style install rules stored in the targets. void GenerateTargetInstallRules( @@ -443,9 +443,9 @@ protected: std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; - std::map UniqueObjectNamesMap; + std::map UniqueObjectNamesMap; std::string::size_type ObjectPathMax; - std::set ObjectMaxPathViolations; + std::set ObjectMaxPathViolations; bool WindowsShell; bool WindowsVSIDE; bool WatcomWMake; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f47ea29..2516613 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -190,7 +190,7 @@ void cmLocalUnixMakefileGenerator3::AddLocalObjectFile( void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets (std::vector& targets) { - for (std::map::iterator lo = + for (std::map::iterator lo = this->LocalObjectFiles.begin(); lo != this->LocalObjectFiles.end(); ++lo) { @@ -235,7 +235,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() // only write local targets unless at the top Keep track of targets already // listed. - std::set emittedTargets; + std::set emittedTargets; if (this->Parent) { // write our targets, and while doing it collect up the object @@ -256,7 +256,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() // now write out the object rules // for each object file name - for (std::map::iterator lo = + for (std::map::iterator lo = this->LocalObjectFiles.begin(); lo != this->LocalObjectFiles.end(); ++lo) { @@ -371,7 +371,7 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3 ::WriteLocalMakefileTargets(std::ostream& ruleFileStream, - std::set &emitted) + std::set &emitted) { std::vector depends; std::vector commands; @@ -1196,12 +1196,12 @@ cmLocalUnixMakefileGenerator3 if(!filename) { // Get the set of source languages in the target. - std::set languages; + std::set languages; target.GetLanguages(languages); fout << "\n" << "# Per-language clean rules from dependency scanning.\n" << "foreach(lang"; - for(std::set::const_iterator l = languages.begin(); + for(std::set::const_iterator l = languages.begin(); l != languages.end(); ++l) { fout << " " << *l; @@ -1317,7 +1317,7 @@ cmLocalUnixMakefileGenerator3 // see if the variable has been defined before and return // the modified version of the variable - std::map::iterator i = + std::map::iterator i = this->MakeVariableMap.find(unmodified); if(i != this->MakeVariableMap.end()) { @@ -1721,7 +1721,7 @@ void cmLocalUnixMakefileGenerator3 { text = "Running external command ..."; } - std::set::const_iterator dit; + std::set::const_iterator dit; for ( dit = glIt->second.GetUtilities().begin(); dit != glIt->second.GetUtilities().end(); ++ dit ) diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 2ad5250..37ee874 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -211,11 +211,11 @@ public: // File pairs for implicit dependency scanning. The key of the map // is the depender and the value is the explicit dependee. struct ImplicitDependFileMap: - public std::map {}; + public std::map {}; struct ImplicitDependLanguageMap: - public std::map {}; + public std::map {}; struct ImplicitDependTargetMap: - public std::map {}; + public std::map {}; ImplicitDependLanguageMap const& GetImplicitDepends(cmTarget const& tgt); void AddImplicitDepends(cmTarget const& tgt, const std::string& lang, @@ -231,7 +231,7 @@ public: std::string objNoTargetDir, bool hasSourceExtension); - std::vector const& GetLocalHelp() { return this->LocalHelp; } + std::vector const& GetLocalHelp() { return this->LocalHelp; } /** Get whether to create rules to generate preprocessed and assembly sources. This could be converted to a variable lookup @@ -256,7 +256,7 @@ protected: // write the target rules for the local Makefile into the stream void WriteLocalMakefileTargets(std::ostream& ruleFileStream, - std::set &emitted); + std::set &emitted); // this method Writes the Directory information files void WriteDirectoryInformationFile(); @@ -370,16 +370,16 @@ private: LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false), HasAssembleRule(false) {} }; - std::map LocalObjectFiles; + std::map LocalObjectFiles; void WriteObjectConvenienceRule(std::ostream& ruleFileStream, const char* comment, const char* output, LocalObjectInfo const& info); - std::vector LocalHelp; + std::vector LocalHelp; /* does the work for each target */ - std::map MakeVariableMap; - std::map ShortMakeVariableMap; + std::map MakeVariableMap; + std::map ShortMakeVariableMap; }; #endif diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index a5ac629..b0c577e 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -80,7 +80,7 @@ private: void cmLocalVisualStudio6Generator::AddHelperCommands() { - std::set lang; + std::set lang; lang.insert("C"); lang.insert("CXX"); this->CreateCustomTargetsAndCommands(lang); @@ -426,7 +426,7 @@ void cmLocalVisualStudio6Generator } // Add per-source and per-configuration preprocessor definitions. - std::map cdmap; + std::map cdmap; { std::set targetCompileDefinitions; @@ -526,7 +526,7 @@ void cmLocalVisualStudio6Generator { fout << "\n# ADD CPP " << compileFlags << "\n\n"; } - std::map::iterator cdi = + std::map::iterator cdi = cdmap.find(cmSystemTools::UpperCase(config)); if(cdi != cdmap.end() && !cdi->second.empty()) { diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 7b921a3..6ad5e04 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -59,7 +59,7 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator() void cmLocalVisualStudio7Generator::AddHelperCommands() { - std::set lang; + std::set lang; lang.insert("C"); lang.insert("CXX"); lang.insert("RC"); @@ -1468,7 +1468,7 @@ public: cmTarget& target, cmSourceFile const& sf, std::vector* configs); - std::map FileConfigMap; + std::map FileConfigMap; }; cmLocalVisualStudio7GeneratorFCInfo @@ -1712,7 +1712,7 @@ bool cmLocalVisualStudio7Generator aCompilerTool = "VFCustomBuildTool"; } } - for(std::map::const_iterator + for(std::map::const_iterator fci = fcinfo.FileConfigMap.begin(); fci != fcinfo.FileConfigMap.end(); ++fci) { diff --git a/Source/cmMakeDepend.h b/Source/cmMakeDepend.h index 2419ae9..2c9d515 100644 --- a/Source/cmMakeDepend.h +++ b/Source/cmMakeDepend.h @@ -138,10 +138,10 @@ protected: cmsys::RegularExpression IncludeFileRegularExpression; cmsys::RegularExpression ComplainFileRegularExpression; std::vector IncludeDirectories; - typedef std::map FileToPathMapType; - typedef std::map + typedef std::map FileToPathMapType; + typedef std::map DirectoryToFileToPathMapType; - typedef std::map + typedef std::map DependInformationMapType; DependInformationMapType DependInformationMap; DirectoryToFileToPathMapType DirectoryToFileToPathMap; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7198523..d107ddf 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -45,8 +45,8 @@ class cmMakefile::Internals { public: std::stack > VarStack; - std::stack > VarInitStack; - std::stack > VarUsageStack; + std::stack > VarInitStack; + std::stack > VarUsageStack; bool IsSourceFileTryCompile; }; @@ -54,7 +54,7 @@ public: cmMakefile::cmMakefile(): Internal(new Internals) { const cmDefinitions& defs = cmDefinitions(); - const std::set globalKeys = defs.LocalKeys(); + const std::set globalKeys = defs.LocalKeys(); this->Internal->VarStack.push(defs); this->Internal->VarInitStack.push(globalKeys); this->Internal->VarUsageStack.push(globalKeys); @@ -203,7 +203,7 @@ cmMakefile::~cmMakefile() { delete *i; } - for(std::map::iterator i = this->Tests.begin(); + for(std::map::iterator i = this->Tests.begin(); i != this->Tests.end(); ++i) { delete i->second; @@ -247,10 +247,10 @@ void cmMakefile::PrintStringVector(const char* s, void cmMakefile ::PrintStringVector(const char* s, - const std::vector >& v) const + const std::vector >& v) const { std::cout << s << ": ( \n"; - for(std::vector >::const_iterator i + for(std::vector >::const_iterator i = v.begin(); i != v.end(); ++i) { std::cout << i->first.c_str() << " " << i->second; @@ -1746,9 +1746,9 @@ void cmMakefile::AddIncludeDirectories(const std::vector &incs, //---------------------------------------------------------------------------- void -cmMakefile::AddSystemIncludeDirectories(const std::set &incs) +cmMakefile::AddSystemIncludeDirectories(const std::set &incs) { - for(std::set::const_iterator li = incs.begin(); + for(std::set::const_iterator li = incs.begin(); li != incs.end(); ++li) { this->SystemIncludeDirectories.insert(*li); @@ -1865,8 +1865,8 @@ void cmMakefile::CheckForUnusedVariables() const return; } const cmDefinitions& defs = this->Internal->VarStack.top(); - const std::set& locals = defs.LocalKeys(); - std::set::const_iterator it = locals.begin(); + const std::set& locals = defs.LocalKeys(); + std::set::const_iterator it = locals.begin(); for (; it != locals.end(); ++it) { this->CheckForUnused("out of scope", it->c_str()); @@ -1903,7 +1903,7 @@ void cmMakefile::CheckForUnused(const char* reason, { if (this->WarnUnused && !this->VariableUsed(name)) { - cmStdString path; + std::string path; cmListFileBacktrace bt; if (this->CallStack.size()) { @@ -2487,7 +2487,7 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const std::vector cmMakefile ::GetDefinitions(int cacheonly /* = 0 */) const { - std::set definitions; + std::set definitions; if ( !cacheonly ) { definitions = this->Internal->VarStack.top().ClosureKeys(); @@ -2501,7 +2501,7 @@ std::vector cmMakefile std::vector res; - std::set::iterator fit; + std::set::iterator fit; for ( fit = definitions.begin(); fit != definitions.end(); fit ++ ) { res.push_back(*fit); @@ -3679,7 +3679,7 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "LISTFILE_STACK") { - for (std::deque::const_iterator + for (std::deque::const_iterator i = this->ListFileStack.begin(); i != this->ListFileStack.end(); ++i) { @@ -3864,7 +3864,7 @@ cmTest* cmMakefile::CreateTest(const std::string& testName) //---------------------------------------------------------------------------- cmTest* cmMakefile::GetTest(const std::string& testName) const { - std::map::const_iterator + std::map::const_iterator mi = this->Tests.find(testName); if(mi != this->Tests.end()) { @@ -3903,7 +3903,7 @@ std::string cmMakefile::GetListFileStack() const size_t depth = this->ListFileStack.size(); if (depth > 0) { - std::deque::const_iterator it = this->ListFileStack.end(); + std::deque::const_iterator it = this->ListFileStack.end(); do { if (depth != this->ListFileStack.size()) @@ -3926,8 +3926,8 @@ std::string cmMakefile::GetListFileStack() const void cmMakefile::PushScope() { cmDefinitions* parent = &this->Internal->VarStack.top(); - const std::set& init = this->Internal->VarInitStack.top(); - const std::set& usage = this->Internal->VarUsageStack.top(); + const std::set& init = this->Internal->VarInitStack.top(); + const std::set& usage = this->Internal->VarUsageStack.top(); this->Internal->VarStack.push(cmDefinitions(parent)); this->Internal->VarInitStack.push(init); this->Internal->VarUsageStack.push(usage); @@ -3936,12 +3936,12 @@ void cmMakefile::PushScope() void cmMakefile::PopScope() { cmDefinitions* current = &this->Internal->VarStack.top(); - std::set init = this->Internal->VarInitStack.top(); - std::set usage = this->Internal->VarUsageStack.top(); - const std::set& locals = current->LocalKeys(); + std::set init = this->Internal->VarInitStack.top(); + std::set usage = this->Internal->VarUsageStack.top(); + const std::set& locals = current->LocalKeys(); // Remove initialization and usage information for variables in the local // scope. - std::set::const_iterator it = locals.begin(); + std::set::const_iterator it = locals.begin(); for (; it != locals.end(); ++it) { init.erase(*it); @@ -4054,7 +4054,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name, { // Look for an imported target. These take priority because they // are more local in scope and do not have to be globally unique. - std::map::const_iterator + std::map::const_iterator imported = this->ImportedTargets.find(name); if(imported != this->ImportedTargets.end()) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 39635dd..86cedb0 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -542,7 +542,7 @@ public: /** * Mark include directories as system directories. */ - void AddSystemIncludeDirectories(const std::set &incs); + void AddSystemIncludeDirectories(const std::set &incs); /** Expand out any arguements in the vector that have ; separated * strings into multiple arguements. A new vector is created @@ -876,7 +876,7 @@ public: void AddQtUiFileWithOptions(cmSourceFile *sf); std::vector GetQtUiFilesWithOptions() const; - std::set const & GetSystemIncludeDirectories() const + std::set const & GetSystemIncludeDirectories() const { return this->SystemIncludeDirectories; } protected: @@ -904,14 +904,14 @@ protected: std::vector SourceFiles; // Tests - std::map Tests; + std::map Tests; // The link-library paths. Order matters, use std::vector (not std::set). std::vector LinkDirectories; // The set of include directories that are marked as system include // directories. - std::set SystemIncludeDirectories; + std::set SystemIncludeDirectories; std::vector ListFiles; // list of command files loaded std::vector OutputFiles; // list of command files loaded @@ -957,7 +957,7 @@ private: friend class cmMakeDepend; // make depend needs direct access // to the Sources array void PrintStringVector(const char* s, const - std::vector >& v) const; + std::vector >& v) const; void PrintStringVector(const char* s, const std::vector& v) const; @@ -968,10 +968,10 @@ private: void PushFunctionBlockerBarrier(); void PopFunctionBlockerBarrier(bool reportError = true); - typedef std::map StringStringMap; + typedef std::map StringStringMap; StringStringMap MacrosMap; - std::map SubDirectoryOrder; + std::map SubDirectoryOrder; mutable cmsys::RegularExpression cmDefineRegex; mutable cmsys::RegularExpression cmDefine01Regex; @@ -987,7 +987,7 @@ private: bool CheckSystemVars; // stack of list files being read - std::deque ListFileStack; + std::deque ListFileStack; // stack of commands being invoked. struct CallStackEntry @@ -1000,7 +1000,7 @@ private: friend class cmMakefileCall; std::vector ImportedTargetsOwned; - std::map ImportedTargets; + std::map ImportedTargets; // Internal policy stack management. void PushPolicy(bool weak = false, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index fb9b045..0a836a5 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -342,21 +342,21 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) void cmMakefileTargetGenerator::WriteTargetLanguageFlags() { // write language flags for target - std::set languages; + std::set languages; this->Target->GetLanguages(languages); // put the compiler in the rules.make file so that if it changes // things rebuild - for(std::set::const_iterator l = languages.begin(); + for(std::set::const_iterator l = languages.begin(); l != languages.end(); ++l) { - cmStdString compiler = "CMAKE_"; + std::string compiler = "CMAKE_"; compiler += *l; compiler += "_COMPILER"; *this->FlagFileStream << "# compile " << l->c_str() << " with " << this->Makefile->GetSafeDefinition(compiler.c_str()) << "\n"; } - for(std::set::const_iterator l = languages.begin(); + for(std::set::const_iterator l = languages.begin(); l != languages.end(); ++l) { *this->FlagFileStream << *l << "_FLAGS = " << this->GetFlags(*l) << "\n\n"; @@ -1531,7 +1531,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output, } // Make sure the extra files are built. - for(std::set::const_iterator i = this->ExtraFiles.begin(); + for(std::set::const_iterator i = this->ExtraFiles.begin(); i != this->ExtraFiles.end(); ++i) { depends.push_back(*i); @@ -1561,7 +1561,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) return std::string(); } - std::set emitted; + std::set emitted; #ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */ emitted.insert("/System/Library/Frameworks"); #endif diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index d2cbadd..5f697a5 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -208,7 +208,7 @@ protected: std::string FlagFileNameFull; cmGeneratedFileStream *FlagFileStream; class StringList: public std::vector {}; - std::map FlagFileDepends; + std::map FlagFileDepends; // the stream for the info file std::string InfoFileNameFull; @@ -222,12 +222,12 @@ protected: std::vector ExternalObjects; // Set of object file names that will be built in this directory. - std::set ObjectFiles; + std::set ObjectFiles; // Set of extra output files to be driven by the build. - std::set ExtraFiles; + std::set ExtraFiles; - typedef std::map MultipleOutputPairsType; + typedef std::map MultipleOutputPairsType; MultipleOutputPairsType MultipleOutputPairs; // Target name info. @@ -238,11 +238,11 @@ protected: std::string TargetNamePDB; // Mac OS X content info. - std::set MacContentFolders; + std::set MacContentFolders; cmOSXBundleGenerator* OSXBundleGenerator; MacOSXContentGeneratorType* MacOSXContentGenerator; - typedef std::map ByLanguageMap; + typedef std::map ByLanguageMap; std::string GetFlags(const std::string &l); ByLanguageMap FlagsByLanguage; std::string GetDefines(const std::string &l); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 502127e..a49fc2d 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -109,9 +109,9 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules() << "\n\n"; #endif - std::set languages; + std::set languages; this->GetTarget()->GetLanguages(languages); - for(std::set::const_iterator l = languages.begin(); + for(std::set::const_iterator l = languages.begin(); l != languages.end(); ++l) this->WriteLanguageRules(*l); diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index e8ac81c..b3b37a4 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -140,7 +140,7 @@ protected: MacOSXContentGeneratorType* MacOSXContentGenerator; // Properly initialized by sub-classes. cmOSXBundleGenerator* OSXBundleGenerator; - std::set MacContentFolders; + std::set MacContentFolders; void addPoolNinjaVariable(const char* pool_property, cmTarget* target, diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index 2f36394..97ae731 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -52,7 +52,7 @@ public: MacOSXContentGeneratorType* generator); std::string InitMacOSXContentDirectory(const char* pkgloc); - void SetMacContentFolders(std::set* macContentFolders) + void SetMacContentFolders(std::set* macContentFolders) { this->MacContentFolders = macContentFolders; } private: @@ -63,7 +63,7 @@ private: cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; const char* ConfigName; - std::set* MacContentFolders; + std::set* MacContentFolders; }; diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 86beb97..79677e3 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -138,9 +138,9 @@ bool cmOrderDirectoriesConstraint::FileMayConflict(std::string const& dir, } // Check if the file will be built by cmake. - std::set const& files = + std::set const& files = (this->GlobalGenerator->GetDirectoryContent(dir, false)); - std::set::const_iterator fi = files.find(name); + std::set::const_iterator fi = files.find(name); return fi != files.end(); } @@ -200,7 +200,7 @@ bool cmOrderDirectoriesConstraintSOName::FindConflict(std::string const& dir) { // We do not have the soname. Look for files in the directory // that may conflict. - std::set const& files = + std::set const& files = (this->GlobalGenerator ->GetDirectoryContent(dir, true)); @@ -208,9 +208,9 @@ bool cmOrderDirectoriesConstraintSOName::FindConflict(std::string const& dir) // know the soname just look at all files that start with the // file name. Usually the soname starts with the library name. std::string base = this->FileName; - std::set::const_iterator first = files.lower_bound(base); + std::set::const_iterator first = files.lower_bound(base); ++base[base.size()-1]; - std::set::const_iterator last = files.upper_bound(base); + std::set::const_iterator last = files.upper_bound(base); if(first != last) { return true; @@ -251,8 +251,8 @@ bool cmOrderDirectoriesConstraintLibrary::FindConflict(std::string const& dir) if(!this->OD->LinkExtensions.empty() && this->OD->RemoveLibraryExtension.find(this->FileName)) { - cmStdString lib = this->OD->RemoveLibraryExtension.match(1); - cmStdString ext = this->OD->RemoveLibraryExtension.match(2); + std::string lib = this->OD->RemoveLibraryExtension.match(1); + std::string ext = this->OD->RemoveLibraryExtension.match(2); for(std::vector::iterator i = this->OD->LinkExtensions.begin(); i != this->OD->LinkExtensions.end(); ++i) @@ -407,7 +407,7 @@ cmOrderDirectories //---------------------------------------------------------------------------- void cmOrderDirectories -::SetImplicitDirectories(std::set const& implicitDirs) +::SetImplicitDirectories(std::set const& implicitDirs) { this->ImplicitDirectories = implicitDirs; } @@ -444,11 +444,11 @@ void cmOrderDirectories::CollectOriginalDirectories() int cmOrderDirectories::AddOriginalDirectory(std::string const& dir) { // Add the runtime directory with a unique index. - std::map::iterator i = + std::map::iterator i = this->DirectoryIndex.find(dir); if(i == this->DirectoryIndex.end()) { - std::map::value_type + std::map::value_type entry(dir, static_cast(this->OriginalDirectories.size())); i = this->DirectoryIndex.insert(entry).first; this->OriginalDirectories.push_back(dir); diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h index 76bf429..07c85dd 100644 --- a/Source/cmOrderDirectories.h +++ b/Source/cmOrderDirectories.h @@ -34,7 +34,7 @@ public: void AddLinkLibrary(std::string const& fullPath); void AddUserDirectories(std::vector const& extra); void AddLanguageDirectories(std::vector const& dirs); - void SetImplicitDirectories(std::set const& implicitDirs); + void SetImplicitDirectories(std::set const& implicitDirs); void SetLinkExtensionInfo(std::vector const& linkExtensions, std::string const& removeExtRegex); @@ -54,11 +54,11 @@ private: std::vector LanguageDirectories; cmsys::RegularExpression RemoveLibraryExtension; std::vector LinkExtensions; - std::set ImplicitDirectories; - std::set EmmittedConstraintSOName; - std::set EmmittedConstraintLibrary; + std::set ImplicitDirectories; + std::set EmmittedConstraintSOName; + std::set EmmittedConstraintLibrary; std::vector OriginalDirectories; - std::map DirectoryIndex; + std::map DirectoryIndex; std::vector DirectoryVisited; void CollectOriginalDirectories(); int AddOriginalDirectory(std::string const& dir); diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx index 9ebbaa4..3875318 100644 --- a/Source/cmPropertyDefinitionMap.cxx +++ b/Source/cmPropertyDefinitionMap.cxx @@ -14,7 +14,7 @@ #include "cmDocumentationSection.h" void cmPropertyDefinitionMap -::DefineProperty(const cmStdString& name, cmProperty::ScopeType scope, +::DefineProperty(const std::string& name, cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, bool chain) @@ -29,7 +29,7 @@ void cmPropertyDefinitionMap } } -bool cmPropertyDefinitionMap::IsPropertyDefined(const cmStdString& name) +bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) { cmPropertyDefinitionMap::iterator it = this->find(name); if (it == this->end()) @@ -40,7 +40,7 @@ bool cmPropertyDefinitionMap::IsPropertyDefined(const cmStdString& name) return true; } -bool cmPropertyDefinitionMap::IsPropertyChained(const cmStdString& name) +bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) { cmPropertyDefinitionMap::iterator it = this->find(name); if (it == this->end()) diff --git a/Source/cmPropertyDefinitionMap.h b/Source/cmPropertyDefinitionMap.h index 68c3ff3..00c7328 100644 --- a/Source/cmPropertyDefinitionMap.h +++ b/Source/cmPropertyDefinitionMap.h @@ -17,20 +17,20 @@ class cmDocumentationSection; class cmPropertyDefinitionMap : -public std::map +public std::map { public: // define the property - void DefineProperty(const cmStdString& name, cmProperty::ScopeType scope, + void DefineProperty(const std::string& name, cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, bool chain); // has a named property been defined - bool IsPropertyDefined(const cmStdString& name); + bool IsPropertyDefined(const std::string& name); // is a named property set to chain - bool IsPropertyChained(const cmStdString& name); + bool IsPropertyChained(const std::string& name); }; #endif diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index a13ac35..fa33848 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -16,7 +16,7 @@ class cmake; -class cmPropertyMap : public std::map +class cmPropertyMap : public std::map { public: cmProperty *GetOrCreateProperty(const std::string& name); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index e075c54..17b2424 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -697,7 +697,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, { cmMakefile *makefile = target->GetMakefile(); - std::set skipped; + std::set skipped; std::vector skipVec; cmSystemTools::ExpandListArgument(this->SkipUic.c_str(), skipVec); @@ -1895,7 +1895,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, |cmsysTerminal_Color_ForegroundBold, msg.c_str(), true, this->ColorOutput); - std::vector command; + std::vector command; command.push_back(this->MocExecutable); for (std::list::const_iterator it = this->MocIncludes.begin(); it != this->MocIncludes.end(); @@ -1924,7 +1924,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, if (this->Verbose) { - for(std::vector::const_iterator cmdIt = command.begin(); + for(std::vector::const_iterator cmdIt = command.begin(); cmdIt != command.end(); ++cmdIt) { @@ -1971,7 +1971,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& path, |cmsysTerminal_Color_ForegroundBold, msg.c_str(), true, this->ColorOutput); - std::vector command; + std::vector command; command.push_back(this->UicExecutable); std::vector opts = this->UicTargetOptions; @@ -1996,7 +1996,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& path, if (this->Verbose) { - for(std::vector::const_iterator cmdIt = command.begin(); + for(std::vector::const_iterator cmdIt = command.begin(); cmdIt != command.end(); ++cmdIt) { @@ -2034,7 +2034,7 @@ bool cmQtAutoGenerators::GenerateQrc() { continue; } - std::vector command; + std::vector command; command.push_back(this->RccExecutable); std::string basename = cmsys::SystemTools:: @@ -2068,7 +2068,7 @@ bool cmQtAutoGenerators::GenerateQrc() if (this->Verbose) { - for(std::vector::const_iterator cmdIt = command.begin(); + for(std::vector::const_iterator cmdIt = command.begin(); cmdIt != command.end(); ++cmdIt) { diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 11a9913..7ff12dd 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -326,11 +326,11 @@ std::string cmRST::ReplaceSubstitutions(std::string const& line) std::string::size_type start = this->Substitution.start(2); std::string::size_type end = this->Substitution.end(2); std::string substitute = this->Substitution.match(3); - std::map::iterator + std::map::iterator replace = this->Replace.find(substitute); if(replace != this->Replace.end()) { - std::pair::iterator, bool> replaced = + std::pair::iterator, bool> replaced = this->Replaced.insert(substitute); if(replaced.second) { diff --git a/Source/cmRST.h b/Source/cmRST.h index 3356008..b9b2366 100644 --- a/Source/cmRST.h +++ b/Source/cmRST.h @@ -92,8 +92,8 @@ private: std::vector MarkupLines; std::string DocDir; - std::map Replace; - std::set Replaced; + std::map Replace; + std::set Replaced; std::string ReplaceName; }; diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index e561e36..84c7610 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -241,7 +241,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode() //---------------------------------------------------------------------------- bool cmSetPropertyCommand::HandleTargetMode() { - for(std::set::const_iterator ni = this->Names.begin(); + for(std::set::const_iterator ni = this->Names.begin(); ni != this->Names.end(); ++ni) { if (this->Makefile->IsAlias(*ni)) @@ -297,7 +297,7 @@ bool cmSetPropertyCommand::HandleTarget(cmTarget* target) //---------------------------------------------------------------------------- bool cmSetPropertyCommand::HandleSourceMode() { - for(std::set::const_iterator ni = this->Names.begin(); + for(std::set::const_iterator ni = this->Names.begin(); ni != this->Names.end(); ++ni) { // Get the source file. @@ -345,8 +345,8 @@ bool cmSetPropertyCommand::HandleSource(cmSourceFile* sf) bool cmSetPropertyCommand::HandleTestMode() { // Look for tests with all names given. - std::set::iterator next; - for(std::set::iterator ni = this->Names.begin(); + std::set::iterator next; + for(std::set::iterator ni = this->Names.begin(); ni != this->Names.end(); ni = next) { next = ni; @@ -369,7 +369,7 @@ bool cmSetPropertyCommand::HandleTestMode() { cmOStringStream e; e << "given TEST names that do not exist:\n"; - for(std::set::const_iterator ni = this->Names.begin(); + for(std::set::const_iterator ni = this->Names.begin(); ni != this->Names.end(); ++ni) { e << " " << *ni << "\n"; @@ -440,7 +440,7 @@ bool cmSetPropertyCommand::HandleCacheMode() return false; } - for(std::set::const_iterator ni = this->Names.begin(); + for(std::set::const_iterator ni = this->Names.begin(); ni != this->Names.end(); ++ni) { // Get the source file. diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index 5470314..5757d21 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -44,7 +44,7 @@ public: cmTypeMacro(cmSetPropertyCommand, cmCommand); private: - std::set Names; + std::set Names; std::string PropertyName; std::string PropertyValue; bool Remove; diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index 195feb5..8fed95e 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -99,7 +99,7 @@ bool cmSourceGroup::MatchesRegex(const char* name) //---------------------------------------------------------------------------- bool cmSourceGroup::MatchesFiles(const char* name) { - std::set::const_iterator i = this->GroupFiles.find(name); + std::set::const_iterator i = this->GroupFiles.find(name); if(i != this->GroupFiles.end()) { return true; diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index 2d891d1..e8cf519 100644 --- a/Source/cmSourceGroup.h +++ b/Source/cmSourceGroup.h @@ -118,7 +118,7 @@ private: /** * Set of file names explicitly added to this group. */ - std::set GroupFiles; + std::set GroupFiles; /** * Vector of all source files that have been assigned to diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 04e1bc8..ed8efcc 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -241,7 +241,7 @@ inline bool operator==(std::string const& a, const char* b) // std::string is really basic_string<....lots of stuff....> // when combined with a map or set, the symbols can be > 2000 chars! #include -typedef cmsys::String cmStdString; +//typedef cmsys::String std::string; // Define cmOStringStream and cmIStringStream wrappers to hide // differences between std::stringstream and the old strstream. @@ -468,7 +468,7 @@ struct cmStrCmp { } private: - const cmStdString m_test; + const std::string m_test; }; #endif diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 2b17fba..39b53bf 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -477,13 +477,6 @@ public: args.push_back(*arg); } } - void Store(std::vector& args) const - { - for(char** arg = this->ArgV; arg && *arg; ++arg) - { - args.push_back(*arg); - } - } }; //---------------------------------------------------------------------------- @@ -495,15 +488,6 @@ void cmSystemTools::ParseUnixCommandLine(const char* command, argv.Store(args); } -//---------------------------------------------------------------------------- -void cmSystemTools::ParseUnixCommandLine(const char* command, - std::vector& args) -{ - // Invoke the underlying parser. - cmSystemToolsArgV argv = cmsysSystem_Parse_CommandForUnix(command, 0); - argv.Store(args); -} - std::string cmSystemTools::EscapeWindowsShellArgument(const char* arg, int shell_flags) { @@ -523,9 +507,9 @@ std::string cmSystemTools::EscapeWindowsShellArgument(const char* arg, return result; } -std::vector cmSystemTools::ParseArguments(const char* command) +std::vector cmSystemTools::ParseArguments(const char* command) { - std::vector args; + std::vector args; std::string arg; bool win_path = false; @@ -606,22 +590,6 @@ std::vector cmSystemTools::ParseArguments(const char* command) } -bool cmSystemTools::RunSingleCommand(std::vectorconst& command, - std::string* output , - int* retVal , const char* dir , - OutputOption outputflag , - double timeout ) -{ - std::vector cmd; - for(std::vector::const_iterator i = command.begin(); - i != command.end(); ++i) - { - cmd.push_back(*i); - } - return cmSystemTools::RunSingleCommand(cmd, output, retVal, dir, - outputflag, timeout); -} - bool cmSystemTools::RunSingleCommand(std::vectorconst& command, std::string* output , int* retVal , const char* dir , @@ -781,7 +749,7 @@ bool cmSystemTools::RunSingleCommand( outputflag = OUTPUT_NONE; } - std::vector args = cmSystemTools::ParseArguments(command); + std::vector args = cmSystemTools::ParseArguments(command); if(args.size() < 1) { @@ -1114,8 +1082,8 @@ void cmSystemTools::ExpandListArgument(const std::string& arg, } } -bool cmSystemTools::SimpleGlob(const cmStdString& glob, - std::vector& files, +bool cmSystemTools::SimpleGlob(const std::string& glob, + std::vector& files, int type /* = 0 */) { files.clear(); @@ -1233,7 +1201,7 @@ cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext) return cmSystemTools::UNKNOWN_FILE_FORMAT; } -bool cmSystemTools::Split(const char* s, std::vector& l) +bool cmSystemTools::Split(const char* s, std::vector& l) { std::vector temp; bool res = Superclass::Split(s, temp); @@ -1445,7 +1413,7 @@ bool cmSystemTools::IsPathToFramework(const char* path) } bool cmSystemTools::CreateTar(const char* outFileName, - const std::vector& files, + const std::vector& files, bool gzip, bool bzip2, bool verbose) { #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -1465,7 +1433,7 @@ bool cmSystemTools::CreateTar(const char* outFileName, cmArchiveWrite::CompressNone)), cmArchiveWrite::TypeTAR); a.SetVerbose(verbose); - for(std::vector::const_iterator i = files.begin(); + for(std::vector::const_iterator i = files.begin(); i != files.end(); ++i) { std::string path = *i; @@ -2317,7 +2285,7 @@ bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath, bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath, std::string& soname) { - std::vector cmds; + std::vector cmds; cmds.push_back("otool"); cmds.push_back("-D"); cmds.push_back(fullPath.c_str()); diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 4a212c2..27b4bce 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -172,8 +172,8 @@ public: * want to find. 0 means all files, -1 means directories, 1 means * files only. This method returns true if search was succesfull. */ - static bool SimpleGlob(const cmStdString& glob, - std::vector& files, + static bool SimpleGlob(const std::string& glob, + std::vector& files, int type = 0); ///! Copy a file. @@ -234,18 +234,13 @@ public: int* retVal = 0, const char* dir = 0, OutputOption outputflag = OUTPUT_MERGE, double timeout = 0.0); - static bool RunSingleCommand(std::vector const& command, - std::string* output = 0, - int* retVal = 0, const char* dir = 0, - OutputOption outputflag = OUTPUT_MERGE, - double timeout = 0.0); static std::string PrintSingleCommand(std::vector const&); /** * Parse arguments out of a single string command */ - static std::vector ParseArguments(const char* command); + static std::vector ParseArguments(const char* command); /** Parse arguments out of a windows command line string. */ static void ParseWindowsCommandLine(const char* command, @@ -254,8 +249,6 @@ public: /** Parse arguments out of a unix command line string. */ static void ParseUnixCommandLine(const char* command, std::vector& args); - static void ParseUnixCommandLine(const char* command, - std::vector& args); /** Compute an escaped version of the given argument for use in a windows shell. See kwsys/System.h.in for details. */ @@ -321,7 +314,7 @@ public: /** Split a string on its newlines into multiple lines. Returns false only if the last line stored had no newline. */ - static bool Split(const char* s, std::vector& l); + static bool Split(const char* s, std::vector& l); static void SetForceUnixPaths(bool v) { s_ForceUnixPaths = v; @@ -390,7 +383,7 @@ public: static bool ListTar(const char* outFileName, bool gzip, bool verbose); static bool CreateTar(const char* outFileName, - const std::vector& files, bool gzip, + const std::vector& files, bool gzip, bool bzip2, bool verbose); static bool ExtractTar(const char* inFileName, bool gzip, bool verbose); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c927a0b..99f2c1f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -118,7 +118,7 @@ public: LinkInterfaceMapType LinkInterfaceMap; bool PolicyWarnedCMP0022; - typedef std::map OutputInfoMapType; + typedef std::map OutputInfoMapType; OutputInfoMapType OutputInfoMap; typedef std::map @@ -356,10 +356,10 @@ void cmTarget::SetMakefile(cmMakefile* mf) { this->InsertInclude(*it); } - const std::set parentSystemIncludes = + const std::set parentSystemIncludes = this->Makefile->GetSystemIncludeDirectories(); - for (std::set::const_iterator it + for (std::set::const_iterator it = parentSystemIncludes.begin(); it != parentSystemIncludes.end(); ++it) { @@ -428,7 +428,7 @@ void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile) cmListFileBacktrace const* cmTarget::GetUtilityBacktrace( const std::string& u) const { - std::map::const_iterator i = + std::map::const_iterator i = this->UtilityBacktraces.find(u); if(i == this->UtilityBacktraces.end()) return 0; @@ -776,8 +776,8 @@ void cmTarget::GetDirectLinkLibraries(const char *config, &dagChecker), libs); - std::set seenProps = cge->GetSeenTargetProperties(); - for (std::set::const_iterator it = seenProps.begin(); + std::set seenProps = cge->GetSeenTargetProperties(); + for (std::set::const_iterator it = seenProps.begin(); it != seenProps.end(); ++it) { if (!this->GetProperty(it->c_str())) @@ -887,7 +887,7 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s, = (sig == cmTarget::KeywordTLLSignature ? "keyword" : "plain"); s << "The uses of the " << sigString << " signature are here:\n"; - std::set emitted; + std::set emitted; for(std::vector::const_iterator it = sigs.begin(); it != sigs.end(); ++it) { @@ -981,9 +981,9 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, //---------------------------------------------------------------------------- void -cmTarget::AddSystemIncludeDirectories(const std::set &incs) +cmTarget::AddSystemIncludeDirectories(const std::set &incs) { - for(std::set::const_iterator li = incs.begin(); + for(std::set::const_iterator li = incs.begin(); li != incs.end(); ++li) { this->SystemIncludeDirectories.insert(*li); @@ -1574,7 +1574,7 @@ static void processIncludeDirectories(cmTarget const* tgt, { bool testIsOff = true; bool cacheIncludes = false; - std::vector entryIncludes = (*it)->CachedEntries; + std::vector& entryIncludes = (*it)->CachedEntries; if(!entryIncludes.empty()) { testIsOff = false; @@ -2806,7 +2806,7 @@ class cmTargetCollectLinkLanguages { public: cmTargetCollectLinkLanguages(cmTarget const* target, const char* config, - std::set& languages, + std::set& languages, cmTarget const* head): Config(config), Languages(languages), HeadTarget(head), Makefile(target->GetMakefile()), Target(target) @@ -2878,7 +2878,7 @@ public: } private: const char* Config; - std::set& Languages; + std::set& Languages; cmTarget const* HeadTarget; cmMakefile* Makefile; const cmTarget* Target; @@ -2917,7 +2917,7 @@ class cmTargetSelectLinker cmTarget const* Target; cmMakefile* Makefile; cmGlobalGenerator* GG; - std::set Preferred; + std::set Preferred; public: cmTargetSelectLinker(cmTarget const* target): Preference(0), Target(target) { @@ -2949,7 +2949,7 @@ public: e << "Target " << this->Target->GetName() << " contains multiple languages with the highest linker preference" << " (" << this->Preference << "):\n"; - for(std::set::const_iterator + for(std::set::const_iterator li = this->Preferred.begin(); li != this->Preferred.end(); ++li) { e << " " << *li << "\n"; @@ -2968,7 +2968,7 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc, cmTarget const* head) const { // Get languages built in this target. - std::set languages; + std::set languages; LinkImplementation const* impl = this->GetLinkImplementation(config, head); for(std::vector::const_iterator li = impl->Languages.begin(); li != impl->Languages.end(); ++li) @@ -2985,7 +2985,7 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc, } // Store the transitive closure of languages. - for(std::set::const_iterator li = languages.begin(); + for(std::set::const_iterator li = languages.begin(); li != languages.end(); ++li) { lc.Languages.push_back(*li); @@ -3013,7 +3013,7 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc, } // Now consider languages that propagate from linked targets. - for(std::set::const_iterator sit = languages.begin(); + for(std::set::const_iterator sit = languages.begin(); sit != languages.end(); ++sit) { std::string propagates = "CMAKE_"+*sit+"_LINKER_PREFERENCE_PROPAGATES"; @@ -4822,7 +4822,7 @@ bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p, } //---------------------------------------------------------------------------- -void cmTarget::GetLanguages(std::set& languages) const +void cmTarget::GetLanguages(std::set& languages) const { for(std::vector::const_iterator i = this->SourceFiles.begin(); i != this->SourceFiles.end(); ++i) @@ -5662,7 +5662,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { // Shared libraries may have runtime implementation dependencies // on other shared libraries that are not in the interface. - std::set emitted; + std::set emitted; for(std::vector::const_iterator li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li) { @@ -5891,7 +5891,7 @@ void cmTarget::ComputeLinkImplementationLanguages(LinkImplementation& impl) const { // This target needs runtime libraries for its source languages. - std::set languages; + std::set languages; // Get languages used in our source files. this->GetLanguages(languages); // Get languages used in object library sources. @@ -5908,7 +5908,7 @@ cmTarget::ComputeLinkImplementationLanguages(LinkImplementation& impl) const } } // Copy the set of langauges to the link implementation. - for(std::set::iterator li = languages.begin(); + for(std::set::iterator li = languages.begin(); li != languages.end(); ++li) { impl.Languages.push_back(*li); @@ -6017,8 +6017,8 @@ const char * getLinkInterfaceDependentProperty(cmTarget const* tgt, template void checkPropertyConsistency(cmTarget const* depender, cmTarget const* dependee, - const cmStdString& propName, - std::set &emitted, + const std::string& propName, + std::set &emitted, const char *config, CompatibleType t, PropertyType *) @@ -6062,10 +6062,10 @@ void checkPropertyConsistency(cmTarget const* depender, } } -static cmStdString intersect(const std::set &s1, - const std::set &s2) +static std::string intersect(const std::set &s1, + const std::set &s2) { - std::set intersect; + std::set intersect; std::set_intersection(s1.begin(),s1.end(), s2.begin(),s2.end(), std::inserter(intersect,intersect.begin())); @@ -6075,11 +6075,11 @@ static cmStdString intersect(const std::set &s1, } return ""; } -static cmStdString intersect(const std::set &s1, - const std::set &s2, - const std::set &s3) +static std::string intersect(const std::set &s1, + const std::set &s2, + const std::set &s3) { - cmStdString result; + std::string result; result = intersect(s1, s2); if (!result.empty()) return result; @@ -6088,12 +6088,12 @@ static cmStdString intersect(const std::set &s1, return result; return intersect(s2, s3); } -static cmStdString intersect(const std::set &s1, - const std::set &s2, - const std::set &s3, - const std::set &s4) +static std::string intersect(const std::set &s1, + const std::set &s2, + const std::set &s3, + const std::set &s4) { - cmStdString result; + std::string result; result = intersect(s1, s2); if (!result.empty()) return result; @@ -6112,10 +6112,10 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, { const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); - std::set emittedBools; - std::set emittedStrings; - std::set emittedMinNumbers; - std::set emittedMaxNumbers; + std::set emittedBools; + std::set emittedStrings; + std::set emittedMinNumbers; + std::set emittedMaxNumbers; for(cmComputeLinkInformation::ItemVector::const_iterator li = deps.begin(); @@ -6167,7 +6167,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, if (!prop.empty()) { std::set props; - std::set::const_iterator i = emittedBools.find(prop); + std::set::const_iterator i = emittedBools.find(prop); if (i != emittedBools.end()) { props.insert("COMPATIBLE_INTERFACE_BOOL"); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f73b271..ec74e05 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -148,7 +148,7 @@ public: enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED}; //* how we identify a library, by name and type - typedef std::pair LibraryID; + typedef std::pair LibraryID; typedef std::vector LinkLibraryVectorType; const LinkLibraryVectorType &GetLinkLibraries() const { @@ -216,7 +216,7 @@ public: */ void AddUtility(const std::string& u, cmMakefile *makefile = 0); ///! Get the utilities used by this target - std::setconst& GetUtilities() const { return this->Utilities; } + std::setconst& GetUtilities() const { return this->Utilities; } cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const; /** Finalize the target at the end of the Configure step. */ @@ -455,7 +455,7 @@ public: // when source file properties are changed and we do not have enough // information to forward these property changes to the targets // until we have per-target object file properties. - void GetLanguages(std::set& languages) const; + void GetLanguages(std::set& languages) const; /** Return whether this target is an executable with symbol exports enabled. */ @@ -552,9 +552,9 @@ public: std::string GetDebugGeneratorExpressions(const std::string &value, cmTarget::LinkLibraryType llt) const; - void AddSystemIncludeDirectories(const std::set &incs); + void AddSystemIncludeDirectories(const std::set &incs); void AddSystemIncludeDirectories(const std::vector &incs); - std::set const & GetSystemIncludeDirectories() const + std::set const & GetSystemIncludeDirectories() const { return this->SystemIncludeDirectories; } bool LinkLanguagePropagatesToDependents() const @@ -570,7 +570,7 @@ private: // The set of include directories that are marked as system include // directories. - std::set SystemIncludeDirectories; + std::set SystemIncludeDirectories; std::vector > TLLCommands; @@ -675,13 +675,13 @@ private: LinkLibraryVectorType PrevLinkedLibraries; bool LinkLibrariesAnalyzed; std::vector LinkDirectories; - std::set LinkDirectoriesEmmitted; + std::set LinkDirectoriesEmmitted; bool HaveInstallRule; std::string InstallPath; std::string RuntimeInstallPath; mutable std::string ExportMacro; - std::set Utilities; - std::map UtilityBacktraces; + std::set Utilities; + std::map UtilityBacktraces; bool RecordDependencies; mutable cmPropertyMap Properties; LinkLibraryVectorType OriginalLinkLibraries; @@ -762,9 +762,9 @@ private: const char* version) const; }; -typedef std::map cmTargets; +typedef std::map cmTargets; -class cmTargetSet: public std::set {}; -class cmTargetManifest: public std::map {}; +class cmTargetSet: public std::set {}; +class cmTargetManifest: public std::map {}; #endif diff --git a/Source/cmTest.h b/Source/cmTest.h index a5795c3..b3785f6 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -65,7 +65,7 @@ public: private: cmPropertyMap Properties; - cmStdString Name; + std::string Name; std::vector Command; bool OldStyle; diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h index 790c75a..c86fad0 100644 --- a/Source/cmVariableWatch.h +++ b/Source/cmVariableWatch.h @@ -81,7 +81,7 @@ protected: }; typedef std::vector< Pair* > VectorOfPairs; - typedef std::map StringToVectorOfPairs; + typedef std::map StringToVectorOfPairs; StringToVectorOfPairs WatchMap; }; diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index d1f3d19..8d69254 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -98,7 +98,7 @@ private: private: typedef cmVisualStudioGeneratorOptions Options; - typedef std::map OptionsMap; + typedef std::map OptionsMap; OptionsMap ClOptions; OptionsMap LinkOptions; std::string PathToVcxproj; @@ -113,7 +113,7 @@ private: cmLocalVisualStudio7Generator* LocalGenerator; std::set SourcesVisited; - typedef std::map ToolSourceMap; + typedef std::map ToolSourceMap; ToolSourceMap Tools; }; diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index f48c593..81adb56 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -300,7 +300,7 @@ cmVisualStudioGeneratorOptions { if(this->Version >= cmLocalVisualStudioGenerator::VS10) { - for(std::map::iterator m = this->FlagMap.begin(); + for(std::map::iterator m = this->FlagMap.begin(); m != this->FlagMap.end(); ++m) { fout << indent; @@ -326,7 +326,7 @@ cmVisualStudioGeneratorOptions } else { - for(std::map::iterator m = this->FlagMap.begin(); + for(std::map::iterator m = this->FlagMap.begin(); m != this->FlagMap.end(); ++m) { fout << indent << m->first << "=\"" << m->second << "\"\n"; diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 3b9035f..3302a8d 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -108,7 +108,7 @@ void cmXCodeObject::Print(std::ostream& out) { out << separator; } - std::map::iterator i; + std::map::iterator i; cmXCodeObject::Indent(3*indentFactor, out); out << "isa = " << PBXTypeNames[this->IsA] << ";" << separator; for(i = this->ObjectAttributes.begin(); @@ -138,7 +138,7 @@ void cmXCodeObject::Print(std::ostream& out) } else if(object->TypeValue == ATTRIBUTE_GROUP) { - std::map::iterator j; + std::map::iterator j; out << i->first << " = {" << separator; for(j = object->ObjectAttributes.begin(); j != object->ObjectAttributes.end(); ++j) @@ -236,7 +236,7 @@ void cmXCodeObject::CopyAttributes(cmXCodeObject* copy) } //---------------------------------------------------------------------------- -void cmXCodeObject::PrintString(std::ostream& os,cmStdString String) +void cmXCodeObject::PrintString(std::ostream& os,std::string String) { // The string needs to be quoted if it contains any characters // considered special by the Xcode project file parser. diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index b4623a0..8eaf2aa 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -30,7 +30,7 @@ public: PBXCopyFilesBuildPhase, None }; - class StringVec: public std::vector {}; + class StringVec: public std::vector {}; static const char* PBXTypeNames[]; virtual ~cmXCodeObject(); cmXCodeObject(PBXType ptype, Type type); @@ -131,7 +131,7 @@ public: } this->DependLibraries[configName].push_back(l); } - std::map const& GetDependLibraries() + std::map const& GetDependLibraries() { return this->DependLibraries; } @@ -144,27 +144,27 @@ public: } this->DependTargets[configName].push_back(tName); } - std::map const& GetDependTargets() + std::map const& GetDependTargets() { return this->DependTargets; } std::vector const& GetObjectList() { return this->List;} void SetComment(const char* c) { this->Comment = c;} - static void PrintString(std::ostream& os,cmStdString String); + static void PrintString(std::ostream& os,std::string String); protected: void PrintString(std::ostream& os) const; cmTarget* Target; Type TypeValue; - cmStdString Id; + std::string Id; PBXType IsA; int Version; - cmStdString Comment; - cmStdString String; + std::string Comment; + std::string String; cmXCodeObject* Object; std::vector List; - std::map DependLibraries; - std::map DependTargets; - std::map ObjectAttributes; + std::map DependLibraries; + std::map DependTargets; + std::map ObjectAttributes; }; #endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ad1d0fa..bdba9c2 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2701,7 +2701,7 @@ void cmake::RunCheckForUnusedVariables() bool haveUnused = false; cmOStringStream msg; msg << "Manually-specified variables were not used by the project:"; - for(std::map::const_iterator + for(std::map::const_iterator it = this->UsedCliVariables.begin(); it != this->UsedCliVariables.end(); ++it) { diff --git a/Source/cmake.h b/Source/cmake.h index 2d78e8f..1b81520 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -91,7 +91,7 @@ class cmake */ FIND_PACKAGE_MODE }; - typedef std::map RegisteredCommandsMap; + typedef std::map RegisteredCommandsMap; /// Default constructor cmake(); @@ -364,14 +364,14 @@ protected: void InitializeProperties(); int HandleDeleteCacheVariables(const std::string& var); cmPropertyMap Properties; - std::set > AccessedProperties; + std::set > AccessedProperties; std::map PropertyDefinitions; typedef cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)(); - typedef std::map RegisteredExtraGeneratorsMap; typedef std::vector RegisteredGeneratorsVector; RegisteredCommandsMap Commands; @@ -432,7 +432,7 @@ private: bool WarnUnused; bool WarnUnusedCli; bool CheckSystemVars; - std::map UsedCliVariables; + std::map UsedCliVariables; std::string CMakeEditCommand; std::string CXXEnvironment; std::string CCEnvironment; diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx index faa5fa7..55fc633 100644 --- a/Source/cmcldeps.cxx +++ b/Source/cmcldeps.cxx @@ -198,7 +198,7 @@ static int process( const std::string& srcfilename, std::vector args; cmSystemTools::ParseWindowsCommandLine(cmd.c_str(), args); // convert to correct vector type for RunSingleCommand - std::vector command; + std::vector command; for(std::vector::iterator i = args.begin(); i != args.end(); ++i) { diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 4ac1986..603b6d0 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -677,7 +677,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { std::string flags = args[2]; std::string outFile = args[3]; - std::vector files; + std::vector files; for (std::string::size_type cc = 4; cc < args.size(); cc ++) { files.push_back(args[cc]); @@ -1143,7 +1143,7 @@ int cmcmd::VisualStudioLink(std::vector& args, int type) } int cmcmd::ParseVisualStudioLinkCommand(std::vector& args, - std::vector& command, + std::vector& command, std::string& targetName) { std::vector::iterator i = args.begin(); @@ -1171,14 +1171,14 @@ int cmcmd::ParseVisualStudioLinkCommand(std::vector& args, } bool cmcmd::RunCommand(const char* comment, - std::vector& command, + std::vector& command, bool verbose, int* retCodeOut) { if(verbose) { std::cout << comment << ":\n"; - for(std::vector::iterator i = command.begin(); + for(std::vector::iterator i = command.begin(); i != command.end(); ++i) { std::cout << i->c_str() << " "; @@ -1239,16 +1239,16 @@ int cmcmd::VisualStudioLinkIncremental(std::vector& args, // 7. Finally, the Linker does another incremental link, but since the // only thing that has changed is the *.res file that contains the // manifest it is a short link. - std::vector linkCommand; + std::vector linkCommand; std::string targetName; if(cmcmd::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1) { return -1; } std::string manifestArg = "/MANIFESTFILE:"; - std::vector rcCommand; + std::vector rcCommand; rcCommand.push_back(cmSystemTools::FindProgram("rc.exe")); - std::vector mtCommand; + std::vector mtCommand; mtCommand.push_back(cmSystemTools::FindProgram("mt.exe")); std::string tempManifest; tempManifest = targetName; @@ -1349,7 +1349,7 @@ int cmcmd::VisualStudioLinkNonIncremental(std::vector& args, bool hasManifest, bool verbose) { - std::vector linkCommand; + std::vector linkCommand; std::string targetName; if(cmcmd::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1) { @@ -1368,7 +1368,7 @@ int cmcmd::VisualStudioLinkNonIncremental(std::vector& args, { return 0; } - std::vector mtCommand; + std::vector mtCommand; mtCommand.push_back(cmSystemTools::FindProgram("mt.exe")); mtCommand.push_back("/nologo"); mtCommand.push_back("/manifest"); diff --git a/Source/cmcmd.h b/Source/cmcmd.h index 4517ebf..2bfbae7 100644 --- a/Source/cmcmd.h +++ b/Source/cmcmd.h @@ -43,10 +43,10 @@ protected: bool hasManifest, bool verbose); static int ParseVisualStudioLinkCommand(std::vector& args, - std::vector& command, + std::vector& command, std::string& targetName); static bool RunCommand(const char* comment, - std::vector& command, + std::vector& command, bool verbose, int* retCodeOut = 0); }; diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx index dc1ce24..279bcd5 100644 --- a/Tests/CMakeLib/run_compile_commands.cxx +++ b/Tests/CMakeLib/run_compile_commands.cxx @@ -2,14 +2,14 @@ class CompileCommandParser { public: - class CommandType: public std::map + class CommandType: public std::map { public: - cmStdString const& at(cmStdString const& k) const + std::string const& at(std::string const& k) const { const_iterator i = this->find(k); if(i != this->end()) { return i->second; } - static cmStdString emptyString; + static std::string emptyString; return emptyString; } }; @@ -127,7 +127,7 @@ int main () it = parser.GetTranslationUnits().begin(), end = parser.GetTranslationUnits().end(); it != end; ++it) { - std::vector command; + std::vector command; cmSystemTools::ParseUnixCommandLine(it->at("command").c_str(), command); if (!cmSystemTools::RunSingleCommand( command, 0, 0, it->at("directory").c_str())) -- cgit v0.12 From f0ad6631adb7cd364e2bcf5e8738c697c902e0ad Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:24:15 -0500 Subject: Directories: Take strings when setting directories --- Source/cmake.cxx | 4 ++-- Source/cmake.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index bdba9c2..5ada30e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1069,13 +1069,13 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name) return generator; } -void cmake::SetHomeDirectory(const char* dir) +void cmake::SetHomeDirectory(const std::string& dir) { this->cmHomeDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory); } -void cmake::SetHomeOutputDirectory(const char* lib) +void cmake::SetHomeOutputDirectory(const std::string& lib) { this->HomeOutputDirectory = lib; cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); diff --git a/Source/cmake.h b/Source/cmake.h index 1b81520..933502a 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -110,12 +110,12 @@ class cmake * CMakeLists files by recursing up the tree starting at the StartDirectory * and going up until it reaches the HomeDirectory. */ - void SetHomeDirectory(const char* dir); + void SetHomeDirectory(const std::string& dir); const char* GetHomeDirectory() const { return this->cmHomeDirectory.c_str(); } - void SetHomeOutputDirectory(const char* lib); + void SetHomeOutputDirectory(const std::string& lib); const char* GetHomeOutputDirectory() const { return this->HomeOutputDirectory.c_str(); @@ -130,7 +130,7 @@ class cmake * recursing up the tree starting at the StartDirectory and going up until * it reaches the HomeDirectory. */ - void SetStartDirectory(const char* dir) + void SetStartDirectory(const std::string& dir) { this->cmStartDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); @@ -139,7 +139,7 @@ class cmake { return this->cmStartDirectory.c_str(); } - void SetStartOutputDirectory(const char* lib) + void SetStartOutputDirectory(const std::string& lib) { this->StartOutputDirectory = lib; cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); -- cgit v0.12 From cfc2cf9559eacbf45d04249ee1dd7f75bb0cdff0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 8 Feb 2014 12:01:01 -0500 Subject: cmGeneratorExpression: Tokenize over strings --- Source/cmGeneratorExpression.cxx | 16 ++++++++-------- Source/cmGeneratorExpression.h | 4 ++-- Source/cmGeneratorExpressionLexer.cxx | 6 ++---- Source/cmGeneratorExpressionLexer.h | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 3ebb1b6..433adcf 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -33,17 +33,17 @@ cmGeneratorExpression::cmGeneratorExpression( cmsys::auto_ptr cmGeneratorExpression::Parse(std::string const& input) { - return this->Parse(input.c_str()); + return cmsys::auto_ptr( + new cmCompiledGeneratorExpression( + this->Backtrace, + input)); } //---------------------------------------------------------------------------- cmsys::auto_ptr cmGeneratorExpression::Parse(const char* input) { - return cmsys::auto_ptr( - new cmCompiledGeneratorExpression( - this->Backtrace, - input)); + return this->Parse(std::string(input ? input : "")); } cmGeneratorExpression::~cmGeneratorExpression() @@ -122,13 +122,13 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( cmListFileBacktrace const& backtrace, - const char *input) - : Backtrace(backtrace), Input(input ? input : ""), + const std::string& input) + : Backtrace(backtrace), Input(input), HadContextSensitiveCondition(false) { cmGeneratorExpressionLexer l; std::vector tokens = - l.Tokenize(this->Input.c_str()); + l.Tokenize(this->Input); this->NeedsEvaluation = l.GetSawGeneratorExpression(); if (this->NeedsEvaluation) diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 58abf14..9aa590d 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -100,7 +100,7 @@ public: ~cmCompiledGeneratorExpression(); - std::string GetInput() const + std::string const& GetInput() const { return this->Input; } @@ -116,7 +116,7 @@ public: private: cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, - const char *input); + const std::string& input); friend class cmGeneratorExpression; diff --git a/Source/cmGeneratorExpressionLexer.cxx b/Source/cmGeneratorExpressionLexer.cxx index 117a24e..1c83466 100644 --- a/Source/cmGeneratorExpressionLexer.cxx +++ b/Source/cmGeneratorExpressionLexer.cxx @@ -32,13 +32,11 @@ static void InsertText(const char *upto, const char *c, //---------------------------------------------------------------------------- std::vector -cmGeneratorExpressionLexer::Tokenize(const char *input) +cmGeneratorExpressionLexer::Tokenize(const std::string& input) { std::vector result; - if (!input) - return result; - const char *c = input; + const char *c = input.c_str(); const char *upto = c; for ( ; *c; ++c) diff --git a/Source/cmGeneratorExpressionLexer.h b/Source/cmGeneratorExpressionLexer.h index 83d661d..1e2e8c2 100644 --- a/Source/cmGeneratorExpressionLexer.h +++ b/Source/cmGeneratorExpressionLexer.h @@ -43,7 +43,7 @@ class cmGeneratorExpressionLexer public: cmGeneratorExpressionLexer(); - std::vector Tokenize(const char *input); + std::vector Tokenize(const std::string& input); bool GetSawGeneratorExpression() const { -- cgit v0.12 From f154475b65738444414312d7d5a255f3220d90c6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Sat, 8 Mar 2014 07:55:46 -0500 Subject: cmTarget: Refactor GetLocation API When given a non-NULL configuration the GetLocation returned the location for the given configuration. When given a NULL configuration the GetLocation method returned a location with the build-system placeholder for the configuration name. Split the latter use case out into a separate GetLocationForBuild method and update call sites accordingly. --- Source/cmGeneratorTarget.cxx | 2 +- Source/cmGlobalKdevelopGenerator.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 12 ++++++------ Source/cmTarget.cxx | 25 +++++++++---------------- Source/cmTarget.h | 11 ++++++----- 5 files changed, 23 insertions(+), 29 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index a7b2efa..f7f6feb 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -742,7 +742,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep) { // This is really only for compatibility so we do not need to // worry about configuration names and output names. - std::string tLocation = t->GetLocation(0); + std::string tLocation = t->GetLocationForBuild(); tLocation = cmSystemTools::GetFilenamePath(tLocation); std::string depLocation = cmSystemTools::GetFilenamePath(dep); depLocation = cmSystemTools::CollapseFullPath(depLocation.c_str()); diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 25df953..2d485f6 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -76,7 +76,7 @@ void cmGlobalKdevelopGenerator::Generate() { if (ti->second.GetType()==cmTarget::EXECUTABLE) { - executable = ti->second.GetLocation(0); + executable = ti->second.GetLocation(""); break; } } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 17b2424..fbb3b1c 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -610,7 +610,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, autogenTargetName.c_str()); return; } - makefile->AddDefinition("_qt_moc_executable", qt5Moc->GetLocation(0)); + makefile->AddDefinition("_qt_moc_executable", qt5Moc->GetLocation("")); } else if (strcmp(qtVersion, "4") == 0) { @@ -621,7 +621,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, autogenTargetName.c_str()); return; } - makefile->AddDefinition("_qt_moc_executable", qt4Moc->GetLocation(0)); + makefile->AddDefinition("_qt_moc_executable", qt4Moc->GetLocation("")); } else { @@ -782,7 +782,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, } else { - makefile->AddDefinition("_qt_uic_executable", qt5Uic->GetLocation(0)); + makefile->AddDefinition("_qt_uic_executable", qt5Uic->GetLocation("")); } } else if (strcmp(qtVersion, "4") == 0) @@ -794,7 +794,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, targetName.c_str()); return; } - makefile->AddDefinition("_qt_uic_executable", qt4Uic->GetLocation(0)); + makefile->AddDefinition("_qt_uic_executable", qt4Uic->GetLocation("")); } else { @@ -931,7 +931,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) targetName.c_str()); return; } - makefile->AddDefinition("_qt_rcc_executable", qt5Rcc->GetLocation(0)); + makefile->AddDefinition("_qt_rcc_executable", qt5Rcc->GetLocation("")); } else if (strcmp(qtVersion, "4") == 0) { @@ -942,7 +942,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) targetName.c_str()); return; } - makefile->AddDefinition("_qt_rcc_executable", qt4Rcc->GetLocation(0)); + makefile->AddDefinition("_qt_rcc_executable", qt4Rcc->GetLocation("")); } else { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 99f2c1f..3273437 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2458,32 +2458,25 @@ std::string cmTarget::GetCompilePDBDirectory(const char* config) const //---------------------------------------------------------------------------- const char* cmTarget::GetLocation(const char* config) const { + static std::string location; if (this->IsImported()) { - return this->ImportedGetLocation(config); + location = this->ImportedGetFullPath(config, false); } else { - return this->NormalGetLocation(config); + location = this->GetFullPath(config, false); } -} - -//---------------------------------------------------------------------------- -const char* cmTarget::ImportedGetLocation(const char* config) const -{ - static std::string location; - location = this->ImportedGetFullPath(config, false); return location.c_str(); } //---------------------------------------------------------------------------- -const char* cmTarget::NormalGetLocation(const char* config) const +const char* cmTarget::GetLocationForBuild() const { static std::string location; - // Handle the configuration-specific case first. - if(config) + if(this->IsImported()) { - location = this->GetFullPath(config, false); + location = this->ImportedGetFullPath("", false); return location.c_str(); } @@ -2503,7 +2496,7 @@ const char* cmTarget::NormalGetLocation(const char* config) const if(this->IsAppBundleOnApple()) { - std::string macdir = this->BuildMacContentDirectory("", config, false); + std::string macdir = this->BuildMacContentDirectory("", "", false); if(!macdir.empty()) { location += "/"; @@ -2511,7 +2504,7 @@ const char* cmTarget::NormalGetLocation(const char* config) const } } location += "/"; - location += this->GetFullName(config, false); + location += this->GetFullName("", false); return location.c_str(); } @@ -2659,7 +2652,7 @@ const char *cmTarget::GetProperty(const std::string& prop, // cannot take into account the per-configuration name of the // target because the configuration type may not be known at // CMake time. - this->Properties.SetProperty("LOCATION", this->GetLocation(0), + this->Properties.SetProperty("LOCATION", this->GetLocationForBuild(), cmProperty::TARGET); } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index ec74e05..41f84a6 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -331,10 +331,14 @@ public: std::string GetCompilePDBDirectory(const char* config = 0) const; /** Get the location of the target in the build tree for the given - configuration. This location is suitable for use as the LOCATION - target property. */ + configuration. */ const char* GetLocation(const char* config) const; + /** Get the location of the target in the build tree with a placeholder + referencing the configuration in the native build system. This + location is suitable for use as the LOCATION target property. */ + const char* GetLocationForBuild() const; + /** Get the target major and minor version numbers interpreted from the VERSION property. Version 0 is returned if the property is not set or cannot be parsed. */ @@ -643,9 +647,6 @@ private: // Get the target base name. std::string GetOutputName(const char* config, bool implib) const; - const char* ImportedGetLocation(const char* config) const; - const char* NormalGetLocation(const char* config) const; - std::string GetFullNameImported(const char* config, bool implib) const; std::string ImportedGetFullPath(const char* config, bool implib) const; -- cgit v0.12 From 84fdc9921cab35addba8c57cd201778de2cf87a4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 9 Feb 2014 22:48:34 -0500 Subject: stringapi: Pass configuration names as strings --- Source/CPack/cmCPackGenerator.cxx | 7 +- Source/cmComputeLinkDepends.cxx | 7 +- Source/cmComputeLinkDepends.h | 5 +- Source/cmComputeLinkInformation.cxx | 7 +- Source/cmComputeLinkInformation.h | 4 +- Source/cmComputeTargetDepends.cxx | 6 +- Source/cmComputeTargetDepends.h | 2 +- Source/cmCoreTryCompile.cxx | 2 +- Source/cmCustomCommandGenerator.cxx | 2 +- Source/cmCustomCommandGenerator.h | 5 +- Source/cmExportBuildFileGenerator.cxx | 8 +- Source/cmExportBuildFileGenerator.h | 4 +- Source/cmExportFileGenerator.cxx | 25 +-- Source/cmExportFileGenerator.h | 16 +- Source/cmExportInstallFileGenerator.cxx | 11 +- Source/cmExportInstallFileGenerator.h | 6 +- Source/cmExportTryCompileFileGenerator.h | 6 +- Source/cmExtraSublimeTextGenerator.cxx | 4 +- Source/cmGeneratorExpression.cxx | 4 +- Source/cmGeneratorExpression.h | 4 +- Source/cmGeneratorExpressionEvaluationFile.cxx | 4 +- Source/cmGeneratorExpressionEvaluationFile.h | 2 +- Source/cmGeneratorExpressionEvaluator.cxx | 6 +- Source/cmGeneratorExpressionEvaluator.h | 2 +- Source/cmGeneratorTarget.cxx | 30 +-- Source/cmGeneratorTarget.h | 10 +- Source/cmGlobalGenerator.cxx | 17 +- Source/cmGlobalGenerator.h | 10 +- Source/cmGlobalNinjaGenerator.cxx | 6 +- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 4 +- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 8 +- Source/cmGlobalVisualStudio6Generator.h | 4 +- Source/cmGlobalVisualStudio7Generator.cxx | 8 +- Source/cmGlobalVisualStudio7Generator.h | 4 +- Source/cmGlobalXCodeGenerator.cxx | 27 +-- Source/cmGlobalXCodeGenerator.h | 11 +- Source/cmInstallExportGenerator.cxx | 2 +- Source/cmInstallFilesGenerator.cxx | 4 +- Source/cmInstallFilesGenerator.h | 2 +- Source/cmInstallGenerator.cxx | 2 +- Source/cmInstallGenerator.h | 2 +- Source/cmInstallTargetGenerator.cxx | 29 +-- Source/cmInstallTargetGenerator.h | 25 ++- Source/cmLocalGenerator.cxx | 38 ++-- Source/cmLocalGenerator.h | 20 +- Source/cmLocalVisualStudio6Generator.cxx | 16 +- Source/cmLocalVisualStudio6Generator.h | 9 +- Source/cmLocalVisualStudio7Generator.cxx | 16 +- Source/cmLocalVisualStudio7Generator.h | 8 +- Source/cmLocalVisualStudioGenerator.cxx | 4 +- Source/cmLocalVisualStudioGenerator.h | 5 +- Source/cmLocalXCodeGenerator.cxx | 4 +- Source/cmMakefile.cxx | 13 +- Source/cmMakefile.h | 4 +- Source/cmMakefileTargetGenerator.cxx | 15 +- Source/cmMakefileTargetGenerator.h | 2 +- Source/cmOSXBundleGenerator.cxx | 2 +- Source/cmOSXBundleGenerator.h | 4 +- Source/cmQtAutoGenerators.cxx | 21 +- Source/cmQtAutoGenerators.h | 4 +- Source/cmScriptGenerator.cxx | 21 +- Source/cmScriptGenerator.h | 10 +- Source/cmTarget.cxx | 277 +++++++++++++------------ Source/cmTarget.h | 147 +++++++------ Source/cmTestGenerator.cxx | 2 +- Source/cmTestGenerator.h | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.h | 2 +- Source/cmXCodeObject.h | 12 +- Source/cmcmd.cxx | 2 +- 74 files changed, 539 insertions(+), 485 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index bed3891..4c52c96 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -623,7 +623,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( componentsVector.push_back(installComponent); } - const char* buildConfig = this->GetOption("CPACK_BUILD_CONFIG"); + const char* buildConfigCstr = this->GetOption("CPACK_BUILD_CONFIG"); + std::string buildConfig = buildConfigCstr ? buildConfigCstr : ""; cmGlobalGenerator* globalGenerator = this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator( cmakeGenerator); @@ -822,9 +823,9 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( << "'" << std::endl); } - if ( buildConfig && *buildConfig ) + if (!buildConfig.empty()) { - mf->AddDefinition("BUILD_TYPE", buildConfig); + mf->AddDefinition("BUILD_TYPE", buildConfig.c_str()); } std::string installComponentLowerCase = cmSystemTools::LowerCase(installComponent); diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 6c1c1de..2d1da55 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -172,7 +172,7 @@ satisfy dependencies. //---------------------------------------------------------------------------- cmComputeLinkDepends -::cmComputeLinkDepends(cmTarget const* target, const char* config, +::cmComputeLinkDepends(cmTarget const* target, const std::string& config, cmTarget const* head) { // Store context information. @@ -184,7 +184,8 @@ cmComputeLinkDepends this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); // The configuration being linked. - this->Config = (config && *config)? config : 0; + this->HasConfig = !config.empty(); + this->Config = (this->HasConfig)? config : std::string(); this->LinkType = this->Target->ComputeLinkType(this->Config); // Enable debug mode if requested. @@ -255,7 +256,7 @@ cmComputeLinkDepends::Compute() "---------------------------------------\n"); fprintf(stderr, "Link dependency analysis for target %s, config %s\n", this->Target->GetName().c_str(), - this->Config?this->Config:"noconfig"); + this->HasConfig?this->Config.c_str():"noconfig"); this->DisplayConstraintGraph(); } diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index ac5e368..13fc993 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -32,7 +32,7 @@ class cmake; class cmComputeLinkDepends { public: - cmComputeLinkDepends(cmTarget const* target, const char* config, + cmComputeLinkDepends(cmTarget const* target, const std::string& config, cmTarget const* head); ~cmComputeLinkDepends(); @@ -68,7 +68,8 @@ private: bool DebugMode; // Configuration information. - const char* Config; + bool HasConfig; + std::string Config; cmTarget::LinkLibraryType LinkType; // Output information. diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 32b23b8..e4e2047 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -239,7 +239,7 @@ because this need be done only for shared libraries without soname-s. //---------------------------------------------------------------------------- cmComputeLinkInformation -::cmComputeLinkInformation(cmTarget const* target, const char* config, +::cmComputeLinkInformation(cmTarget const* target, const std::string& config, cmTarget const* headTarget) { // Store context information. @@ -505,7 +505,8 @@ bool cmComputeLinkInformation::Compute() } // Compute the ordered link line items. - cmComputeLinkDepends cld(this->Target, this->Config, this->HeadTarget); + cmComputeLinkDepends cld(this->Target, this->Config.c_str(), + this->HeadTarget); cld.SetOldLinkDirMode(this->OldLinkDirMode); cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute(); @@ -624,7 +625,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget const* tgt) { // Compute the proper name to use to link this library. - const char* config = this->Config; + const std::string& config = this->Config; bool impexe = (tgt && tgt->IsExecutableWithExports()); if(impexe && !this->UseImportLibrary && !this->LoaderFlag) { diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index b5a8bec..e345fe2 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -29,7 +29,7 @@ class cmOrderDirectories; class cmComputeLinkInformation { public: - cmComputeLinkInformation(cmTarget const* target, const char* config, + cmComputeLinkInformation(cmTarget const* target, const std::string& config, cmTarget const* headTarget); ~cmComputeLinkInformation(); bool Compute(); @@ -82,7 +82,7 @@ private: cmake* CMakeInstance; // Configuration information. - const char* Config; + std::string Config; std::string LinkLanguage; bool LinkDependsNoShared; diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 405643e..10041db 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -214,7 +214,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) std::set emitted; { std::vector tlibs; - depender->GetDirectLinkLibraries(0, tlibs, depender); + depender->GetDirectLinkLibraries("", tlibs, depender); // A target should not depend on itself. emitted.insert(depender->GetName()); for(std::vector::const_iterator lib = tlibs.begin(); @@ -274,7 +274,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, cmTarget const* dependee, - const char *config, + const std::string& config, std::set &emitted) { cmTarget const* depender = this->Targets[depender_index]; @@ -317,7 +317,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, if(dependee) { - this->AddInterfaceDepends(depender_index, dependee, 0, emitted); + this->AddInterfaceDepends(depender_index, dependee, "", emitted); std::vector configs; depender->GetMakefile()->GetConfigurations(configs); for (std::vector::const_iterator it = configs.begin(); diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index db76a18..7553816 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -55,7 +55,7 @@ private: const std::string& dependee_name, bool linking, std::set &emitted); void AddInterfaceDepends(int depender_index, cmTarget const* dependee, - const char *config, + const std::string& config, std::set &emitted); cmGlobalGenerator* GlobalGenerator; bool DebugMode; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index ea3e814..ab7b024 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -357,7 +357,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) cmExportTryCompileFileGenerator tcfg; tcfg.SetExportFile((this->BinaryDirectory + fname).c_str()); tcfg.SetExports(targets); - tcfg.SetConfig(this->Makefile->GetDefinition( + tcfg.SetConfig(this->Makefile->GetSafeDefinition( "CMAKE_TRY_COMPILE_CONFIGURATION")); if(!tcfg.GenerateImportFile()) diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index f24dfa2..d8a756d 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -18,7 +18,7 @@ //---------------------------------------------------------------------------- cmCustomCommandGenerator::cmCustomCommandGenerator( - cmCustomCommand const& cc, const char* config, cmMakefile* mf): + cmCustomCommand const& cc, const std::string& config, cmMakefile* mf): CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), GE(new cmGeneratorExpression(cc.GetBacktrace())) diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index 4e89f27..17d644a 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -22,14 +22,15 @@ class cmGeneratorExpression; class cmCustomCommandGenerator { cmCustomCommand const& CC; - const char* Config; + std::string Config; cmMakefile* Makefile; cmLocalGenerator* LG; bool OldStyle; bool MakeVars; cmGeneratorExpression* GE; public: - cmCustomCommandGenerator(cmCustomCommand const& cc, const char* config, + cmCustomCommandGenerator(cmCustomCommand const& cc, + const std::string& config, cmMakefile* mf); ~cmCustomCommandGenerator(); unsigned int GetNumberOfCommands() const; diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 308956a..f991f45 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -118,8 +118,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) void cmExportBuildFileGenerator ::GenerateImportTargetsConfig(std::ostream& os, - const char* config, std::string const& suffix, - std::vector &missingTargets) + const std::string& config, + std::string const& suffix, + std::vector &missingTargets) { for(std::vector::const_iterator tei = this->Exports.begin(); @@ -166,7 +167,8 @@ void cmExportBuildFileGenerator::SetExportSet(cmExportSet *exportSet) //---------------------------------------------------------------------------- void cmExportBuildFileGenerator -::SetImportLocationProperty(const char* config, std::string const& suffix, +::SetImportLocationProperty(const std::string& config, + std::string const& suffix, cmTarget* target, ImportPropertyMap& properties) { // Get the makefile in which to lookup target information. diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index cea2099..c1bdb5b 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -52,7 +52,7 @@ protected: // Implement virtual methods from the superclass. virtual bool GenerateMainFile(std::ostream& os); virtual void GenerateImportTargetsConfig(std::ostream& os, - const char* config, + const std::string& config, std::string const& suffix, std::vector &missingTargets); virtual void HandleMissingTarget(std::string& link_libs, @@ -66,7 +66,7 @@ protected: int occurrences); /** Fill in properties indicating built file locations. */ - void SetImportLocationProperty(const char* config, + void SetImportLocationProperty(const std::string& config, std::string const& suffix, cmTarget* target, ImportPropertyMap& properties); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index c06f889..3c3c6df 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -35,7 +35,7 @@ cmExportFileGenerator::cmExportFileGenerator() } //---------------------------------------------------------------------------- -void cmExportFileGenerator::AddConfiguration(const char* config) +void cmExportFileGenerator::AddConfiguration(const std::string& config) { this->Configurations.push_back(config); } @@ -117,12 +117,12 @@ bool cmExportFileGenerator::GenerateImportFile() //---------------------------------------------------------------------------- void cmExportFileGenerator::GenerateImportConfig(std::ostream& os, - const char* config, + const std::string& config, std::vector &missingTargets) { // Construct the property configuration suffix. std::string suffix = "_"; - if(config && *config) + if(!config.empty()) { suffix += cmSystemTools::UpperCase(config); } @@ -345,7 +345,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( true); this->ReplaceInstallPrefix(dirs); cmsys::auto_ptr cge = ge.Parse(dirs); - std::string exportDirs = cge->Evaluate(target->GetMakefile(), 0, + std::string exportDirs = cge->Evaluate(target->GetMakefile(), "", false, target); if (cge->GetHadContextSensitiveCondition()) @@ -426,7 +426,7 @@ void getPropertyContents(cmTarget const* tgt, const std::string& prop, //---------------------------------------------------------------------------- void getCompatibleInterfaceProperties(cmTarget *target, std::set &ifaceProperties, - const char *config) + const std::string& config) { cmComputeLinkInformation *info = target->GetLinkInformation(config); @@ -490,7 +490,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( if (target->GetType() != cmTarget::INTERFACE_LIBRARY) { - getCompatibleInterfaceProperties(target, ifaceProperties, 0); + getCompatibleInterfaceProperties(target, ifaceProperties, ""); std::vector configNames; target->GetMakefile()->GetConfigurations(configNames); @@ -687,7 +687,7 @@ cmExportFileGenerator::ReplaceInstallPrefix(std::string &) //---------------------------------------------------------------------------- void cmExportFileGenerator -::SetImportLinkInterface(const char* config, std::string const& suffix, +::SetImportLinkInterface(const std::string& config, std::string const& suffix, cmGeneratorExpression::PreprocessContext preprocessRule, cmTarget* target, ImportPropertyMap& properties, std::vector& missingTargets) @@ -762,7 +762,8 @@ cmExportFileGenerator //---------------------------------------------------------------------------- void cmExportFileGenerator -::SetImportDetailProperties(const char* config, std::string const& suffix, +::SetImportDetailProperties(const std::string& config, + std::string const& suffix, cmTarget* target, ImportPropertyMap& properties, std::vector& missingTargets ) @@ -864,11 +865,11 @@ cmExportFileGenerator //---------------------------------------------------------------------------- void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os, - const char* config) + const std::string& config) { os << "#----------------------------------------------------------------\n" << "# Generated CMake target import file"; - if(config) + if(!config.empty()) { os << " for configuration \"" << config << "\".\n"; } @@ -999,7 +1000,7 @@ cmExportFileGenerator //---------------------------------------------------------------------------- void cmExportFileGenerator -::GenerateImportPropertyCode(std::ostream& os, const char* config, +::GenerateImportPropertyCode(std::ostream& os, const std::string& config, cmTarget const* target, ImportPropertyMap const& properties) { @@ -1013,7 +1014,7 @@ cmExportFileGenerator << config << "\"\n"; os << "set_property(TARGET " << targetName << " APPEND PROPERTY IMPORTED_CONFIGURATIONS "; - if(config && *config) + if(!config.empty()) { os << cmSystemTools::UpperCase(config); } diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 9e3ce0b..cf91c69 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -56,7 +56,7 @@ public: void SetExportOld(bool exportOld) { this->ExportOld = exportOld; } /** Add a configuration to be exported. */ - void AddConfiguration(const char* config); + void AddConfiguration(const std::string& config); /** Actually generate the export file. Returns whether there was an error. */ @@ -67,15 +67,16 @@ protected: // Generate per-configuration target information to the given output // stream. - void GenerateImportConfig(std::ostream& os, const char* config, + void GenerateImportConfig(std::ostream& os, const std::string& config, std::vector &missingTargets); // Methods to implement export file code generation. - void GenerateImportHeaderCode(std::ostream& os, const char* config = 0); + void GenerateImportHeaderCode(std::ostream& os, + const std::string& config = ""); void GenerateImportFooterCode(std::ostream& os); void GenerateImportVersionCode(std::ostream& os); void GenerateImportTargetCode(std::ostream& os, cmTarget const* target); - void GenerateImportPropertyCode(std::ostream& os, const char* config, + void GenerateImportPropertyCode(std::ostream& os, const std::string& config, cmTarget const* target, ImportPropertyMap const& properties); void GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target, @@ -90,7 +91,7 @@ protected: // Collect properties with detailed information about targets beyond // their location on disk. - void SetImportDetailProperties(const char* config, + void SetImportDetailProperties(const std::string& config, std::string const& suffix, cmTarget* target, ImportPropertyMap& properties, std::vector& missingTargets); @@ -105,7 +106,7 @@ protected: /** Each subclass knows where the target files are located. */ virtual void GenerateImportTargetsConfig(std::ostream& os, - const char* config, + const std::string& config, std::string const& suffix, std::vector &missingTargets) = 0; @@ -137,7 +138,8 @@ protected: ImportPropertyMap &properties, std::vector &missingTargets); - void SetImportLinkInterface(const char* config, std::string const& suffix, + void SetImportLinkInterface(const std::string& config, + std::string const& suffix, cmGeneratorExpression::PreprocessContext preprocessRule, cmTarget* target, ImportPropertyMap& properties, std::vector& missingTargets); diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index b579963..5e7d5e4 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -240,7 +240,8 @@ cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string &input) //---------------------------------------------------------------------------- bool -cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config, +cmExportInstallFileGenerator::GenerateImportFileConfig( + const std::string& config, std::vector &missingTargets) { // Skip configurations not enabled for this export. @@ -254,7 +255,7 @@ cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config, fileName += "/"; fileName += this->FileBase; fileName += "-"; - if(config && *config) + if(!config.empty()) { fileName += cmSystemTools::LowerCase(config); } @@ -296,7 +297,8 @@ cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config, void cmExportInstallFileGenerator ::GenerateImportTargetsConfig(std::ostream& os, - const char* config, std::string const& suffix, + const std::string& config, + std::string const& suffix, std::vector &missingTargets) { // Add each target in the set to the export. @@ -355,7 +357,8 @@ cmExportInstallFileGenerator //---------------------------------------------------------------------------- void cmExportInstallFileGenerator -::SetImportLocationProperty(const char* config, std::string const& suffix, +::SetImportLocationProperty(const std::string& config, + std::string const& suffix, cmInstallTargetGenerator* itgen, ImportPropertyMap& properties, std::set& importedLocations diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index 5ee2a78..b851ad5 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -52,7 +52,7 @@ protected: // Implement virtual methods from the superclass. virtual bool GenerateMainFile(std::ostream& os); virtual void GenerateImportTargetsConfig(std::ostream& os, - const char* config, + const std::string& config, std::string const& suffix, std::vector &missingTargets); virtual void HandleMissingTarget(std::string& link_libs, @@ -72,11 +72,11 @@ protected: /** Generate a per-configuration file for the targets. */ - bool GenerateImportFileConfig(const char* config, + bool GenerateImportFileConfig(const std::string& config, std::vector &missingTargets); /** Fill in properties indicating installed file locations. */ - void SetImportLocationProperty(const char* config, + void SetImportLocationProperty(const std::string& config, std::string const& suffix, cmInstallTargetGenerator* itgen, ImportPropertyMap& properties, diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h index a16fe6b..ec70d81 100644 --- a/Source/cmExportTryCompileFileGenerator.h +++ b/Source/cmExportTryCompileFileGenerator.h @@ -23,14 +23,14 @@ public: /** Set the list of targets to export. */ void SetExports(const std::vector &exports) { this->Exports = exports; } - void SetConfig(const char *config) { this->Config = config; } + void SetConfig(const std::string& config) { this->Config = config; } protected: // Implement virtual methods from the superclass. virtual bool GenerateMainFile(std::ostream& os); virtual void GenerateImportTargetsConfig(std::ostream&, - const char*, + const std::string&, std::string const&, std::vector&) {} virtual void HandleMissingTarget(std::string&, @@ -51,7 +51,7 @@ private: std::vector Exports; - const char *Config; + std::string Config; }; #endif diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 9c2849c..03c7c92 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -375,7 +375,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source, { language = "C"; } - const char* config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); // Add language-specific flags. lg->AddLanguageFlags(flags, language, config); @@ -425,7 +425,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, std::set defines; cmMakefile *makefile = lg->GetMakefile(); const std::string& language = source->GetLanguage(); - const char* config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); // Add the export symbol definition for shared library objects. if(const char* exportMacro = target->GetExportMacro()) diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 433adcf..e4187d2 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -52,7 +52,7 @@ cmGeneratorExpression::~cmGeneratorExpression() //---------------------------------------------------------------------------- const char *cmCompiledGeneratorExpression::Evaluate( - cmMakefile* mf, const char* config, bool quiet, + cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, cmGeneratorExpressionDAGChecker *dagChecker) const { @@ -66,7 +66,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( //---------------------------------------------------------------------------- const char *cmCompiledGeneratorExpression::Evaluate( - cmMakefile* mf, const char* config, bool quiet, + cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, cmTarget const* currentTarget, cmGeneratorExpressionDAGChecker *dagChecker) const diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 9aa590d..5b97e8b 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -78,12 +78,12 @@ private: class cmCompiledGeneratorExpression { public: - const char* Evaluate(cmMakefile* mf, const char* config, + const char* Evaluate(cmMakefile* mf, const std::string& config, bool quiet = false, cmTarget const* headTarget = 0, cmTarget const* currentTarget = 0, cmGeneratorExpressionDAGChecker *dagChecker = 0) const; - const char* Evaluate(cmMakefile* mf, const char* config, + const char* Evaluate(cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, cmGeneratorExpressionDAGChecker *dagChecker) const; diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index bf85870..90ce27c 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -33,7 +33,7 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( } //---------------------------------------------------------------------------- -void cmGeneratorExpressionEvaluationFile::Generate(const char *config, +void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles) { @@ -135,7 +135,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() if (allConfigs.empty()) { - this->Generate(0, inputExpression.get(), outputFiles); + this->Generate("", inputExpression.get(), outputFiles); } else { diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 20ee5cb..f939916 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -32,7 +32,7 @@ public: std::vector GetFiles() const { return this->Files; } private: - void Generate(const char *config, + void Generate(const std::string& config, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles); diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index d12a66d..43c1794 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -689,7 +689,7 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode cmGeneratorExpressionDAGChecker *) const { context->HadContextSensitiveCondition = true; - return context->Config ? context->Config : ""; + return context->Config; } } configurationNode; @@ -718,13 +718,13 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode return std::string(); } context->HadContextSensitiveCondition = true; - if (!context->Config) + if (context->Config.empty()) { return parameters.front().empty() ? "1" : "0"; } if (cmsysString_strcasecmp(parameters.begin()->c_str(), - context->Config) == 0) + context->Config.c_str()) == 0) { return "1"; } diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 0c8a9cf..a7099cb 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -27,7 +27,7 @@ struct cmGeneratorExpressionContext std::set AllTargets; std::set SeenTargetProperties; cmMakefile *Makefile; - const char *Config; + std::string Config; cmTarget const* HeadTarget; // The target whose property is being evaluated. cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears // directly or indirectly in the property. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index f7f6feb..eb67f91 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -252,7 +252,8 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const } static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt, - const char *config, cmTarget *headTarget, + const std::string& config, + cmTarget *headTarget, cmGeneratorExpressionDAGChecker *dagChecker, std::vector& result, bool excludeImported) @@ -390,12 +391,12 @@ void cmGeneratorTarget::GetResxSources(std::vector& srcs) const } //---------------------------------------------------------------------------- -bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, - const char *config) const +bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, + const std::string& config) const { assert(this->GetType() != cmTarget::INTERFACE_LIBRARY); std::string config_upper; - if(config && *config) + if(!config.empty()) { config_upper = cmSystemTools::UpperCase(config); } @@ -802,7 +803,7 @@ cmTargetTraceDependencies { const cmsys::auto_ptr cge = ge.Parse(*cli); - cge->Evaluate(this->Makefile, 0, true); + cge->Evaluate(this->Makefile, "", true); std::set geTargets = cge->GetTargets(); for(std::set::const_iterator it = geTargets.begin(); it != geTargets.end(); ++it) @@ -863,11 +864,11 @@ void cmGeneratorTarget::TraceDependencies() } //---------------------------------------------------------------------------- -void cmGeneratorTarget::GetAppleArchs(const char* config, +void cmGeneratorTarget::GetAppleArchs(const std::string& config, std::vector& archVec) const { const char* archs = 0; - if(config && *config) + if(!config.empty()) { std::string defVarName = "OSX_ARCHITECTURES_"; defVarName += cmSystemTools::UpperCase(config); @@ -904,13 +905,14 @@ const char* cmGeneratorTarget::GetCreateRuleVariable() const //---------------------------------------------------------------------------- std::vector -cmGeneratorTarget::GetIncludeDirectories(const char *config) const +cmGeneratorTarget::GetIncludeDirectories(const std::string& config) const { return this->Target->GetIncludeDirectories(config); } //---------------------------------------------------------------------------- -void cmGeneratorTarget::GenerateTargetManifest(const char* config) const +void cmGeneratorTarget::GenerateTargetManifest( + const std::string& config) const { if (this->Target->IsImported()) { @@ -953,35 +955,35 @@ void cmGeneratorTarget::GenerateTargetManifest(const char* config) const f = dir; f += "/"; f += name; - gg->AddToManifest(config? config:"", f); + gg->AddToManifest(config, f); } if(!soName.empty()) { f = dir; f += "/"; f += soName; - gg->AddToManifest(config? config:"", f); + gg->AddToManifest(config, f); } if(!realName.empty()) { f = dir; f += "/"; f += realName; - gg->AddToManifest(config? config:"", f); + gg->AddToManifest(config, f); } if(!pdbName.empty()) { f = dir; f += "/"; f += pdbName; - gg->AddToManifest(config? config:"", f); + gg->AddToManifest(config, f); } if(!impName.empty()) { f = this->Target->GetDirectory(config, true); f += "/"; f += impName; - gg->AddToManifest(config? config:"", f); + gg->AddToManifest(config, f); } } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index b15bade..81a447f 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -61,7 +61,7 @@ public: void UseObjectLibraries(std::vector& objs) const; - void GetAppleArchs(const char* config, + void GetAppleArchs(const std::string& config, std::vector& archVec) const; ///! Return the rule variable used to create this type of target, @@ -69,12 +69,14 @@ public: const char* GetCreateRuleVariable() const; /** Get the include directories for this target. */ - std::vector GetIncludeDirectories(const char *config) const; + std::vector GetIncludeDirectories( + const std::string& config) const; - bool IsSystemIncludeDirectory(const char *dir, const char *config) const; + bool IsSystemIncludeDirectory(const std::string& dir, + const std::string& config) const; /** Add the target output files to the global generator manifest. */ - void GenerateTargetManifest(const char* config) const; + void GenerateTargetManifest(const std::string& config) const; /** * Trace through the source files in this target and add al source files diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 9748c61..70cc16f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1655,7 +1655,8 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, #endif // WIN32 #endif } - const char* config = mf->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"); + std::string config = + mf->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"); return this->Build(srcdir,bindir,projectName, newTarget.c_str(), output,0,config,false,fast, @@ -1664,7 +1665,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, void cmGlobalGenerator::GenerateBuildCommand( std::vector& makeCommand, const char*, const std::string&, - const char*, const std::string&, const char*, bool, + const char*, const std::string&, const std::string&, bool, std::vector const&) { makeCommand.push_back( @@ -1676,7 +1677,7 @@ int cmGlobalGenerator::Build( const std::string& projectName, const std::string& target, std::string *output, const char *makeCommandCSTR, - const char *config, + const std::string& config, bool clean, bool fast, double timeout, cmSystemTools::OutputOption outputflag, @@ -1788,13 +1789,14 @@ int cmGlobalGenerator::Build( //---------------------------------------------------------------------------- std::string cmGlobalGenerator::GenerateCMakeBuildCommand( - const std::string& target, const char* config, const char* native, + const std::string& target, const std::string& config, + const char* native, bool ignoreErrors) { std::string makeCommand = cmSystemTools::GetCMakeCommand(); makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str()); makeCommand += " --build ."; - if(config && *config) + if(!config.empty()) { makeCommand += " --config \""; makeCommand += config; @@ -2526,7 +2528,8 @@ std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage( } //---------------------------------------------------------------------------- -void cmGlobalGenerator::AppendDirectoryForConfig(const char*, const char*, +void cmGlobalGenerator::AppendDirectoryForConfig(const char*, + const std::string&, const char*, std::string&) { // Subclasses that support multiple configurations should implement @@ -2677,7 +2680,7 @@ void cmGlobalGenerator::AddTargetDepends(cmTarget const* target, //---------------------------------------------------------------------------- -void cmGlobalGenerator::AddToManifest(const char* config, +void cmGlobalGenerator::AddToManifest(const std::string& config, std::string const& f) { // Add to the main manifest for this configuration. diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index f06162c..e9a1b47 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -120,7 +120,7 @@ public: int Build(const char *srcdir, const char *bindir, const std::string& projectName, const std::string& targetName, std::string *output, - const char *makeProgram, const char *config, + const char *makeProgram, const std::string& config, bool clean, bool fast, double timeout, cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE, @@ -131,13 +131,13 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, const char *projectDir, - const std::string& targetName, const char* config, bool fast, + const std::string& targetName, const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); /** Generate a "cmake --build" call for a given target and config. */ std::string GenerateCMakeBuildCommand(const std::string& target, - const char* config, + const std::string& config, const char* native, bool ignoreErrors); @@ -173,7 +173,7 @@ public: cmExportSetMap& GetExportSets() {return this->ExportSets;} /** Add a file to the manifest of generated targets for a configuration. */ - void AddToManifest(const char* config, std::string const& f); + void AddToManifest(const std::string& config, std::string const& f); void EnableInstallTarget(); @@ -231,7 +231,7 @@ public: appended the given prefix and suffix will be appended around it, which is useful for leading or trailing slashes. */ virtual void AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 977b3a1..16e9788 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -555,7 +555,7 @@ void cmGlobalNinjaGenerator const std::string& /*projectName*/, const char* /*projectDir*/, const std::string& targetName, - const char* /*config*/, + const std::string& /*config*/, bool /*fast*/, std::vector const& makeOptions) { @@ -834,8 +834,8 @@ void cmGlobalNinjaGenerator ::AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs) { - const char* configName = - target->GetMakefile()->GetDefinition("CMAKE_BUILD_TYPE"); + std::string configName = + target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); cmLocalNinjaGenerator *ng = static_cast(this->LocalGenerators[0]); diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index e422e36..86c2912 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -197,7 +197,7 @@ public: const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index a392aa6..d947150 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -569,7 +569,7 @@ void cmGlobalUnixMakefileGenerator3 const std::string& /*projectName*/, const char* /*projectDir*/, const std::string& targetName, - const char* /*config*/, + const std::string& /*config*/, bool fast, std::vector const& makeOptions) { diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index b61619d..8924fa8 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -113,7 +113,7 @@ public: const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index a2991e1..0bc572b 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -314,7 +314,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions) { @@ -397,7 +397,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( makeCommand.push_back(targetProject); } std::string configArg = "/p:Configuration="; - if(config && strlen(config)) + if(!config.empty()) { configArg += config; } diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 97ac9bc..085f2d2 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -38,7 +38,7 @@ public: const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index a7f6587..f69bcfd 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -120,7 +120,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( const std::string& projectName, const char* /*projectDir*/, const std::string& targetName, - const char* config, + const std::string& config, bool /*fast*/, std::vector const& makeOptions ) @@ -149,7 +149,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( targetArg += "ALL_BUILD"; } targetArg += " - "; - if(config && strlen(config)) + if(!config.empty()) { targetArg += config; } @@ -419,11 +419,11 @@ void cmGlobalVisualStudio6Generator void cmGlobalVisualStudio6Generator ::AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir) { - if(config) + if(!config.empty()) { dir += prefix; dir += config; diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 3665f7b..22ec926 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -58,7 +58,7 @@ public: const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); @@ -82,7 +82,7 @@ public: /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 2a97edc..18f7f19 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -187,7 +187,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( const std::string& projectName, const char* /*projectDir*/, const std::string& targetName, - const char* config, + const std::string& config, bool /*fast*/, std::vector const& makeOptions) { @@ -224,7 +224,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( makeCommand.push_back("/build"); } - if(config && strlen(config)) + if(!config.empty()) { makeCommand.push_back(config); } @@ -962,11 +962,11 @@ void cmGlobalVisualStudio7Generator void cmGlobalVisualStudio7Generator ::AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir) { - if(config) + if(!config.empty()) { dir += prefix; dir += config; diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 2e58f6c..009f002 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -66,7 +66,7 @@ public: const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); @@ -94,7 +94,7 @@ public: /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 08e9adf..c0077b9 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -264,7 +264,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( const std::string& projectName, const char* /*projectDir*/, const std::string& targetName, - const char* config, + const std::string& config, bool /*fast*/, std::vector const& makeOptions) { @@ -298,11 +298,6 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( makeCommand.push_back("build"); } makeCommand.push_back("-target"); - // if it is a null string for config don't use it - if(config && *config == 0) - { - config = 0; - } if (!realTarget.empty()) { makeCommand.push_back(realTarget); @@ -319,7 +314,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( else { makeCommand.push_back("-configuration"); - makeCommand.push_back(config?config:"Debug"); + makeCommand.push_back(!config.empty()?config:"Debug"); } makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); @@ -1547,7 +1542,7 @@ void cmGlobalXCodeGenerator cmTarget& target, std::vector const & commands, - const char* configName, + const std::string& configName, const std::map& multipleOutputPairs ) @@ -1690,8 +1685,8 @@ void cmGlobalXCodeGenerator //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, - cmXCodeObject* buildSettings, - const char* configName) + cmXCodeObject* buildSettings, + const std::string& configName) { if(target.GetType() == cmTarget::INTERFACE_LIBRARY) { @@ -1804,7 +1799,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->CurrentLocalGenerator-> AppendFlags(extraLinkOptions, targetLinkFlags); } - if(configName && *configName) + if(!configName.empty()) { std::string linkFlagsVar = "LINK_FLAGS_"; linkFlagsVar += cmSystemTools::UpperCase(configName); @@ -2738,7 +2733,7 @@ void cmGlobalXCodeGenerator ::AppendBuildSettingAttribute(cmXCodeObject* target, const char* attribute, const char* value, - const char* configName) + const std::string& configName) { if(this->XcodeVersion < 21) { @@ -2761,9 +2756,9 @@ void cmGlobalXCodeGenerator for(std::vector::iterator i = list.begin(); i != list.end(); ++i) { - if(configName) + if(!configName.empty()) { - if(strcmp((*i)->GetObject("name")->GetString(), configName) == 0) + if((*i)->GetObject("name")->GetString() == configName) { cmXCodeObject* settings = (*i)->GetObject("buildSettings"); this->AppendOrAddBuildSetting(settings, attribute, value); @@ -3777,13 +3772,13 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p) void cmGlobalXCodeGenerator ::AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir) { if(this->XcodeVersion > 20) { - if(config) + if(!config.empty()) { dir += prefix; dir += config; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index d2dd491..03e75c4 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -59,7 +59,7 @@ public: const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); @@ -73,7 +73,7 @@ public: /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir); @@ -123,7 +123,7 @@ private: void CreateCustomRulesMakefile(const char* makefileBasename, cmTarget& target, std::vector const & commands, - const char* configName, + const std::string& configName, const std::map& multipleOutputPairs ); @@ -147,12 +147,13 @@ private: void AppendOrAddBuildSetting(cmXCodeObject* settings, const char* attr, const char* value); void AppendBuildSettingAttribute(cmXCodeObject* target, const char* attr, - const char* value, const char* configName); + const char* value, + const std::string& configName); cmXCodeObject* CreateUtilityTarget(cmTarget& target); void AddDependAndLinkInformation(cmXCodeObject* target); void CreateBuildSettings(cmTarget& target, cmXCodeObject* buildSettings, - const char* buildType); + const std::string& buildType); std::string ExtractFlag(const char* flag, std::string& flags); // delete all objects in the this->XCodeObjects vector. void ClearXCodeObjects(); diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 045cff6..d2737a1 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -142,7 +142,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os) this->EFGen->SetExportOld(this->ExportOld); if(this->ConfigurationTypes->empty()) { - if(this->ConfigurationName && *this->ConfigurationName) + if(!this->ConfigurationName.empty()) { this->EFGen->AddConfiguration(this->ConfigurationName); } diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index ec15044..6594218 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -80,8 +80,8 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, //---------------------------------------------------------------------------- void cmInstallFilesGenerator::GenerateScriptForConfig(std::ostream& os, - const char* config, - Indent const& indent) + const std::string& config, + Indent const& indent) { std::vector files; cmListFileBacktrace lfbt; diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 9dea296..23bf935 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -35,7 +35,7 @@ public: protected: virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); virtual void GenerateScriptForConfig(std::ostream& os, - const char* config, + const std::string& config, Indent const& indent); void AddFilesInstallRule(std::ostream& os, Indent const& indent, std::vector const& files); diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index d105a0c..0fad9d6 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -163,7 +163,7 @@ void cmInstallGenerator::GenerateScript(std::ostream& os) } //---------------------------------------------------------------------------- -bool cmInstallGenerator::InstallsForConfig(const char* config) +bool cmInstallGenerator::InstallsForConfig(const std::string& config) { return this->GeneratesForConfig(config); } diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index c89ab8a..c72e9e9 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -48,7 +48,7 @@ public: std::string GetInstallDestination() const; /** Test if this generator installs something for a given configuration. */ - bool InstallsForConfig(const char*); + bool InstallsForConfig(const std::string& config); protected: virtual void GenerateScript(std::ostream& os); diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 5df6e4b..ec2b518 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -59,8 +59,8 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os) //---------------------------------------------------------------------------- void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, - const char* config, - Indent const& indent) + const std::string& config, + Indent const& indent) { // Compute the build tree directory from which to copy the target. std::string fromDirConfig; @@ -319,7 +319,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, //---------------------------------------------------------------------------- std::string -cmInstallTargetGenerator::GetInstallFilename(const char* config) const +cmInstallTargetGenerator::GetInstallFilename(const std::string& config) const { NameType nameType = this->ImportLibrary? NameImplib : NameNormal; return @@ -330,7 +330,7 @@ cmInstallTargetGenerator::GetInstallFilename(const char* config) const //---------------------------------------------------------------------------- std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target, - const char* config, + const std::string& config, NameType nameType) { std::string fname; @@ -405,7 +405,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target, //---------------------------------------------------------------------------- void cmInstallTargetGenerator -::AddTweak(std::ostream& os, Indent const& indent, const char* config, +::AddTweak(std::ostream& os, Indent const& indent, const std::string& config, std::string const& file, TweakMethod tweak) { cmOStringStream tw; @@ -423,7 +423,7 @@ cmInstallTargetGenerator //---------------------------------------------------------------------------- void cmInstallTargetGenerator -::AddTweak(std::ostream& os, Indent const& indent, const char* config, +::AddTweak(std::ostream& os, Indent const& indent, const std::string& config, std::vector const& files, TweakMethod tweak) { if(files.size() == 1) @@ -470,7 +470,7 @@ std::string cmInstallTargetGenerator::GetDestDirPath(std::string const& file) //---------------------------------------------------------------------------- void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os, Indent const& indent, - const char* config, + const std::string& config, std::string const& file) { this->AddRPathCheckRule(os, indent, config, file); @@ -478,9 +478,9 @@ void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os, //---------------------------------------------------------------------------- void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os, - Indent const& indent, - const char* config, - std::string const& file) + Indent const& indent, + const std::string& config, + std::string const& file) { this->AddInstallNamePatchRule(os, indent, config, file); this->AddChrpathPatchRule(os, indent, config, file); @@ -492,7 +492,8 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os, void cmInstallTargetGenerator ::AddInstallNamePatchRule(std::ostream& os, Indent const& indent, - const char* config, std::string const& toDestDirPath) + const std::string& config, + std::string const& toDestDirPath) { if(this->ImportLibrary || !(this->Target->GetType() == cmTarget::SHARED_LIBRARY || @@ -605,7 +606,8 @@ cmInstallTargetGenerator void cmInstallTargetGenerator ::AddRPathCheckRule(std::ostream& os, Indent const& indent, - const char* config, std::string const& toDestDirPath) + const std::string& config, + std::string const& toDestDirPath) { // Skip the chrpath if the target does not need it. if(this->ImportLibrary || !this->Target->IsChrpathUsed(config)) @@ -642,7 +644,8 @@ cmInstallTargetGenerator void cmInstallTargetGenerator ::AddChrpathPatchRule(std::ostream& os, Indent const& indent, - const char* config, std::string const& toDestDirPath) + const std::string& config, + std::string const& toDestDirPath) { // Skip the chrpath if the target does not need it. if(this->ImportLibrary || !this->Target->IsChrpathUsed(config)) diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 18c3957..0f21da7 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -43,7 +43,7 @@ public: void SetNamelinkMode(NamelinkModeType mode) { this->NamelinkMode = mode; } NamelinkModeType GetNamelinkMode() const { return this->NamelinkMode; } - std::string GetInstallFilename(const char* config) const; + std::string GetInstallFilename(const std::string& config) const; enum NameType { @@ -54,7 +54,7 @@ public: }; static std::string GetInstallFilename(cmTarget const* target, - const char* config, + const std::string& config, NameType nameType = NameNormal); cmTarget* GetTarget() const { return this->Target; } @@ -63,30 +63,33 @@ public: protected: virtual void GenerateScript(std::ostream& os); virtual void GenerateScriptForConfig(std::ostream& os, - const char* config, + const std::string& config, Indent const& indent); typedef void (cmInstallTargetGenerator::*TweakMethod)( - std::ostream&, Indent const&, const char*, std::string const& + std::ostream&, Indent const&, const std::string&, std::string const& ); void AddTweak(std::ostream& os, Indent const& indent, - const char* config, std::string const& file, + const std::string& config, std::string const& file, TweakMethod tweak); void AddTweak(std::ostream& os, Indent const& indent, - const char* config, std::vector const& files, + const std::string& config, + std::vector const& files, TweakMethod tweak); std::string GetDestDirPath(std::string const& file); void PreReplacementTweaks(std::ostream& os, Indent const& indent, - const char* config, std::string const& file); + const std::string& config, + std::string const& file); void PostReplacementTweaks(std::ostream& os, Indent const& indent, - const char* config, std::string const& file); + const std::string& config, + std::string const& file); void AddInstallNamePatchRule(std::ostream& os, Indent const& indent, - const char* config, + const std::string& config, const std::string& toDestDirPath); void AddChrpathPatchRule(std::ostream& os, Indent const& indent, - const char* config, + const std::string& config, std::string const& toDestDirPath); void AddRPathCheckRule(std::ostream& os, Indent const& indent, - const char* config, + const std::string& config, std::string const& toDestDirPath); void AddStripRule(std::ostream& os, Indent const& indent, diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e36266a..cd9f9bd 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -280,7 +280,7 @@ void cmLocalGenerator::GenerateTestFiles() // Compute the set of configurations. std::vector configurationTypes; - const char* config = + const std::string& config = this->Makefile->GetConfigurations(configurationTypes, false); std::string file = this->Makefile->GetStartOutputDirectory(); @@ -384,11 +384,11 @@ void cmLocalGenerator::GenerateInstallRules() // Compute the set of configurations. std::vector configurationTypes; - const char* config = + const std::string& config = this->Makefile->GetConfigurations(configurationTypes, false); // Choose a default install configuration. - const char* default_config = config; + const char* default_config = config.c_str(); const char* default_order[] = {"RELEASE", "MINSIZEREL", "RELWITHDEBINFO", "DEBUG", 0}; for(const char** c = default_order; *c && !default_config; ++c) @@ -557,7 +557,7 @@ void cmLocalGenerator::GenerateTargetManifest() } if(configNames.empty()) { - target.GenerateTargetManifest(0); + target.GenerateTargetManifest(""); } else { @@ -712,8 +712,8 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, vars.LinkFlags = linkFlags.c_str(); std::string langFlags; - this->AddLanguageFlags(langFlags, llang, 0); - this->AddArchitectureFlags(langFlags, &target, llang, 0); + this->AddLanguageFlags(langFlags, llang, ""); + this->AddArchitectureFlags(langFlags, &target, llang, ""); vars.LanguageCompileFlags = langFlags.c_str(); cmCustomCommandLines commandLines; @@ -1292,7 +1292,7 @@ std::string cmLocalGenerator::GetIncludeFlags( cmGeneratorTarget* target, const std::string& lang, bool forResponseFile, - const char *config) + const std::string& config) { if(lang.empty()) { @@ -1370,7 +1370,7 @@ std::string cmLocalGenerator::GetIncludeFlags( if(!flagUsed || repeatFlag) { if(sysIncludeFlag && target && - target->IsSystemIncludeDirectory(i->c_str(), config)) + target->IsSystemIncludeDirectory(*i, config)) { includeFlags << sysIncludeFlag; } @@ -1405,7 +1405,7 @@ std::string cmLocalGenerator::GetIncludeFlags( //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileDefinitions(std::set& defines, cmTarget const* target, - const char* config) + const std::string& config) { std::vector targetDefines; target->GetCompileDefinitions(targetDefines, @@ -1416,7 +1416,7 @@ void cmLocalGenerator::AddCompileDefinitions(std::set& defines, //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileOptions( std::string& flags, cmTarget* target, - const std::string& lang, const char* config + const std::string& lang, const std::string& config ) { std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX"; @@ -1465,7 +1465,7 @@ void cmLocalGenerator::AddCompileOptions( void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, cmGeneratorTarget* target, const std::string& lang, - const char *config, + const std::string& config, bool stripImplicitInclDirs ) { @@ -1698,7 +1698,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, target->Target->GetName().c_str()); return; } - this->AddLanguageFlags(flags, linkLanguage, buildType.c_str()); + this->AddLanguageFlags(flags, linkLanguage, buildType); this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, *target, false, false); if(cmSystemTools::IsOn @@ -1945,7 +1945,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, void cmLocalGenerator::AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target, const std::string& lang, - const char* config) + const std::string& config) { // Only add Mac OS X specific flags on Darwin platforms (OSX and iphone): if(!this->Makefile->IsOn("APPLE")) @@ -2002,7 +2002,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, //---------------------------------------------------------------------------- void cmLocalGenerator::AddLanguageFlags(std::string& flags, const std::string& lang, - const char* config) + const std::string& config) { // Add language-specific flags. std::string flagsVar = "CMAKE_"; @@ -2013,7 +2013,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, //---------------------------------------------------------------------------- bool cmLocalGenerator::GetRealDependency(const std::string& inName, - const char* config, + const std::string& config, std::string& dep) { // Older CMake code may specify the dependency using the target @@ -2211,7 +2211,7 @@ void cmLocalGenerator //---------------------------------------------------------------------------- void cmLocalGenerator::AddCMP0018Flags(std::string &flags, cmTarget* target, std::string const& lang, - const char *config) + const std::string& config) { int targetType = target->GetType(); @@ -2327,13 +2327,13 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags, //---------------------------------------------------------------------------- void cmLocalGenerator::AddConfigVariableFlags(std::string& flags, const std::string& var, - const char* config) + const std::string& config) { // Add the flags from the variable itself. std::string flagsVar = var; this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str())); // Add the flags from the build-type specific variable. - if(config && *config) + if(!config.empty()) { flagsVar += "_"; flagsVar += cmSystemTools::UpperCase(config); @@ -2837,7 +2837,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, void cmLocalGenerator ::GenerateTargetInstallRules( - std::ostream& os, const char* config, + std::ostream& os, const std::string& config, std::vector const& configurationTypes) { // Convert the old-style install specification from each target to diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 3fe6a26..4d62833 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -138,16 +138,16 @@ public: void AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target, - const std::string&lang, const char* config); + const std::string&lang, const std::string& config); void AddLanguageFlags(std::string& flags, const std::string& lang, - const char* config); + const std::string& config); void AddCMP0018Flags(std::string &flags, cmTarget* target, - std::string const& lang, const char *config); + std::string const& lang, const std::string& config); void AddVisibilityPresetFlags(std::string &flags, cmTarget* target, const std::string& lang); void AddConfigVariableFlags(std::string& flags, const std::string& var, - const char* config); + const std::string& config); ///! Append flags to a string. virtual void AppendFlags(std::string& flags, const char* newFlags); virtual void AppendFlagEscape(std::string& flags, @@ -157,7 +157,7 @@ public: cmGeneratorTarget* target, const std::string& lang, bool forResponseFile = false, - const char *config = 0); + const std::string& config = ""); /** * Encode a list of preprocessor definitions for the compiler @@ -196,7 +196,7 @@ public: * the source directory of this generator. This should only be * used for dependencies of custom commands. */ - bool GetRealDependency(const std::string& name, const char* config, + bool GetRealDependency(const std::string& name, const std::string& config, std::string& dep); ///! for existing files convert to output path and short path if spaces @@ -227,13 +227,13 @@ public: void GetIncludeDirectories(std::vector& dirs, cmGeneratorTarget* target, const std::string& lang = "C", - const char *config = 0, + const std::string& config = "", bool stripImplicitInclDirs = true); void AddCompileOptions(std::string& flags, cmTarget* target, - const std::string& lang, const char* config); + const std::string& lang, const std::string& config); void AddCompileDefinitions(std::set& defines, cmTarget const* target, - const char* config); + const std::string& config); /** Compute the language used to compile the given source file. */ std::string GetSourceFileLanguage(const cmSourceFile& source); @@ -410,7 +410,7 @@ protected: // Handle old-style install rules stored in the targets. void GenerateTargetInstallRules( - std::ostream& os, const char* config, + std::ostream& os, const std::string& config, std::vector const& configurationTypes); std::string& CreateSafeUniqueObjectFileName(const std::string& sin, diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index b0c577e..0e246a5 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -38,7 +38,7 @@ class cmLocalVisualStudio6Generator::EventWriter { public: EventWriter(cmLocalVisualStudio6Generator* lg, - const char* config, std::string& code): + const std::string& config, std::string& code): LG(lg), Config(config), Code(code), First(true) {} void Start(const char* event) { @@ -72,7 +72,7 @@ public: } private: cmLocalVisualStudio6Generator* LG; - const char* Config; + std::string Config; std::string& Code; bool First; std::string Event; @@ -785,7 +785,7 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, //---------------------------------------------------------------------------- cmsys::auto_ptr cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target, - const char* config) + const std::string& config) { cmsys::auto_ptr pcc; @@ -813,7 +813,7 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target, // look for custom rules on a target and collect them together std::string cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, - const char* configName, + const std::string& configName, const std::string& /* libName */) { if (target.GetType() >= cmTarget::UTILITY ) @@ -863,7 +863,7 @@ inline std::string removeQuotes(const std::string& s) std::string cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target, - const char *config) + const std::string& config) { std::string includeOptions; @@ -1704,7 +1704,7 @@ void cmLocalVisualStudio6Generator flagsRelWithDebInfo = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsRelWithDebInfo += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" "; - this->AddCompileOptions(flags, &target, linkLanguage, 0); + this->AddCompileOptions(flags, &target, linkLanguage, ""); this->AddCompileOptions(flagsDebug, &target, linkLanguage, "Debug"); this->AddCompileOptions(flagsRelease, &target, linkLanguage, "Release"); this->AddCompileOptions(flagsMinSizeRel, &target, linkLanguage, @@ -1730,7 +1730,7 @@ void cmLocalVisualStudio6Generator std::set minsizeDefinesSet; std::set debugrelDefinesSet; - this->AddCompileDefinitions(definesSet, &target, 0); + this->AddCompileDefinitions(definesSet, &target, ""); this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG"); this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE"); this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL"); @@ -1800,7 +1800,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFooter(std::ostream& fout) //---------------------------------------------------------------------------- void cmLocalVisualStudio6Generator ::ComputeLinkOptions(cmTarget& target, - const char* configName, + const std::string& configName, const std::string extraOptions, std::string& options) { diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index 6702111..4771833 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -81,16 +81,17 @@ private: class EventWriter; friend class EventWriter; cmsys::auto_ptr - MaybeCreateOutputDir(cmTarget& target, const char* config); + MaybeCreateOutputDir(cmTarget& target, const std::string& config); std::string CreateTargetRules(cmTarget &target, - const char* configName, + const std::string& configName, const std::string& libName); - void ComputeLinkOptions(cmTarget& target, const char* configName, + void ComputeLinkOptions(cmTarget& target, const std::string& configName, const std::string extraOptions, std::string& options); void OutputObjects(cmTarget& target, const char* tool, std::string& options); - std::string GetTargetIncludeOptions(cmTarget &target, const char *config); + std::string GetTargetIncludeOptions(cmTarget &target, + const std::string& config); std::vector Configurations; std::string GetConfigName(std::string const& configuration) const; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 6ad5e04..5f98a71 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -588,7 +588,7 @@ class cmLocalVisualStudio7Generator::EventWriter { public: EventWriter(cmLocalVisualStudio7Generator* lg, - const char* config, std::ostream& os): + const std::string& config, std::ostream& os): LG(lg), Config(config), Stream(os), First(true) {} void Start(const char* tool) { @@ -629,14 +629,14 @@ public: } private: cmLocalVisualStudio7Generator* LG; - const char* Config; + std::string Config; std::ostream& Stream; bool First; }; //---------------------------------------------------------------------------- void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, - const char* configName, + const std::string& configName, const std::string& libName, cmTarget &target) { @@ -745,7 +745,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, table, this->ExtraFlagTable); targetOptions.FixExceptionHandlingDefault(); - std::string asmLocation = std::string(configName) + "/"; + std::string asmLocation = configName + "/"; targetOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str()); targetOptions.Parse(flags.c_str()); targetOptions.Parse(defineFlags.c_str()); @@ -944,7 +944,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, //---------------------------------------------------------------------------- std::string cmLocalVisualStudio7Generator -::GetBuildTypeLinkerFlags(std::string rootLinkerFlags, const char* configName) +::GetBuildTypeLinkerFlags(std::string rootLinkerFlags, + const std::string& configName) { std::string configTypeUpper = cmSystemTools::UpperCase(configName); std::string extraLinkOptionsBuildTypeDef = @@ -958,7 +959,8 @@ cmLocalVisualStudio7Generator } void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, - const char* configName, cmTarget &target, const Options& targetOptions) + const std::string& configName, cmTarget &target, + const Options& targetOptions) { cmGlobalVisualStudio7Generator* gg = static_cast(this->GlobalGenerator); @@ -1903,7 +1905,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout) // look for custom rules on a target and collect them together void cmLocalVisualStudio7Generator ::OutputTargetRules(std::ostream& fout, - const char* configName, + const std::string& configName, cmTarget &target, const std::string& /*libName*/) { diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 2823a2c..f9bb6e1 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -71,7 +71,7 @@ private: typedef cmVisualStudioGeneratorOptions Options; typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo; std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags, - const char* configName); + const std::string& configName); void FixGlobalTargets(); void WriteProjectFiles(); void WriteVCProjHeader(std::ostream& fout, const std::string& libName, @@ -82,14 +82,14 @@ private: void WriteConfigurations(std::ostream& fout, const std::string& libName, cmTarget &tgt); void WriteConfiguration(std::ostream& fout, - const char* configName, + const std::string& configName, const std::string& libName, cmTarget &tgt); std::string EscapeForXML(const std::string& s); std::string ConvertToXMLOutputPath(const char* path); std::string ConvertToXMLOutputPathSingle(const char* path); - void OutputTargetRules(std::ostream& fout, const char* configName, + void OutputTargetRules(std::ostream& fout, const std::string& configName, cmTarget &target, const std::string& libName); - void OutputBuildTool(std::ostream& fout, const char* configName, + void OutputBuildTool(std::ostream& fout, const std::string& configName, cmTarget& t, const Options& targetOptions); void OutputLibraryDirectories(std::ostream& fout, std::vector const& dirs); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index ef2bb1d..11b0387 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -33,7 +33,7 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator() //---------------------------------------------------------------------------- cmsys::auto_ptr cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target, - const char* config, + const std::string& config, bool isFortran) { cmsys::auto_ptr pcc; @@ -80,7 +80,7 @@ const char* cmLocalVisualStudioGenerator::GetReportErrorLabel() const std::string cmLocalVisualStudioGenerator ::ConstructScript(cmCustomCommand const& cc, - const char* configName, + const std::string& configName, const char* newline_text) { bool useLocal = this->CustomCommandUseLocal(); diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 1a3499a..2297072 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -47,7 +47,7 @@ public: /** Construct a script from the given list of command lines. */ std::string ConstructScript(cmCustomCommand const& cc, - const char* configName, + const std::string& configName, const char* newline = "\n"); /** Label to which to jump in a batch file after a failed step in a @@ -67,7 +67,8 @@ protected: /** Construct a custom command to make exe import lib dir. */ cmsys::auto_ptr - MaybeCreateImplibDir(cmTarget& target, const char* config, bool isFortran); + MaybeCreateImplibDir(cmTarget& target, const std::string& config, + bool isFortran); VSVersion Version; }; diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index fb8c2d1..5857aef 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -54,7 +54,7 @@ void cmLocalXCodeGenerator::Generate() iter != targets.end(); ++iter) { cmTarget* t = &iter->second; - t->HasMacOSXRpathInstallNameDir(NULL); + t->HasMacOSXRpathInstallNameDir(""); } } @@ -68,6 +68,6 @@ void cmLocalXCodeGenerator::GenerateInstallRules() iter != targets.end(); ++iter) { cmTarget* t = &iter->second; - t->HasMacOSXRpathInstallNameDir(NULL); + t->HasMacOSXRpathInstallNameDir(""); } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d107ddf..1ef4d46 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2734,7 +2734,7 @@ void cmMakefile::AddDefaultDefinitions() } //---------------------------------------------------------------------------- -const char* +std::string cmMakefile::GetConfigurations(std::vector& configs, bool single) const { @@ -2745,12 +2745,12 @@ cmMakefile::GetConfigurations(std::vector& configs, { cmSystemTools::ExpandListArgument(configTypes, configs); } - return 0; + return ""; } else { - const char* buildType = this->GetDefinition("CMAKE_BUILD_TYPE"); - if(single && buildType && *buildType) + const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE"); + if(single && !buildType.empty()) { configs.push_back(buildType); } @@ -3801,11 +3801,12 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const } //---------------------------------------------------------------------------- -const char* cmMakefile::GetFeature(const char* feature, const char* config) +const char* cmMakefile::GetFeature(const char* feature, + const std::string& config) { // TODO: Define accumulation policy for features (prepend, append, replace). // Currently we always replace. - if(config && *config) + if(!config.empty()) { std::string featureConfig = feature; featureConfig += "_"; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 86cedb0..1c3ad73 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -320,7 +320,7 @@ public: } /** Get the configurations to be generated. */ - const char* GetConfigurations(std::vector& configs, + std::string GetConfigurations(std::vector& configs, bool single = true) const; /** @@ -811,7 +811,7 @@ public: 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 std::string& config); // Get the properties cmPropertyMap &GetProperties() { return this->Properties; }; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0a836a5..1af5d6c 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -133,7 +133,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() this->Makefile->GetProperty ("ADDITIONAL_MAKE_CLEAN_FILES")) { - const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = + this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); cmListFileBacktrace lfbt; cmGeneratorExpression ge(lfbt); cmsys::auto_ptr cge = @@ -1070,7 +1071,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "set(CMAKE_C_TARGET_INCLUDE_PATH\n"; std::vector includes; - const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, "C", config); @@ -1567,7 +1569,8 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) #endif std::vector includes; - const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, "C", config); @@ -1952,7 +1955,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, std::vector includes; - const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, lang, config); @@ -2059,7 +2063,8 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) { std::vector includes; - const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = + this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, "C", config); diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 5f697a5..21eece4 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -183,7 +183,7 @@ protected: cmLocalUnixMakefileGenerator3 *LocalGenerator; cmGlobalUnixMakefileGenerator3 *GlobalGenerator; cmMakefile *Makefile; - const char *ConfigName; + std::string ConfigName; enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility }; CustomCommandDriveType CustomCommandDriver; diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 78b59b3..449f923 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -19,7 +19,7 @@ //---------------------------------------------------------------------------- cmOSXBundleGenerator:: cmOSXBundleGenerator(cmGeneratorTarget* target, - const char* configName) + const std::string& configName) : GT(target) , Makefile(target->Target->GetMakefile()) , LocalGenerator(Makefile->GetLocalGenerator()) diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index 97ae731..95b4aef 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -27,7 +27,7 @@ class cmOSXBundleGenerator { public: cmOSXBundleGenerator(cmGeneratorTarget* target, - const char* configName); + const std::string& configName); // create an app bundle at a given root, and return // the directory within the bundle that contains the executable @@ -62,7 +62,7 @@ private: cmGeneratorTarget* GT; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; - const char* ConfigName; + std::string ConfigName; std::set* MacContentFolders; }; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index fbb3b1c..8eee991 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -306,7 +306,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) } static void GetCompileDefinitionsAndDirectories(cmTarget const* target, - const char * config, + const std::string& config, std::string &incs, std::string &defs) { @@ -366,7 +366,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR"); } if (const char *targetQtVersion = - target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", 0)) + target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", "")) { qtVersion = targetQtVersion; } @@ -563,7 +563,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, std::string _moc_incs; std::string _moc_compile_defs; std::vector configs; - const char *config = makefile->GetConfigurations(configs); + const std::string& config = makefile->GetConfigurations(configs); GetCompileDefinitionsAndDirectories(target, config, _moc_incs, _moc_compile_defs); @@ -675,7 +675,7 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector &opts, opts.insert(opts.end(), extraOpts.begin(), extraOpts.end()); } -static void GetUicOpts(cmTarget const* target, const char * config, +static void GetUicOpts(cmTarget const* target, const std::string& config, std::string &optString) { std::vector opts; @@ -717,7 +717,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, std::string _uic_opts; std::vector configs; - const char *config = makefile->GetConfigurations(configs); + const std::string& config = makefile->GetConfigurations(configs); GetUicOpts(target, config, _uic_opts); if (!_uic_opts.empty()) @@ -967,7 +967,8 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, return gg; } -bool cmQtAutoGenerators::Run(const char* targetDirectory, const char *config) +bool cmQtAutoGenerators::Run(const char* targetDirectory, + const std::string& config) { bool success = true; cmake cm; @@ -994,7 +995,7 @@ bool cmQtAutoGenerators::Run(const char* targetDirectory, const char *config) bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, const char* targetDirectory, - const char *config) + const std::string& config) { std::string filename(cmSystemTools::CollapseFullPath(targetDirectory)); cmSystemTools::ConvertToUnixSlashes(filename); @@ -1027,7 +1028,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, { std::string compileDefsPropOrig = "AM_MOC_COMPILE_DEFINITIONS"; std::string compileDefsProp = compileDefsPropOrig; - if(config) + if(!config.empty()) { compileDefsProp += "_"; compileDefsProp += config; @@ -1039,7 +1040,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, { std::string includesPropOrig = "AM_MOC_INCLUDES"; std::string includesProp = includesPropOrig; - if(config) + if(!config.empty()) { includesProp += "_"; includesProp += config; @@ -1058,7 +1059,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, = makefile->GetSafeDefinition("AM_UIC_OPTIONS_FILES"); std::string uicOptionsPropOrig = "AM_UIC_TARGET_OPTIONS"; std::string uicOptionsProp = uicOptionsPropOrig; - if(config) + if(!config.empty()) { uicOptionsProp += "_"; uicOptionsProp += config; diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 2840fbf..af4ceb9 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -21,7 +21,7 @@ class cmQtAutoGenerators { public: cmQtAutoGenerators(); - bool Run(const char* targetDirectory, const char *config); + bool Run(const char* targetDirectory, const std::string& config); bool InitializeAutogenTarget(cmTarget* target); void SetupAutoGenerateTarget(cmTarget const* target); @@ -38,7 +38,7 @@ private: bool ReadAutogenInfoFile(cmMakefile* makefile, const char* targetDirectory, - const char *config); + const std::string& config); bool ReadOldMocDefinitionsFile(cmMakefile* makefile, const char* targetDirectory); void WriteOldMocDefinitionsFile(const char* targetDirectory); diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 7a8efc1..7685d40 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -19,7 +19,7 @@ cmScriptGenerator std::vector const& configurations): RuntimeConfigVariable(config_var), Configurations(configurations), - ConfigurationName(0), + ConfigurationName(""), ConfigurationTypes(0), ActionsPerConfig(false) { @@ -34,21 +34,21 @@ cmScriptGenerator //---------------------------------------------------------------------------- void cmScriptGenerator -::Generate(std::ostream& os, const char* config, +::Generate(std::ostream& os, const std::string& config, std::vector const& configurationTypes) { this->ConfigurationName = config; this->ConfigurationTypes = &configurationTypes; this->GenerateScript(os); - this->ConfigurationName = 0; + this->ConfigurationName = ""; this->ConfigurationTypes = 0; } //---------------------------------------------------------------------------- -static void cmScriptGeneratorEncodeConfig(const char* config, +static void cmScriptGeneratorEncodeConfig(const std::string& config, std::string& result) { - for(const char* c = config; *c; ++c) + for(const char* c = config.c_str(); *c; ++c) { if(*c >= 'a' && *c <= 'z') { @@ -73,12 +73,12 @@ static void cmScriptGeneratorEncodeConfig(const char* config, //---------------------------------------------------------------------------- std::string -cmScriptGenerator::CreateConfigTest(const char* config) +cmScriptGenerator::CreateConfigTest(const std::string& config) { std::string result = "\"${"; result += this->RuntimeConfigVariable; result += "}\" MATCHES \"^("; - if(config && *config) + if(!config.empty()) { cmScriptGeneratorEncodeConfig(config, result); } @@ -142,14 +142,15 @@ void cmScriptGenerator::GenerateScriptActions(std::ostream& os, } //---------------------------------------------------------------------------- -void cmScriptGenerator::GenerateScriptForConfig(std::ostream&, const char*, +void cmScriptGenerator::GenerateScriptForConfig(std::ostream&, + const std::string&, Indent const&) { // No actions for this generator. } //---------------------------------------------------------------------------- -bool cmScriptGenerator::GeneratesForConfig(const char* config) +bool cmScriptGenerator::GeneratesForConfig(const std::string& config) { // If this is not a configuration-specific rule then we install. if(this->Configurations.empty()) @@ -159,7 +160,7 @@ bool cmScriptGenerator::GeneratesForConfig(const char* config) // This is a configuration-specific rule. Check if the config // matches this rule. - std::string config_upper = cmSystemTools::UpperCase(config?config:""); + std::string config_upper = cmSystemTools::UpperCase(config); for(std::vector::const_iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index 3515e20..9ab04f1 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -51,7 +51,7 @@ public: std::vector const& configurations); virtual ~cmScriptGenerator(); - void Generate(std::ostream& os, const char* config, + void Generate(std::ostream& os, const std::string& config, std::vector const& configurationTypes); const std::vector& GetConfigurations() const @@ -63,15 +63,15 @@ protected: virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); virtual void GenerateScriptForConfig(std::ostream& os, - const char* config, + const std::string& config, Indent const& indent); virtual void GenerateScriptNoConfig(std::ostream&, Indent const&) {} virtual bool NeedsScriptNoConfig() const { return false; } // Test if this generator does something for a given configuration. - bool GeneratesForConfig(const char*); + bool GeneratesForConfig(const std::string&); - std::string CreateConfigTest(const char* config); + std::string CreateConfigTest(const std::string& config); std::string CreateConfigTest(std::vector const& configs); std::string CreateComponentTest(const char* component); @@ -80,7 +80,7 @@ protected: std::vector const Configurations; // Information used during generation. - const char* ConfigurationName; + std::string ConfigurationName; std::vector const* ConfigurationTypes; // True if the subclass needs to generate an explicit rule for each diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 3273437..b8e662a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -109,7 +109,8 @@ public: const char* ExplicitLibraries; }; void ComputeLinkInterface(cmTarget const* thisTarget, - const char* config, OptionalLinkInterface& iface, + const std::string& config, + OptionalLinkInterface& iface, cmTarget const* head, const char *explicitLibraries) const; @@ -692,10 +693,11 @@ const std::vector& cmTarget::GetLinkDirectories() const } //---------------------------------------------------------------------------- -cmTarget::LinkLibraryType cmTarget::ComputeLinkType(const char* config) const +cmTarget::LinkLibraryType cmTarget::ComputeLinkType( + const std::string& config) const { // No configuration is always optimized. - if(!(config && *config)) + if(config.empty()) { return cmTarget::OPTIMIZED; } @@ -755,7 +757,7 @@ bool cmTarget::NameResolvesToFramework(const std::string& libname) const } //---------------------------------------------------------------------------- -void cmTarget::GetDirectLinkLibraries(const char *config, +void cmTarget::GetDirectLinkLibraries(const std::string& config, std::vector &libs, cmTarget const* head) const { @@ -789,7 +791,7 @@ void cmTarget::GetDirectLinkLibraries(const char *config, } //---------------------------------------------------------------------------- -void cmTarget::GetInterfaceLinkLibraries(const char *config, +void cmTarget::GetInterfaceLinkLibraries(const std::string& config, std::vector &libs, cmTarget const* head) const { @@ -1565,7 +1567,7 @@ static void processIncludeDirectories(cmTarget const* tgt, std::vector &includes, std::set &uniqueIncludes, cmGeneratorExpressionDAGChecker *dagChecker, - const char *config, bool debugIncludes) + const std::string& config, bool debugIncludes) { cmMakefile *mf = tgt->GetMakefile(); @@ -1730,7 +1732,7 @@ static void processIncludeDirectories(cmTarget const* tgt, //---------------------------------------------------------------------------- std::vector -cmTarget::GetIncludeDirectories(const char *config) const +cmTarget::GetIncludeDirectories(const std::string& config) const { std::vector includes; std::set uniqueIncludes; @@ -1767,8 +1769,7 @@ cmTarget::GetIncludeDirectories(const char *config) const config, debugIncludes); - std::string configString = config ? config : ""; - if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString]) + if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config]) { for (std::vector::const_iterator it = this->Internal->LinkImplementationPropertyEntries.begin(), @@ -1805,7 +1806,7 @@ cmTarget::GetIncludeDirectories(const char *config) const includeGenex); this->Internal - ->CachedLinkInterfaceIncludeDirectoriesEntries[configString].push_back( + ->CachedLinkInterfaceIncludeDirectoriesEntries[config].push_back( new cmTargetInternals::TargetPropertyEntry(cge, it->Value)); } @@ -1833,14 +1834,14 @@ cmTarget::GetIncludeDirectories(const char *config) const cmsys::auto_ptr cge = ge.Parse(libDir.c_str()); this->Internal - ->CachedLinkInterfaceIncludeDirectoriesEntries[configString] + ->CachedLinkInterfaceIncludeDirectoriesEntries[config] .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); } } } processIncludeDirectories(this, - this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[configString], + this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[config], includes, uniqueIncludes, &dagChecker, @@ -1854,7 +1855,7 @@ cmTarget::GetIncludeDirectories(const char *config) const } else { - this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString] + this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config] = true; } @@ -1867,7 +1868,7 @@ static void processCompileOptionsInternal(cmTarget const* tgt, std::vector &options, std::set &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const char *config, bool debugOptions, const char *logName) + const std::string& config, bool debugOptions, const char *logName) { cmMakefile *mf = tgt->GetMakefile(); @@ -1926,7 +1927,7 @@ static void processCompileOptions(cmTarget const* tgt, std::vector &options, std::set &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const char *config, bool debugOptions) + const std::string& config, bool debugOptions) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, "options"); @@ -1934,7 +1935,7 @@ static void processCompileOptions(cmTarget const* tgt, //---------------------------------------------------------------------------- void cmTarget::GetAutoUicOptions(std::vector &result, - const char *config) const + const std::string& config) const { const char *prop = this->GetLinkInterfaceDependentStringProperty("AUTOUIC_OPTIONS", @@ -1960,7 +1961,7 @@ void cmTarget::GetAutoUicOptions(std::vector &result, //---------------------------------------------------------------------------- void cmTarget::GetCompileOptions(std::vector &result, - const char *config) const + const std::string& config) const { std::set uniqueOptions; cmListFileBacktrace lfbt; @@ -1996,8 +1997,7 @@ void cmTarget::GetCompileOptions(std::vector &result, config, debugOptions); - std::string configString = config ? config : ""; - if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[configString]) + if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[config]) { for (std::vector::const_iterator it = this->Internal->LinkImplementationPropertyEntries.begin(), @@ -2034,14 +2034,14 @@ void cmTarget::GetCompileOptions(std::vector &result, optionGenex); this->Internal - ->CachedLinkInterfaceCompileOptionsEntries[configString].push_back( + ->CachedLinkInterfaceCompileOptionsEntries[config].push_back( new cmTargetInternals::TargetPropertyEntry(cge, it->Value)); } } processCompileOptions(this, - this->Internal->CachedLinkInterfaceCompileOptionsEntries[configString], + this->Internal->CachedLinkInterfaceCompileOptionsEntries[config], result, uniqueOptions, &dagChecker, @@ -2054,7 +2054,7 @@ void cmTarget::GetCompileOptions(std::vector &result, } else { - this->Internal->CacheLinkInterfaceCompileOptionsDone[configString] = true; + this->Internal->CacheLinkInterfaceCompileOptionsDone[config] = true; } } @@ -2064,7 +2064,7 @@ static void processCompileDefinitions(cmTarget const* tgt, std::vector &options, std::set &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const char *config, bool debugOptions) + const std::string& config, bool debugOptions) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, @@ -2073,7 +2073,7 @@ static void processCompileDefinitions(cmTarget const* tgt, //---------------------------------------------------------------------------- void cmTarget::GetCompileDefinitions(std::vector &list, - const char *config) const + const std::string& config) const { std::set uniqueOptions; cmListFileBacktrace lfbt; @@ -2109,8 +2109,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, config, debugDefines); - std::string configString = config ? config : ""; - if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString]) + if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config]) { for (std::vector::const_iterator it = this->Internal->LinkImplementationPropertyEntries.begin(), @@ -2147,11 +2146,11 @@ void cmTarget::GetCompileDefinitions(std::vector &list, defsGenex); this->Internal - ->CachedLinkInterfaceCompileDefinitionsEntries[configString].push_back( + ->CachedLinkInterfaceCompileDefinitionsEntries[config].push_back( new cmTargetInternals::TargetPropertyEntry(cge, it->Value)); } - if (config) + if (!config.empty()) { std::string configPropName = "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config); @@ -2174,7 +2173,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, cmsys::auto_ptr cge = ge.Parse(configProp); this->Internal - ->CachedLinkInterfaceCompileDefinitionsEntries[configString] + ->CachedLinkInterfaceCompileDefinitionsEntries[config] .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); } break; @@ -2189,7 +2188,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, } processCompileDefinitions(this, - this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[configString], + this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[config], list, uniqueOptions, &dagChecker, @@ -2203,7 +2202,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, } else { - this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString] + this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config] = true; } } @@ -2333,7 +2332,8 @@ bool cmTarget::HaveWellDefinedOutputFiles() const } //---------------------------------------------------------------------------- -cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const +cmTarget::OutputInfo const* cmTarget::GetOutputInfo( + const std::string& config) const { // There is no output information for imported targets. if(this->IsImported()) @@ -2355,7 +2355,7 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const // Lookup/compute/cache the output information for this configuration. std::string config_upper; - if(config && *config) + if(!config.empty()) { config_upper = cmSystemTools::UpperCase(config); } @@ -2378,7 +2378,8 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const } //---------------------------------------------------------------------------- -cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const +cmTarget::CompileInfo const* cmTarget::GetCompileInfo( + const std::string& config) const { // There is no compile information for imported targets. if(this->IsImported()) @@ -2399,7 +2400,7 @@ cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const // Lookup/compute/cache the compile information for this configuration. std::string config_upper; - if(config && *config) + if(!config.empty()) { config_upper = cmSystemTools::UpperCase(config); } @@ -2417,7 +2418,8 @@ cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetDirectory(const char* config, bool implib) const +std::string cmTarget::GetDirectory(const std::string& config, + bool implib) const { if (this->IsImported()) { @@ -2435,7 +2437,7 @@ std::string cmTarget::GetDirectory(const char* config, bool implib) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetPDBDirectory(const char* config) const +std::string cmTarget::GetPDBDirectory(const std::string& config) const { if(OutputInfo const* info = this->GetOutputInfo(config)) { @@ -2446,7 +2448,7 @@ std::string cmTarget::GetPDBDirectory(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetCompilePDBDirectory(const char* config) const +std::string cmTarget::GetCompilePDBDirectory(const std::string& config) const { if(CompileInfo const* info = this->GetCompileInfo(config)) { @@ -2456,7 +2458,7 @@ std::string cmTarget::GetCompilePDBDirectory(const char* config) const } //---------------------------------------------------------------------------- -const char* cmTarget::GetLocation(const char* config) const +const char* cmTarget::GetLocation(const std::string& config) const { static std::string location; if (this->IsImported()) @@ -2547,9 +2549,10 @@ void cmTarget::GetTargetVersion(bool soversion, } //---------------------------------------------------------------------------- -const char* cmTarget::GetFeature(const char* feature, const char* config) const +const char* cmTarget::GetFeature(const char* feature, + const std::string& config) const { - if(config && *config) + if(!config.empty()) { std::string featureConfig = feature; featureConfig += "_"; @@ -2798,7 +2801,8 @@ bool cmTarget::GetPropertyAsBool(const std::string& prop) const class cmTargetCollectLinkLanguages { public: - cmTargetCollectLinkLanguages(cmTarget const* target, const char* config, + cmTargetCollectLinkLanguages(cmTarget const* target, + const std::string& config, std::set& languages, cmTarget const* head): Config(config), Languages(languages), HeadTarget(head), @@ -2870,7 +2874,7 @@ public: } } private: - const char* Config; + std::string Config; std::set& Languages; cmTarget const* HeadTarget; cmMakefile* Makefile; @@ -2879,7 +2883,7 @@ private: }; //---------------------------------------------------------------------------- -std::string cmTarget::GetLinkerLanguage(const char* config, +std::string cmTarget::GetLinkerLanguage(const std::string& config, cmTarget const* head) const { cmTarget const* headTarget = head ? head : this; @@ -2887,10 +2891,11 @@ std::string cmTarget::GetLinkerLanguage(const char* config, } //---------------------------------------------------------------------------- -cmTarget::LinkClosure const* cmTarget::GetLinkClosure(const char* config, +cmTarget::LinkClosure const* cmTarget::GetLinkClosure( + const std::string& config, cmTarget const* head) const { - TargetConfigPair key(head, cmSystemTools::UpperCase(config ? config : "")); + TargetConfigPair key(head, cmSystemTools::UpperCase(config)); cmTargetInternals::LinkClosureMapType::iterator i = this->Internal->LinkClosureMap.find(key); if(i == this->Internal->LinkClosureMap.end()) @@ -2957,7 +2962,7 @@ public: }; //---------------------------------------------------------------------------- -void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc, +void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc, cmTarget const* head) const { // Get languages built in this target. @@ -3070,7 +3075,7 @@ const char* cmTarget::GetPrefixVariableInternal(bool implib) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetPDBName(const char* config) const +std::string cmTarget::GetPDBName(const std::string& config) const { std::string prefix; std::string base; @@ -3078,8 +3083,7 @@ std::string cmTarget::GetPDBName(const char* config) const this->GetFullNameInternal(config, false, prefix, base, suffix); std::vector props; - std::string configUpper = - cmSystemTools::UpperCase(config? config : ""); + std::string configUpper = cmSystemTools::UpperCase(config); if(!configUpper.empty()) { // PDB_NAME_ @@ -3102,7 +3106,7 @@ std::string cmTarget::GetPDBName(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetCompilePDBName(const char* config) const +std::string cmTarget::GetCompilePDBName(const std::string& config) const { std::string prefix; std::string base; @@ -3110,7 +3114,7 @@ std::string cmTarget::GetCompilePDBName(const char* config) const this->GetFullNameInternal(config, false, prefix, base, suffix); // Check for a per-configuration output directory target property. - std::string configUpper = cmSystemTools::UpperCase(config? config : ""); + std::string configUpper = cmSystemTools::UpperCase(config); std::string configProp = "COMPILE_PDB_NAME_"; configProp += configUpper; const char* config_name = this->GetProperty(configProp.c_str()); @@ -3129,7 +3133,7 @@ std::string cmTarget::GetCompilePDBName(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetCompilePDBPath(const char* config) const +std::string cmTarget::GetCompilePDBPath(const std::string& config) const { std::string dir = this->GetCompilePDBDirectory(config); std::string name = this->GetCompilePDBName(config); @@ -3145,7 +3149,7 @@ std::string cmTarget::GetCompilePDBPath(const char* config) const } //---------------------------------------------------------------------------- -bool cmTarget::HasSOName(const char* config) const +bool cmTarget::HasSOName(const std::string& config) const { // soname is supported only for shared libraries and modules, // and then only when the platform supports an soname flag. @@ -3157,7 +3161,7 @@ bool cmTarget::HasSOName(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetSOName(const char* config) const +std::string cmTarget::GetSOName(const std::string& config) const { if(this->IsImported()) { @@ -3199,7 +3203,7 @@ std::string cmTarget::GetSOName(const char* config) const } //---------------------------------------------------------------------------- -bool cmTarget::HasMacOSXRpathInstallNameDir(const char* config) const +bool cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const { bool install_name_is_rpath = false; bool macosx_rpath = false; @@ -3311,7 +3315,8 @@ bool cmTarget::MacOSXRpathInstallNameDirDefault() const } //---------------------------------------------------------------------------- -bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const +bool cmTarget::IsImportedSharedLibWithoutSOName( + const std::string& config) const { if(this->IsImported() && this->GetType() == cmTarget::SHARED_LIBRARY) { @@ -3324,7 +3329,7 @@ bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::NormalGetRealName(const char* config) const +std::string cmTarget::NormalGetRealName(const std::string& config) const { // This should not be called for imported targets. // TODO: Split cmTarget into a class hierarchy to get compile-time @@ -3362,7 +3367,8 @@ std::string cmTarget::NormalGetRealName(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetFullName(const char* config, bool implib) const +std::string cmTarget::GetFullName(const std::string& config, + bool implib) const { if(this->IsImported()) { @@ -3376,7 +3382,7 @@ std::string cmTarget::GetFullName(const char* config, bool implib) const //---------------------------------------------------------------------------- std::string -cmTarget::GetFullNameImported(const char* config, bool implib) const +cmTarget::GetFullNameImported(const std::string& config, bool implib) const { return cmSystemTools::GetFilenameName( this->ImportedGetFullPath(config, implib)); @@ -3384,14 +3390,15 @@ cmTarget::GetFullNameImported(const char* config, bool implib) const //---------------------------------------------------------------------------- void cmTarget::GetFullNameComponents(std::string& prefix, std::string& base, - std::string& suffix, const char* config, + std::string& suffix, + const std::string& config, bool implib) const { this->GetFullNameInternal(config, implib, prefix, base, suffix); } //---------------------------------------------------------------------------- -std::string cmTarget::GetFullPath(const char* config, bool implib, +std::string cmTarget::GetFullPath(const std::string& config, bool implib, bool realname) const { if(this->IsImported()) @@ -3405,8 +3412,8 @@ std::string cmTarget::GetFullPath(const char* config, bool implib, } //---------------------------------------------------------------------------- -std::string cmTarget::NormalGetFullPath(const char* config, bool implib, - bool realname) const +std::string cmTarget::NormalGetFullPath(const std::string& config, + bool implib, bool realname) const { std::string fpath = this->GetDirectory(config, implib); fpath += "/"; @@ -3434,7 +3441,7 @@ std::string cmTarget::NormalGetFullPath(const char* config, bool implib, //---------------------------------------------------------------------------- std::string -cmTarget::ImportedGetFullPath(const char* config, bool implib) const +cmTarget::ImportedGetFullPath(const std::string& config, bool implib) const { std::string result; if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this)) @@ -3451,7 +3458,7 @@ cmTarget::ImportedGetFullPath(const char* config, bool implib) const //---------------------------------------------------------------------------- std::string -cmTarget::GetFullNameInternal(const char* config, bool implib) const +cmTarget::GetFullNameInternal(const std::string& config, bool implib) const { std::string prefix; std::string base; @@ -3461,7 +3468,7 @@ cmTarget::GetFullNameInternal(const char* config, bool implib) const } //---------------------------------------------------------------------------- -void cmTarget::GetFullNameInternal(const char* config, +void cmTarget::GetFullNameInternal(const std::string& config, bool implib, std::string& outPrefix, std::string& outBase, @@ -3507,7 +3514,7 @@ void cmTarget::GetFullNameInternal(const char* config, ? this->GetProperty("IMPORT_SUFFIX") : this->GetProperty("SUFFIX")); const char* configPostfix = 0; - if(config && *config) + if(!config.empty()) { std::string configProp = cmSystemTools::UpperCase(config); configProp += "_POSTFIX"; @@ -3604,7 +3611,7 @@ void cmTarget::GetLibraryNames(std::string& name, std::string& realName, std::string& impName, std::string& pdbName, - const char* config) const + const std::string& config) const { // This should not be called for imported targets. // TODO: Split cmTarget into a class hierarchy to get compile-time @@ -3708,7 +3715,7 @@ void cmTarget::GetExecutableNames(std::string& name, std::string& realName, std::string& impName, std::string& pdbName, - const char* config) const + const std::string& config) const { // This should not be called for imported targets. // TODO: Split cmTarget into a class hierarchy to get compile-time @@ -3804,7 +3811,7 @@ void cmTarget::SetPropertyDefault(const std::string& property, } //---------------------------------------------------------------------------- -bool cmTarget::HaveBuildTreeRPATH(const char *config) const +bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const { if (this->GetPropertyAsBool("SKIP_BUILD_RPATH")) { @@ -3824,7 +3831,7 @@ bool cmTarget::HaveInstallTreeRPATH() const } //---------------------------------------------------------------------------- -bool cmTarget::NeedRelinkBeforeInstall(const char* config) const +bool cmTarget::NeedRelinkBeforeInstall(const std::string& config) const { // Only executables and shared libraries can have an rpath and may // need relinking. @@ -3888,7 +3895,8 @@ bool cmTarget::NeedRelinkBeforeInstall(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetInstallNameDirForBuildTree(const char* config) const +std::string cmTarget::GetInstallNameDirForBuildTree( + const std::string& config) const { // If building directly for installation then the build tree install_name // is the same as the install tree. @@ -4010,10 +4018,11 @@ const char* cmTarget::GetOutputTargetType(bool implib) const } //---------------------------------------------------------------------------- -bool cmTarget::ComputeOutputDir(const char* config, +bool cmTarget::ComputeOutputDir(const std::string& config, bool implib, std::string& out) const { bool usesDefaultOutputDir = false; + std::string conf = config; // Look for a target property defining the target output directory // based on the target type. @@ -4027,7 +4036,7 @@ bool cmTarget::ComputeOutputDir(const char* config, } // Check for a per-configuration output directory target property. - std::string configUpper = cmSystemTools::UpperCase(config? config : ""); + std::string configUpper = cmSystemTools::UpperCase(conf); const char* configProp = 0; std::string configPropStr = targetTypeName; if(!configPropStr.empty()) @@ -4044,7 +4053,7 @@ bool cmTarget::ComputeOutputDir(const char* config, out = config_outdir; // Skip per-configuration subdirectory. - config = 0; + conf = ""; } else if(const char* outdir = this->GetProperty(propertyName)) { @@ -4077,21 +4086,21 @@ bool cmTarget::ComputeOutputDir(const char* config, (out.c_str(), this->Makefile->GetStartOutputDirectory())); // The generator may add the configuration's subdirectory. - if(config && *config) + if(!conf.empty()) { const char *platforms = this->Makefile->GetDefinition( "CMAKE_XCODE_EFFECTIVE_PLATFORMS"); std::string suffix = usesDefaultOutputDir && platforms ? "$(EFFECTIVE_PLATFORM_NAME)" : ""; this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> - AppendDirectoryForConfig("/", config, suffix.c_str(), out); + AppendDirectoryForConfig("/", conf, suffix.c_str(), out); } return usesDefaultOutputDir; } //---------------------------------------------------------------------------- -bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config, +bool cmTarget::ComputePDBOutputDir(const char* kind, const std::string& config, std::string& out) const { // Look for a target property defining the target output directory @@ -4103,9 +4112,10 @@ bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config, propertyNameStr += "_OUTPUT_DIRECTORY"; propertyName = propertyNameStr.c_str(); } + std::string conf = config; // Check for a per-configuration output directory target property. - std::string configUpper = cmSystemTools::UpperCase(config? config : ""); + std::string configUpper = cmSystemTools::UpperCase(conf); const char* configProp = 0; std::string configPropStr = kind; if(!configPropStr.empty()) @@ -4122,7 +4132,7 @@ bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config, out = config_outdir; // Skip per-configuration subdirectory. - config = 0; + conf = ""; } else if(const char* outdir = this->GetProperty(propertyName)) { @@ -4141,27 +4151,29 @@ bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config, (out.c_str(), this->Makefile->GetStartOutputDirectory())); // The generator may add the configuration's subdirectory. - if(config && *config) + if(!conf.empty()) { this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> - AppendDirectoryForConfig("/", config, "", out); + AppendDirectoryForConfig("/", conf, "", out); } return true; } //---------------------------------------------------------------------------- -bool cmTarget::UsesDefaultOutputDir(const char* config, bool implib) const +bool cmTarget::UsesDefaultOutputDir(const std::string& config, + bool implib) const { std::string dir; return this->ComputeOutputDir(config, implib, dir); } //---------------------------------------------------------------------------- -std::string cmTarget::GetOutputName(const char* config, bool implib) const +std::string cmTarget::GetOutputName(const std::string& config, + bool implib) const { std::vector props; std::string type = this->GetOutputTargetType(implib); - std::string configUpper = cmSystemTools::UpperCase(config? config : ""); + std::string configUpper = cmSystemTools::UpperCase(config); if(!type.empty() && !configUpper.empty()) { // _OUTPUT_NAME_ @@ -4495,7 +4507,7 @@ std::string compatibilityAgree(CompatibleType t, bool dominant) template PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, const std::string &p, - const char *config, + const std::string& config, const char *defaultValue, CompatibleType t, PropertyType *) @@ -4679,7 +4691,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, //---------------------------------------------------------------------------- bool cmTarget::GetLinkInterfaceDependentBoolProperty(const std::string &p, - const char *config) const + const std::string& config) const { return checkInterfacePropertyCompatibility(this, p, config, "FALSE", BoolType, 0); @@ -4687,8 +4699,8 @@ bool cmTarget::GetLinkInterfaceDependentBoolProperty(const std::string &p, //---------------------------------------------------------------------------- const char * cmTarget::GetLinkInterfaceDependentStringProperty( - const std::string &p, - const char *config) const + const std::string &p, + const std::string& config) const { return checkInterfacePropertyCompatibility(this, p, @@ -4699,8 +4711,8 @@ const char * cmTarget::GetLinkInterfaceDependentStringProperty( //---------------------------------------------------------------------------- const char * cmTarget::GetLinkInterfaceDependentNumberMinProperty( - const std::string &p, - const char *config) const + const std::string &p, + const std::string& config) const { return checkInterfacePropertyCompatibility(this, p, @@ -4711,8 +4723,8 @@ const char * cmTarget::GetLinkInterfaceDependentNumberMinProperty( //---------------------------------------------------------------------------- const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty( - const std::string &p, - const char *config) const + const std::string &p, + const std::string& config) const { return checkInterfacePropertyCompatibility(this, p, @@ -4724,7 +4736,7 @@ const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty( //---------------------------------------------------------------------------- bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p, const std::string& interfaceProperty, - const char *config) + const std::string& config) { std::vector deps; tgt->GetTransitiveTargetClosure(config, tgt, deps); @@ -4762,7 +4774,7 @@ bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p, //---------------------------------------------------------------------------- bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p, - const char *config) const + const std::string& config) const { if (this->TargetTypeValue == OBJECT_LIBRARY || this->TargetTypeValue == INTERFACE_LIBRARY) @@ -4776,7 +4788,7 @@ bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p, //---------------------------------------------------------------------------- bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p, - const char *config) const + const std::string& config) const { if (this->TargetTypeValue == OBJECT_LIBRARY || this->TargetTypeValue == INTERFACE_LIBRARY) @@ -4790,7 +4802,7 @@ bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p, //---------------------------------------------------------------------------- bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p, - const char *config) const + const std::string& config) const { if (this->TargetTypeValue == OBJECT_LIBRARY || this->TargetTypeValue == INTERFACE_LIBRARY) @@ -4803,7 +4815,7 @@ bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p, //---------------------------------------------------------------------------- bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p, - const char *config) const + const std::string& config) const { if (this->TargetTypeValue == OBJECT_LIBRARY || this->TargetTypeValue == INTERFACE_LIBRARY) @@ -4829,7 +4841,7 @@ void cmTarget::GetLanguages(std::set& languages) const } //---------------------------------------------------------------------------- -bool cmTarget::IsChrpathUsed(const char* config) const +bool cmTarget::IsChrpathUsed(const std::string& config) const { // Only certain target types have an rpath. if(!(this->GetType() == cmTarget::SHARED_LIBRARY || @@ -4897,7 +4909,8 @@ bool cmTarget::IsChrpathUsed(const char* config) const //---------------------------------------------------------------------------- cmTarget::ImportInfo const* -cmTarget::GetImportInfo(const char* config, cmTarget const* headTarget) const +cmTarget::GetImportInfo(const std::string& config, + cmTarget const* headTarget) const { // There is no imported information for non-imported targets. if(!this->IsImported()) @@ -4908,7 +4921,7 @@ cmTarget::GetImportInfo(const char* config, cmTarget const* headTarget) const // Lookup/compute/cache the import information for this // configuration. std::string config_upper; - if(config && *config) + if(!config.empty()) { config_upper = cmSystemTools::UpperCase(config); } @@ -5262,7 +5275,8 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, } //---------------------------------------------------------------------------- -cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config, +cmTarget::LinkInterface const* cmTarget::GetLinkInterface( + const std::string& config, cmTarget const* head) const { // Imported targets have their own link interface. @@ -5284,7 +5298,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config, } // Lookup any existing link interface for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : "")); + TargetConfigPair key(head, cmSystemTools::UpperCase(config)); cmTargetInternals::LinkInterfaceMapType::iterator i = this->Internal->LinkInterfaceMap.find(key); @@ -5315,7 +5329,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config, //---------------------------------------------------------------------------- cmTarget::LinkInterface const* -cmTarget::GetLinkInterfaceLibraries(const char* config, +cmTarget::GetLinkInterfaceLibraries(const std::string& config, cmTarget const* head) const { // Imported targets have their own link interface. @@ -5337,7 +5351,7 @@ cmTarget::GetLinkInterfaceLibraries(const char* config, } // Lookup any existing link interface for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : "")); + TargetConfigPair key(head, cmSystemTools::UpperCase(config)); cmTargetInternals::LinkInterfaceMapType::iterator i = this->Internal->LinkInterfaceMap.find(key); @@ -5359,7 +5373,7 @@ cmTarget::GetLinkInterfaceLibraries(const char* config, } //---------------------------------------------------------------------------- -void processILibs(const char* config, +void processILibs(const std::string& config, cmTarget const* headTarget, std::string const& name, std::vector& tgts, std::set& emitted) @@ -5387,7 +5401,7 @@ void processILibs(const char* config, } //---------------------------------------------------------------------------- -void cmTarget::GetTransitiveTargetClosure(const char* config, +void cmTarget::GetTransitiveTargetClosure(const std::string& config, cmTarget const* headTarget, std::vector &tgts) const { @@ -5404,7 +5418,7 @@ void cmTarget::GetTransitiveTargetClosure(const char* config, } //---------------------------------------------------------------------------- -void cmTarget::GetTransitivePropertyTargets(const char* config, +void cmTarget::GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, std::vector &tgts) const { @@ -5464,14 +5478,14 @@ void cmTarget::GetTransitivePropertyTargets(const char* config, } //---------------------------------------------------------------------------- -const char* cmTarget::ComputeLinkInterfaceLibraries(const char* config, +const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, LinkInterface& iface, cmTarget const* headTarget, bool &exists) const { // Construct the property name suffix for this configuration. std::string suffix = "_"; - if(config && *config) + if(!config.empty()) { suffix += cmSystemTools::UpperCase(config); } @@ -5642,7 +5656,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const char* config, //---------------------------------------------------------------------------- void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, - const char* config, + const std::string& config, OptionalLinkInterface& iface, cmTarget const* headTarget, const char* explicitLibraries) const @@ -5714,7 +5728,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { // Construct the property name suffix for this configuration. std::string suffix = "_"; - if(config && *config) + if(!config.empty()) { suffix += cmSystemTools::UpperCase(config); } @@ -5742,7 +5756,8 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, //---------------------------------------------------------------------------- cmTarget::LinkImplementation const* -cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const +cmTarget::GetLinkImplementation(const std::string& config, + cmTarget const* head) const { // There is no link implementation for imported targets. if(this->IsImported()) @@ -5751,7 +5766,7 @@ cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const } // Lookup any existing link implementation for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : "")); + TargetConfigPair key(head, cmSystemTools::UpperCase(config)); cmTargetInternals::LinkImplMapType::iterator i = this->Internal->LinkImplMap.find(key); @@ -5776,7 +5791,7 @@ cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const //---------------------------------------------------------------------------- cmTarget::LinkImplementation const* -cmTarget::GetLinkImplementationLibraries(const char* config, +cmTarget::GetLinkImplementationLibraries(const std::string& config, cmTarget const* head) const { // There is no link implementation for imported targets. @@ -5786,7 +5801,7 @@ cmTarget::GetLinkImplementationLibraries(const char* config, } // Lookup any existing link implementation for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : "")); + TargetConfigPair key(head, cmSystemTools::UpperCase(config)); cmTargetInternals::LinkImplMapType::iterator i = this->Internal->LinkImplMap.find(key); @@ -5805,7 +5820,7 @@ cmTarget::GetLinkImplementationLibraries(const char* config, } //---------------------------------------------------------------------------- -void cmTarget::ComputeLinkImplementation(const char* config, +void cmTarget::ComputeLinkImplementation(const std::string& config, LinkImplementation& impl, cmTarget const* head) const { @@ -5970,14 +5985,14 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const template PropertyType getLinkInterfaceDependentProperty(cmTarget const* tgt, const std::string& prop, - const char *config, + const std::string& config, CompatibleType, PropertyType *); template<> bool getLinkInterfaceDependentProperty(cmTarget const* tgt, const std::string& prop, - const char *config, + const std::string& config, CompatibleType, bool *) { return tgt->GetLinkInterfaceDependentBoolProperty(prop, config); @@ -5986,7 +6001,7 @@ bool getLinkInterfaceDependentProperty(cmTarget const* tgt, template<> const char * getLinkInterfaceDependentProperty(cmTarget const* tgt, const std::string& prop, - const char *config, + const std::string& config, CompatibleType t, const char **) { @@ -6012,7 +6027,7 @@ void checkPropertyConsistency(cmTarget const* depender, cmTarget const* dependee, const std::string& propName, std::set &emitted, - const char *config, + const std::string& config, CompatibleType t, PropertyType *) { @@ -6101,7 +6116,7 @@ static std::string intersect(const std::set &s1, //---------------------------------------------------------------------------- void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, - const char* config) const + const std::string& config) const { const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); @@ -6205,12 +6220,12 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, //---------------------------------------------------------------------------- cmComputeLinkInformation* -cmTarget::GetLinkInformation(const char* config, cmTarget const* head) const +cmTarget::GetLinkInformation(const std::string& config, + cmTarget const* head) const { cmTarget const* headTarget = head ? head : this; // Lookup any existing information for this configuration. - TargetConfigPair key(headTarget, - cmSystemTools::UpperCase(config?config:"")); + TargetConfigPair key(headTarget, cmSystemTools::UpperCase(config)); cmTargetLinkInformationMap::iterator i = this->LinkInformation.find(key); if(i == this->LinkInformation.end()) @@ -6237,7 +6252,7 @@ cmTarget::GetLinkInformation(const char* config, cmTarget const* head) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetFrameworkDirectory(const char* config, +std::string cmTarget::GetFrameworkDirectory(const std::string& config, bool rootDir) const { std::string fpath; @@ -6252,7 +6267,7 @@ std::string cmTarget::GetFrameworkDirectory(const char* config, } //---------------------------------------------------------------------------- -std::string cmTarget::GetCFBundleDirectory(const char* config, +std::string cmTarget::GetCFBundleDirectory(const std::string& config, bool contentOnly) const { std::string fpath; @@ -6271,7 +6286,7 @@ std::string cmTarget::GetCFBundleDirectory(const char* config, } //---------------------------------------------------------------------------- -std::string cmTarget::GetAppBundleDirectory(const char* config, +std::string cmTarget::GetAppBundleDirectory(const std::string& config, bool contentOnly) const { std::string fpath = this->GetFullName(config, false); @@ -6283,7 +6298,7 @@ std::string cmTarget::GetAppBundleDirectory(const char* config, //---------------------------------------------------------------------------- std::string cmTarget::BuildMacContentDirectory(const std::string& base, - const char* config, + const std::string& config, bool contentOnly) const { std::string fpath = base; @@ -6303,7 +6318,7 @@ std::string cmTarget::BuildMacContentDirectory(const std::string& base, } //---------------------------------------------------------------------------- -std::string cmTarget::GetMacContentDirectory(const char* config, +std::string cmTarget::GetMacContentDirectory(const std::string& config, bool implib) const { // Start with the output directory for the target. diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 41f84a6..65fbb0f 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -155,15 +155,15 @@ public: return this->LinkLibraries;} const LinkLibraryVectorType &GetOriginalLinkLibraries() const {return this->OriginalLinkLibraries;} - void GetDirectLinkLibraries(const char *config, + void GetDirectLinkLibraries(const std::string& config, std::vector &, cmTarget const* head) const; - void GetInterfaceLinkLibraries(const char *config, + void GetInterfaceLinkLibraries(const std::string& config, std::vector &, cmTarget const* head) const; /** Compute the link type to use for the given configuration. */ - LinkLibraryType ComputeLinkType(const char* config) const; + LinkLibraryType ComputeLinkType(const std::string& config) const; /** * Clear the dependency information recorded for this target, if any. @@ -232,7 +232,8 @@ public: 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 std::string& config) const; bool IsImported() const {return this->IsImportedTarget;} @@ -264,14 +265,14 @@ public: /** Get the link interface for the given configuration. Returns 0 if the target cannot be linked. */ - LinkInterface const* GetLinkInterface(const char* config, + LinkInterface const* GetLinkInterface(const std::string& config, cmTarget const* headTarget) const; - LinkInterface const* GetLinkInterfaceLibraries(const char* config, + LinkInterface const* GetLinkInterfaceLibraries(const std::string& config, cmTarget const* headTarget) const; - void GetTransitivePropertyTargets(const char* config, + void GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, std::vector &libs) const; - void GetTransitiveTargetClosure(const char* config, + void GetTransitiveTargetClosure(const std::string& config, cmTarget const* headTarget, std::vector &libs) const; @@ -289,10 +290,11 @@ public: // Needed only for OLD behavior of CMP0003. std::vector WrongConfigLibraries; }; - LinkImplementation const* GetLinkImplementation(const char* config, + LinkImplementation const* GetLinkImplementation(const std::string& config, cmTarget const* head) const; - LinkImplementation const* GetLinkImplementationLibraries(const char* config, + LinkImplementation const* GetLinkImplementationLibraries( + const std::string& config, cmTarget const* head) const; /** Link information from the transitive closure of the link @@ -305,7 +307,7 @@ public: // Languages whose runtime libraries must be linked. std::vector Languages; }; - LinkClosure const* GetLinkClosure(const char* config, + LinkClosure const* GetLinkClosure(const std::string& config, cmTarget const* head) const; /** Strip off leading and trailing whitespace from an item named in @@ -316,23 +318,24 @@ public: configuration name is given then the generator will add its subdirectory for that configuration. Otherwise just the canonical output directory is given. */ - std::string GetDirectory(const char* config = 0, bool implib = false) const; + std::string GetDirectory(const std::string& config = "", + bool implib = false) const; /** Get the directory in which this targets .pdb files will be placed. If the configuration name is given then the generator will add its subdirectory for that configuration. Otherwise just the canonical pdb output directory is given. */ - std::string GetPDBDirectory(const char* config) const; + std::string GetPDBDirectory(const std::string& config) const; /** Get the directory in which to place the target compiler .pdb file. If the configuration name is given then the generator will add its subdirectory for that configuration. Otherwise just the canonical compiler pdb output directory is given. */ - std::string GetCompilePDBDirectory(const char* config = 0) const; + std::string GetCompilePDBDirectory(const std::string& config = "") const; /** Get the location of the target in the build tree for the given configuration. */ - const char* GetLocation(const char* config) const; + const char* GetLocation(const std::string& config) const; /** Get the location of the target in the build tree with a placeholder referencing the configuration in the native build system. This @@ -351,44 +354,46 @@ public: GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const; ///! Return the preferred linker language for this target - std::string GetLinkerLanguage(const char* config = 0, + std::string GetLinkerLanguage(const std::string& config = "", cmTarget const* head = 0) const; /** Get the full name of the target according to the settings in its makefile. */ - std::string GetFullName(const char* config=0, bool implib = false) const; + std::string GetFullName(const std::string& config="", + bool implib = false) const; void GetFullNameComponents(std::string& prefix, std::string& base, std::string& suffix, - const char* config=0, bool implib = false) const; + const std::string& config="", + bool implib = false) const; /** Get the name of the pdb file for the target. */ - std::string GetPDBName(const char* config) const; + std::string GetPDBName(const std::string& config) const; /** Get the name of the compiler pdb file for the target. */ - std::string GetCompilePDBName(const char* config=0) const; + std::string GetCompilePDBName(const std::string& config="") const; /** Get the path for the MSVC /Fd option for this target. */ - std::string GetCompilePDBPath(const char* config=0) const; + std::string GetCompilePDBPath(const std::string& config="") const; /** Whether this library has soname enabled and platform supports it. */ - bool HasSOName(const char* config) const; + bool HasSOName(const std::string& config) const; /** Get the soname of the target. Allowed only for a shared library. */ - std::string GetSOName(const char* config) const; + std::string GetSOName(const std::string& config) const; /** Whether this library has \@rpath and platform supports it. */ - bool HasMacOSXRpathInstallNameDir(const char* config) const; + bool HasMacOSXRpathInstallNameDir(const std::string& config) const; /** Whether this library defaults to \@rpath. */ bool MacOSXRpathInstallNameDirDefault() const; /** Test for special case of a third-party shared library that has no soname at all. */ - bool IsImportedSharedLibWithoutSOName(const char* config) const; + bool IsImportedSharedLibWithoutSOName(const std::string& config) const; /** Get the full path to the target according to the settings in its makefile and the configuration type. */ - std::string GetFullPath(const char* config=0, bool implib = false, + std::string GetFullPath(const std::string& config="", bool implib = false, bool realname = false) const; /** Get the names of the library needed to generate a build rule @@ -396,14 +401,15 @@ public: should be called only on a library target. */ void GetLibraryNames(std::string& name, std::string& soName, std::string& realName, std::string& impName, - std::string& pdbName, const char* config) const; + std::string& pdbName, const std::string& config) const; /** Get the names of the executable needed to generate a build rule that takes into account executable version numbers. This should be called only on an executable target. */ void GetExecutableNames(std::string& name, std::string& realName, std::string& impName, - std::string& pdbName, const char* config) const; + std::string& pdbName, + const std::string& config) const; /** Does this target have a GNU implib to convert to MS format? */ bool HasImplibGNUtoMS() const; @@ -416,24 +422,24 @@ public: /** * Compute whether this target must be relinked before installing. */ - bool NeedRelinkBeforeInstall(const char* config) const; + bool NeedRelinkBeforeInstall(const std::string& config) const; - bool HaveBuildTreeRPATH(const char *config) const; + bool HaveBuildTreeRPATH(const std::string& config) const; bool HaveInstallTreeRPATH() const; /** Return true if builtin chrpath will work for this target */ - bool IsChrpathUsed(const char* config) const; + bool IsChrpathUsed(const std::string& config) const; /** Return the install name directory for the target in the * build tree. For example: "\@rpath/", "\@loader_path/", * or "/full/path/to/library". */ - std::string GetInstallNameDirForBuildTree(const char* config) const; + std::string GetInstallNameDirForBuildTree(const std::string& config) const; /** Return the install name directory for the target in the * install tree. For example: "\@rpath/" or "\@loader_path/". */ std::string GetInstallNameDirForInstallTree() const; - cmComputeLinkInformation* GetLinkInformation(const char* config, + cmComputeLinkInformation* GetLinkInformation(const std::string& config, cmTarget const* head = 0) const; // Get the properties @@ -452,7 +458,7 @@ public: const char* GetExportMacro() const; void GetCompileDefinitions(std::vector &result, - const char *config) const; + const std::string& config) const; // Compute the set of languages compiled by the target. This is // computed every time it is called because the languages can change @@ -500,26 +506,29 @@ public: /** Return whether this target uses the default value for its output directory. */ - bool UsesDefaultOutputDir(const char* config, bool implib) const; + bool UsesDefaultOutputDir(const std::string& config, bool implib) const; /** @return the mac content directory for this target. */ - std::string GetMacContentDirectory(const char* config, + std::string GetMacContentDirectory(const std::string& config, bool implib) const; /** @return whether this target have a well defined output file name. */ bool HaveWellDefinedOutputFiles() const; /** @return the Mac framework directory without the base. */ - std::string GetFrameworkDirectory(const char* config, bool rootDir) const; + std::string GetFrameworkDirectory(const std::string& config, + bool rootDir) const; /** @return the Mac CFBundle directory without the base */ - std::string GetCFBundleDirectory(const char* config, bool contentOnly) const; + std::string GetCFBundleDirectory(const std::string& config, + bool contentOnly) const; /** @return the Mac App directory without the base */ - std::string GetAppBundleDirectory(const char* config, + std::string GetAppBundleDirectory(const std::string& config, bool contentOnly) const; - std::vector GetIncludeDirectories(const char *config) const; + std::vector GetIncludeDirectories( + const std::string& config) const; void InsertInclude(const cmValueWithOrigin &entry, bool before = false); void InsertCompileOption(const cmValueWithOrigin &entry, @@ -529,29 +538,29 @@ public: void AppendBuildInterfaceIncludes(); void GetCompileOptions(std::vector &result, - const char *config) const; + const std::string& config) const; void GetAutoUicOptions(std::vector &result, - const char *config) const; + const std::string& config) const; bool IsNullImpliedByLinkLibraries(const std::string &p) const; bool IsLinkInterfaceDependentBoolProperty(const std::string &p, - const char *config) const; + const std::string& config) const; bool IsLinkInterfaceDependentStringProperty(const std::string &p, - const char *config) const; + const std::string& config) const; bool IsLinkInterfaceDependentNumberMinProperty(const std::string &p, - const char *config) const; + const std::string& config) const; bool IsLinkInterfaceDependentNumberMaxProperty(const std::string &p, - const char *config) const; + const std::string& config) const; bool GetLinkInterfaceDependentBoolProperty(const std::string &p, - const char *config) const; + const std::string& config) const; const char *GetLinkInterfaceDependentStringProperty(const std::string &p, - const char *config) const; + const std::string& config) const; const char *GetLinkInterfaceDependentNumberMinProperty(const std::string &p, - const char *config) const; + const std::string& config) const; const char *GetLinkInterfaceDependentNumberMaxProperty(const std::string &p, - const char *config) const; + const std::string& config) const; std::string GetDebugGeneratorExpressions(const std::string &value, cmTarget::LinkLibraryType llt) const; @@ -631,8 +640,9 @@ private: const char* GetSuffixVariableInternal(bool implib) const; const char* GetPrefixVariableInternal(bool implib) const; - std::string GetFullNameInternal(const char* config, bool implib) const; - void GetFullNameInternal(const char* config, bool implib, + std::string GetFullNameInternal(const std::string& config, + bool implib) const; + void GetFullNameInternal(const std::string& config, bool implib, std::string& outPrefix, std::string& outBase, std::string& outSuffix) const; @@ -645,23 +655,25 @@ private: const char* GetOutputTargetType(bool implib) const; // Get the target base name. - std::string GetOutputName(const char* config, bool implib) const; + std::string GetOutputName(const std::string& config, bool implib) const; - std::string GetFullNameImported(const char* config, bool implib) const; + std::string GetFullNameImported(const std::string& config, + bool implib) const; - std::string ImportedGetFullPath(const char* config, bool implib) const; - std::string NormalGetFullPath(const char* config, bool implib, + std::string ImportedGetFullPath(const std::string& config, + bool implib) const; + std::string NormalGetFullPath(const std::string& config, bool implib, bool realname) const; /** Get the real name of the target. Allowed only for non-imported targets. When a library or executable file is versioned this is the full versioned name. If the target is not versioned this is the same as GetFullName. */ - std::string NormalGetRealName(const char* config) const; + std::string NormalGetRealName(const std::string& config) const; /** Append to @a base the mac content directory and return it. */ std::string BuildMacContentDirectory(const std::string& base, - const char* config, + const std::string& config, bool contentOnly) const; private: @@ -698,37 +710,38 @@ private: // Cache target output paths for each configuration. struct OutputInfo; - OutputInfo const* GetOutputInfo(const char* config) const; + OutputInfo const* GetOutputInfo(const std::string& config) const; bool - ComputeOutputDir(const char* config, bool implib, std::string& out) const; - bool ComputePDBOutputDir(const char* kind, const char* config, + ComputeOutputDir(const std::string& config, + bool implib, std::string& out) const; + bool ComputePDBOutputDir(const char* kind, const std::string& config, std::string& out) const; // Cache import information from properties for each configuration. struct ImportInfo; - ImportInfo const* GetImportInfo(const char* config, + ImportInfo const* GetImportInfo(const std::string& config, cmTarget const* workingTarget) const; void ComputeImportInfo(std::string const& desired_config, ImportInfo& info, cmTarget const* head) const; // Cache target compile paths for each configuration. struct CompileInfo; - CompileInfo const* GetCompileInfo(const char* config) const; + CompileInfo const* GetCompileInfo(const std::string& config) const; mutable cmTargetLinkInformationMap LinkInformation; void CheckPropertyCompatibility(cmComputeLinkInformation *info, - const char* config) const; + const std::string& config) const; - const char* ComputeLinkInterfaceLibraries(const char* config, + const char* ComputeLinkInterfaceLibraries(const std::string& config, LinkInterface& iface, cmTarget const* head, bool &exists) const; - void ComputeLinkImplementation(const char* config, + void ComputeLinkImplementation(const std::string& config, LinkImplementation& impl, cmTarget const* head) const; void ComputeLinkImplementationLanguages(LinkImplementation& impl) const; - void ComputeLinkClosure(const char* config, LinkClosure& lc, + void ComputeLinkClosure(const std::string& config, LinkClosure& lc, cmTarget const* head) const; void ClearLinkMaps(); diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 5dc3e60..a21e1aa 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -64,7 +64,7 @@ void cmTestGenerator::GenerateScriptActions(std::ostream& os, //---------------------------------------------------------------------------- void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, - const char* config, + const std::string& config, Indent const& indent) { this->TestGenerated = true; diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h index 2c69fc3..5446553 100644 --- a/Source/cmTestGenerator.h +++ b/Source/cmTestGenerator.h @@ -32,7 +32,7 @@ protected: virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); virtual void GenerateScriptForConfig(std::ostream& os, - const char* config, + const std::string& config, Indent const& indent); virtual void GenerateScriptNoConfig(std::ostream& os, Indent const& indent); virtual bool NeedsScriptNoConfig() const; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index aa721b7..90155b4 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -140,7 +140,7 @@ cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator() void cmVisualStudio10TargetGenerator::WritePlatformConfigTag( const char* tag, - const char* config, + const std::string& config, int indentLevel, const char* attribute, const char* end, diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 8d69254..02b951c 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -35,7 +35,7 @@ public: // used by cmVisualStudioGeneratorOptions void WritePlatformConfigTag( const char* tag, - const char* config, + const std::string& config, int indentLevel, const char* attribute = 0, const char* end = 0, diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 8eaf2aa..3a6528a 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -122,26 +122,18 @@ public: void CopyAttributes(cmXCodeObject* ); - void AddDependLibrary(const char* configName, + void AddDependLibrary(const std::string& configName, const std::string& l) { - if(!configName) - { - configName = ""; - } this->DependLibraries[configName].push_back(l); } std::map const& GetDependLibraries() { return this->DependLibraries; } - void AddDependTarget(const char* configName, + void AddDependTarget(const std::string& configName, const std::string& tName) { - if(!configName) - { - configName = ""; - } this->DependTargets[configName].push_back(tName); } std::map const& GetDependTargets() diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 603b6d0..047f09d 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -666,7 +666,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) else if (args[1] == "cmake_autogen" && args.size() >= 4) { cmQtAutoGenerators autogen; - const char *config = args[3].empty() ? 0 : args[3].c_str(); + std::string const& config = args[3]; bool autogenSuccess = autogen.Run(args[2].c_str(), config); return autogenSuccess ? 0 : 1; } -- cgit v0.12 From acb116e3b52362b41988aa27eeb593dd2e7194c0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 9 Feb 2014 23:07:44 -0500 Subject: stringapi: Return a string reference for the configuration --- Source/cmLocalNinjaGenerator.h | 4 ++-- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.h | 2 +- Source/cmSourceFileLocation.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 8b26806..2d870fb 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -55,8 +55,8 @@ public: const cmake* GetCMakeInstance() const; cmake* GetCMakeInstance(); - const char* GetConfigName() const - { return this->ConfigName.c_str(); } + std::string const& GetConfigName() const + { return this->ConfigName; } /// @return whether we are processing the top CMakeLists.txt file. bool isRootMakefile() const; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 1c43cb3..78ff4e4 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -91,7 +91,7 @@ cmGlobalNinjaGenerator* cmNinjaTargetGenerator::GetGlobalGenerator() const return this->LocalGenerator->GetGlobalNinjaGenerator(); } -const char* cmNinjaTargetGenerator::GetConfigName() const +std::string const& cmNinjaTargetGenerator::GetConfigName() const { return this->LocalGenerator->GetConfigName(); } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index b3b37a4..c2e1947 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -65,7 +65,7 @@ protected: cmMakefile* GetMakefile() const { return this->Makefile; } - const char* GetConfigName() const; + std::string const& GetConfigName() const; std::string LanguageCompilerRule(const std::string& lang) const { return lang + "_COMPILER"; } diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h index 64b8c1f..c83e8c0 100644 --- a/Source/cmSourceFileLocation.h +++ b/Source/cmSourceFileLocation.h @@ -76,7 +76,7 @@ public: * final name (but could be). Otherwise the returned name is the * final name. */ - const char* GetName() const { return this->Name.c_str(); } + const std::string& GetName() const { return this->Name; } /** * Get the cmMakefile instance for which the source file was created. -- cgit v0.12 From 3def29da3c16ad3a72f05ea8b97ee728e6e3581e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 9 Feb 2014 23:09:05 -0500 Subject: stringapi: Use strings for feature arguments --- Source/cmMakefile.cxx | 2 +- Source/cmMakefile.h | 3 ++- Source/cmMakefileTargetGenerator.cxx | 4 ++-- Source/cmMakefileTargetGenerator.h | 4 ++-- Source/cmNinjaTargetGenerator.cxx | 4 ++-- Source/cmNinjaTargetGenerator.h | 4 ++-- Source/cmTarget.cxx | 2 +- Source/cmTarget.h | 2 +- 8 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1ef4d46..bb88bc4 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3801,7 +3801,7 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const } //---------------------------------------------------------------------------- -const char* cmMakefile::GetFeature(const char* feature, +const char* cmMakefile::GetFeature(const std::string& feature, const std::string& config) { // TODO: Define accumulation policy for features (prepend, append, replace). diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 1c3ad73..7c82ec2 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -811,7 +811,8 @@ public: cmProperty::ScopeType scope) const; bool GetPropertyAsBool(const std::string& prop) const; - const char* GetFeature(const char* feature, const std::string& config); + const char* GetFeature(const std::string& feature, + const std::string& config); // Get the properties cmPropertyMap &GetProperties() { return this->Properties; }; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 1af5d6c..f0c9a3f 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -2105,13 +2105,13 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) } //---------------------------------------------------------------------------- -const char* cmMakefileTargetGenerator::GetFeature(const char* feature) +const char* cmMakefileTargetGenerator::GetFeature(const std::string& feature) { return this->Target->GetFeature(feature, this->ConfigName); } //---------------------------------------------------------------------------- -bool cmMakefileTargetGenerator::GetFeatureAsBool(const char* feature) +bool cmMakefileTargetGenerator::GetFeatureAsBool(const std::string& feature) { return cmSystemTools::IsOn(this->GetFeature(feature)); } diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 21eece4..573ce22 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -263,8 +263,8 @@ protected: void AddFeatureFlags(std::string& flags, const std::string& lang); // Feature query methods. - const char* GetFeature(const char* feature); - bool GetFeatureAsBool(const char* feature); + const char* GetFeature(const std::string& feature); + bool GetFeatureAsBool(const std::string& feature); //================================================================== // Convenience routines that do nothing more than forward to diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 78ff4e4..3ef236a 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -97,13 +97,13 @@ std::string const& cmNinjaTargetGenerator::GetConfigName() const } // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. -const char* cmNinjaTargetGenerator::GetFeature(const char* feature) +const char* cmNinjaTargetGenerator::GetFeature(const std::string& feature) { return this->Target->GetFeature(feature, this->GetConfigName()); } // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. -bool cmNinjaTargetGenerator::GetFeatureAsBool(const char* feature) +bool cmNinjaTargetGenerator::GetFeatureAsBool(const std::string& feature) { return cmSystemTools::IsOn(this->GetFeature(feature)); } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index c2e1947..e66e55f 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -70,8 +70,8 @@ protected: std::string LanguageCompilerRule(const std::string& lang) const { return lang + "_COMPILER"; } - const char* GetFeature(const char* feature); - bool GetFeatureAsBool(const char* feature); + const char* GetFeature(const std::string& feature); + bool GetFeatureAsBool(const std::string& feature); void AddFeatureFlags(std::string& flags, const std::string& lang); /** diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b8e662a..25ca168 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2549,7 +2549,7 @@ void cmTarget::GetTargetVersion(bool soversion, } //---------------------------------------------------------------------------- -const char* cmTarget::GetFeature(const char* feature, +const char* cmTarget::GetFeature(const std::string& feature, const std::string& config) const { if(!config.empty()) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 65fbb0f..15f00be 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -232,7 +232,7 @@ public: bool GetPropertyAsBool(const std::string& prop) const; void CheckProperty(const std::string& prop, cmMakefile* context) const; - const char* GetFeature(const char* feature, + const char* GetFeature(const std::string& feature, const std::string& config) const; bool IsImported() const {return this->IsImportedTarget;} -- cgit v0.12 From 2b17626e9b0ffbd5b3adf81e64aae975a35c8b6b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 14:43:19 -0500 Subject: stringapi: Pass strings as install directories in CPack --- Source/CPack/cmCPackGenerator.cxx | 18 +++++++++--------- Source/CPack/cmCPackGenerator.h | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 4c52c96..3e1bf3b 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -254,7 +254,7 @@ int cmCPackGenerator::InstallProject() // If the project is a CMAKE project then run pre-install // and then read the cmake_install script to run it if ( !this->InstallProjectViaInstallCMakeProjects( - setDestDir, bareTempInstallDirectory.c_str()) ) + setDestDir, bareTempInstallDirectory) ) { return 0; } @@ -269,7 +269,7 @@ int cmCPackGenerator::InstallProject() //---------------------------------------------------------------------- int cmCPackGenerator::InstallProjectViaInstallCommands( - bool setDestDir, const char* tempInstallDirectory) + bool setDestDir, const std::string& tempInstallDirectory) { (void) setDestDir; const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS"); @@ -312,7 +312,7 @@ int cmCPackGenerator::InstallProjectViaInstallCommands( //---------------------------------------------------------------------- int cmCPackGenerator::InstallProjectViaInstalledDirectories( - bool setDestDir, const char* tempInstallDirectory) + bool setDestDir, const std::string& tempInstallDirectory) { (void)setDestDir; (void)tempInstallDirectory; @@ -349,7 +349,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( return 0; } std::vector::iterator it; - const char* tempDir = tempInstallDirectory; + const std::string& tempDir = tempInstallDirectory; for ( it = installDirectoriesVector.begin(); it != installDirectoriesVector.end(); ++it ) @@ -457,7 +457,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( //---------------------------------------------------------------------- int cmCPackGenerator::InstallProjectViaInstallScript( - bool setDestDir, const char* tempInstallDirectory) + bool setDestDir, const std::string& tempInstallDirectory) { const char* cmakeScripts = this->GetOption("CPACK_INSTALL_SCRIPT"); @@ -499,7 +499,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript( } else { - this->SetOption("CMAKE_INSTALL_PREFIX", tempInstallDirectory); + this->SetOption("CMAKE_INSTALL_PREFIX", tempInstallDirectory.c_str()); cmCPackLogger(cmCPackLog::LOG_DEBUG, "- Using non-DESTDIR install... (this->SetOption)" << std::endl); @@ -509,9 +509,9 @@ int cmCPackGenerator::InstallProjectViaInstallScript( } this->SetOptionIfNotSet("CMAKE_CURRENT_BINARY_DIR", - tempInstallDirectory); + tempInstallDirectory.c_str()); this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR", - tempInstallDirectory); + tempInstallDirectory.c_str()); int res = this->MakefileMap->ReadListFile(0, installScript.c_str()); if ( cmSystemTools::GetErrorOccuredFlag() || !res ) { @@ -524,7 +524,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript( //---------------------------------------------------------------------- int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( - bool setDestDir, const char* baseTempInstallDirectory) + bool setDestDir, const std::string& baseTempInstallDirectory) { const char* cmakeProjects = this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS"); diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 7e7c94f..fadd1bf 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -190,13 +190,13 @@ protected: //! Run install commands if specified virtual int InstallProjectViaInstallCommands( - bool setDestDir, const char* tempInstallDirectory); + bool setDestDir, const std::string& tempInstallDirectory); virtual int InstallProjectViaInstallScript( - bool setDestDir, const char* tempInstallDirectory); + bool setDestDir, const std::string& tempInstallDirectory); virtual int InstallProjectViaInstalledDirectories( - bool setDestDir, const char* tempInstallDirectory); + bool setDestDir, const std::string& tempInstallDirectory); virtual int InstallProjectViaInstallCMakeProjects( - bool setDestDir, const char* tempInstallDirectory); + bool setDestDir, const std::string& tempInstallDirectory); /** * The various level of support of -- cgit v0.12 From 5af95c396dc780c04444f549b957c2cba7c75309 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 21 Feb 2014 18:42:53 -0500 Subject: typo: Match argument name with the header --- Source/cmGlobalGenerator.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 70cc16f..b7af21b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -988,13 +988,13 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l, } } -bool cmGlobalGenerator::IgnoreFile(const char* l) const +bool cmGlobalGenerator::IgnoreFile(const char* ext) const { - if(!this->GetLanguageFromExtension(l).empty()) + if(!this->GetLanguageFromExtension(ext).empty()) { return false; } - return (this->IgnoreExtensions.count(l) > 0); + return (this->IgnoreExtensions.count(ext) > 0); } bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const -- cgit v0.12 From b3bf31a5488a19ea3c357e346b882a2ca84c63b6 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 21 Feb 2014 19:05:55 -0500 Subject: stringapi: Miscellaneous char* parameters --- Source/CPack/WiX/cmWIXPatchParser.cxx | 12 ++++----- Source/CPack/WiX/cmWIXPatchParser.h | 4 +-- Source/CPack/cmCPackComponentGroup.cxx | 5 ++-- Source/CPack/cmCPackComponentGroup.h | 4 +-- Source/CPack/cmCPackGenerator.cxx | 2 +- Source/CPack/cmCPackGenerator.h | 2 +- Source/CPack/cmCPackOSXX11Generator.cxx | 2 +- Source/CPack/cmCPackOSXX11Generator.h | 2 +- Source/CPack/cmCPackPackageMakerGenerator.cxx | 15 +++++------ Source/CPack/cmCPackPackageMakerGenerator.h | 8 +++--- Source/CTest/cmCTestBZR.cxx | 36 +++++++++++++-------------- Source/CTest/cmCTestBuildCommand.cxx | 4 +-- Source/CTest/cmCTestHG.cxx | 22 ++++++++-------- Source/CTest/cmCTestMemCheckHandler.cxx | 18 +++++--------- Source/CTest/cmCTestSVN.cxx | 18 +++++++------- Source/CTest/cmCTestSubmitHandler.cxx | 14 +++++------ Source/CTest/cmParsePythonCoverage.cxx | 8 +++--- Source/CursesDialog/cmCursesOptionsWidget.cxx | 2 +- Source/CursesDialog/cmCursesOptionsWidget.h | 2 +- Source/CursesDialog/cmCursesStringWidget.cxx | 2 +- Source/CursesDialog/cmCursesStringWidget.h | 2 +- Source/CursesDialog/cmCursesWidget.cxx | 4 +-- Source/CursesDialog/cmCursesWidget.h | 2 +- Source/cmCacheManager.cxx | 4 +-- Source/cmCacheManager.h | 2 +- Source/cmExportFileGenerator.h | 2 +- Source/cmGlobalGenerator.cxx | 9 ++++--- Source/cmGlobalGenerator.h | 8 +++--- Source/cmGlobalVisualStudio6Generator.cxx | 4 +-- Source/cmGlobalVisualStudio6Generator.h | 4 +-- Source/cmGlobalVisualStudio7Generator.cxx | 6 ++--- Source/cmGlobalVisualStudio7Generator.h | 6 ++--- Source/cmGlobalXCodeGenerator.cxx | 14 +++++------ Source/cmGlobalXCodeGenerator.h | 4 +-- Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.h | 10 +++++--- Source/cmLocalVisualStudio10Generator.cxx | 8 +++--- Source/cmLocalVisualStudio10Generator.h | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 8 +++--- Source/cmLocalVisualStudio7Generator.h | 4 +-- Source/cmLocalVisualStudioGenerator.cxx | 4 +-- Source/cmLocalVisualStudioGenerator.h | 2 +- Source/cmTarget.cxx | 3 ++- Source/cmTarget.h | 2 +- Source/cmVisualStudioWCEPlatformParser.cxx | 20 +++++++-------- Source/cmVisualStudioWCEPlatformParser.h | 4 +-- Source/cmXCodeObject.h | 18 +++++++------- Source/cmXMLParser.cxx | 4 +-- Source/cmXMLParser.h | 4 +-- 49 files changed, 173 insertions(+), 175 deletions(-) diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index 10af1f6..ef67b23 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -34,12 +34,11 @@ cmWIXPatchParser::cmWIXPatchParser( } -void cmWIXPatchParser::StartElement(const char *name, const char **atts) +void cmWIXPatchParser::StartElement(const std::string& name, const char **atts) { - std::string name_str = name; if(State == BEGIN_DOCUMENT) { - if(name_str == "CPackWiXPatch") + if(name == "CPackWiXPatch") { State = BEGIN_FRAGMENTS; } @@ -50,7 +49,7 @@ void cmWIXPatchParser::StartElement(const char *name, const char **atts) } else if(State == BEGIN_FRAGMENTS) { - if(name_str == "CPackWiXFragment") + if(name == "CPackWiXFragment") { State = INSIDE_FRAGMENT; StartFragment(atts); @@ -107,12 +106,11 @@ void cmWIXPatchParser::StartFragment(const char **attributes) } } -void cmWIXPatchParser::EndElement(const char *name) +void cmWIXPatchParser::EndElement(const std::string& name) { - std::string name_str = name; if(State == INSIDE_FRAGMENT) { - if(name_str == "CPackWiXFragment") + if(name == "CPackWiXFragment") { State = BEGIN_FRAGMENTS; ElementStack.clear(); diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h index da3adf5..acfb4c0 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.h +++ b/Source/CPack/WiX/cmWIXPatchParser.h @@ -43,11 +43,11 @@ public: cmWIXPatchParser(fragment_map_t& Fragments, cmCPackLog* logger); private: - virtual void StartElement(const char *name, const char **atts); + virtual void StartElement(const std::string& name, const char **atts); void StartFragment(const char **attributes); - virtual void EndElement(const char *name); + virtual void EndElement(const std::string& name); virtual void ReportError(int line, int column, const char* msg); void ReportValidationError(std::string const& message); diff --git a/Source/CPack/cmCPackComponentGroup.cxx b/Source/CPack/cmCPackComponentGroup.cxx index f93eca8..77f11cb 100644 --- a/Source/CPack/cmCPackComponentGroup.cxx +++ b/Source/CPack/cmCPackComponentGroup.cxx @@ -16,7 +16,8 @@ #include //---------------------------------------------------------------------- -unsigned long cmCPackComponent::GetInstalledSize(const char* installDir) const +unsigned long cmCPackComponent::GetInstalledSize( + const std::string& installDir) const { if (this->TotalSize != 0) { @@ -37,7 +38,7 @@ unsigned long cmCPackComponent::GetInstalledSize(const char* installDir) const //---------------------------------------------------------------------- unsigned long -cmCPackComponent::GetInstalledSizeInKbytes(const char* installDir) const +cmCPackComponent::GetInstalledSizeInKbytes(const std::string& installDir) const { unsigned long result = (GetInstalledSize(installDir) + 512) / 1024; return result? result : 1; diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index abae372..0679638 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -94,11 +94,11 @@ public: /// Get the total installed size of all of the files in this /// component, in bytes. installDir is the directory into which the /// component was installed. - unsigned long GetInstalledSize(const char* installDir) const; + unsigned long GetInstalledSize(const std::string& installDir) const; /// Identical to GetInstalledSize, but returns the result in /// kilobytes. - unsigned long GetInstalledSizeInKbytes(const char* installDir) const; + unsigned long GetInstalledSizeInKbytes(const std::string& installDir) const; private: mutable unsigned long TotalSize; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 3e1bf3b..a8e104b 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1139,7 +1139,7 @@ int cmCPackGenerator::DoPackage() } //---------------------------------------------------------------------- -int cmCPackGenerator::Initialize(const char* name, cmMakefile* mf) +int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf) { this->MakefileMap = mf; this->Name = name; diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index fadd1bf..efd3bef 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -90,7 +90,7 @@ public: /** * Initialize generator */ - int Initialize(const char* name, cmMakefile* mf); + int Initialize(const std::string& name, cmMakefile* mf); /** * Construct generator diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 95ffab5..28c7f1d 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -272,7 +272,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name) //---------------------------------------------------------------------- bool cmCPackOSXX11Generator::CopyResourcePlistFile(const std::string& name, - const char* dir, const char* outputFileName /* = 0 */, + const std::string& dir, const char* outputFileName /* = 0 */, bool copyOnly /* = false */) { std::string inFName = "CPack."; diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h index 7a93f5a..9d0a6d1 100644 --- a/Source/CPack/cmCPackOSXX11Generator.h +++ b/Source/CPack/cmCPackOSXX11Generator.h @@ -39,7 +39,7 @@ protected: //bool CopyCreateResourceFile(const std::string& name, // const std::string& dir); - bool CopyResourcePlistFile(const std::string& name, const char* dir, + bool CopyResourcePlistFile(const std::string& name, const std::string& dir, const char* outputFileName = 0, bool copyOnly = false); std::string InstallPrefix; }; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 69886a1..d736948 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -43,14 +43,14 @@ bool cmCPackPackageMakerGenerator::SupportsComponentInstallation() const } //---------------------------------------------------------------------- -int cmCPackPackageMakerGenerator::CopyInstallScript(const char* resdir, - const char* script, - const char* name) +int cmCPackPackageMakerGenerator::CopyInstallScript(const std::string& resdir, + const std::string& script, + const std::string& name) { std::string dst = resdir; dst += "/"; dst += name; - cmSystemTools::CopyFileAlways(script, dst.c_str()); + cmSystemTools::CopyFileAlways(script.c_str(), dst.c_str()); cmSystemTools::SetPermissions(dst.c_str(),0777); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "copy script : " << script << "\ninto " << dst.c_str() << @@ -601,12 +601,13 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile( return true; } -bool cmCPackPackageMakerGenerator::CopyResourcePlistFile(const char* name, - const char* outName) +bool cmCPackPackageMakerGenerator::CopyResourcePlistFile( + const std::string& name, + const char* outName) { if (!outName) { - outName = name; + outName = name.c_str(); } std::string inFName = "CPack."; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h index bebb633..e350a60 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.h +++ b/Source/CPack/cmCPackPackageMakerGenerator.h @@ -38,9 +38,9 @@ public: virtual bool SupportsComponentInstallation() const; protected: - int CopyInstallScript(const char* resdir, - const char* script, - const char* name); + int CopyInstallScript(const std::string& resdir, + const std::string& script, + const std::string& name); virtual int InitializeInternal(); int PackageFiles(); virtual const char* GetOutputExtension() { return ".dmg"; } @@ -53,7 +53,7 @@ protected: // which will be configured via ConfigureFile. bool CopyCreateResourceFile(const std::string& name, const std::string& dirName); - bool CopyResourcePlistFile(const char* name, const char* outName = 0); + bool CopyResourcePlistFile(const std::string& name, const char* outName = 0); // Run PackageMaker with the given command line, which will (if // successful) produce the given package file. Returns true if diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 840ebc9..3014a93 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -225,35 +225,35 @@ private: return true; } - virtual void StartElement(const char* name, const char**) + virtual void StartElement(const std::string& name, const char**) { this->CData.clear(); - if(strcmp(name, "log") == 0) + if(name == "log") { this->Rev = Revision(); this->Changes.clear(); } // affected-files can contain blocks of // modified, unknown, renamed, kind-changed, removed, conflicts, added - else if(strcmp(name, "modified") == 0 - || strcmp(name, "renamed") == 0 - || strcmp(name, "kind-changed") == 0) + else if(name == "modified" + || name == "renamed" + || name == "kind-changed") { this->CurChange = Change(); this->CurChange.Action = 'M'; } - else if(strcmp(name, "added") == 0) + else if(name == "added") { this->CurChange = Change(); this->CurChange = 'A'; } - else if(strcmp(name, "removed") == 0) + else if(name == "removed") { this->CurChange = Change(); this->CurChange = 'D'; } - else if(strcmp(name, "unknown") == 0 - || strcmp(name, "conflicts") == 0) + else if(name == "unknown" + || name == "conflicts") { // Should not happen here this->CurChange = Change(); @@ -265,27 +265,27 @@ private: this->CData.insert(this->CData.end(), data, data+length); } - virtual void EndElement(const char* name) + virtual void EndElement(const std::string& name) { - if(strcmp(name, "log") == 0) + if(name == "log") { this->BZR->DoRevision(this->Rev, this->Changes); } - else if((strcmp(name, "file") == 0 || strcmp(name, "directory") == 0) - && !this->CData.empty()) + else if(!this->CData.empty() && + (name == "file" || name == "directory")) { this->CurChange.Path.assign(&this->CData[0], this->CData.size()); cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path); this->Changes.push_back(this->CurChange); } - else if(strcmp(name, "symlink") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "symlink") { // symlinks have an arobase at the end in the log this->CurChange.Path.assign(&this->CData[0], this->CData.size()-1); cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path); this->Changes.push_back(this->CurChange); } - else if(strcmp(name, "committer") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "committer") { this->Rev.Author.assign(&this->CData[0], this->CData.size()); if(this->EmailRegex.find(this->Rev.Author)) @@ -294,15 +294,15 @@ private: this->Rev.EMail = this->EmailRegex.match(2); } } - else if(strcmp(name, "timestamp") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "timestamp") { this->Rev.Date.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "message") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "message") { this->Rev.Log.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "revno") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "revno") { this->Rev.Rev.assign(&this->CData[0], this->CData.size()); } diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 9738bde..c60ded0 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -131,8 +131,8 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() std::string buildCommand = this->GlobalGenerator-> GenerateCMakeBuildCommand(cmakeBuildTarget ? cmakeBuildTarget : "", - cmakeBuildConfiguration, - cmakeBuildAdditionalFlags, true); + cmakeBuildConfiguration, + cmakeBuildAdditionalFlags ? cmakeBuildAdditionalFlags : "", true); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SetMakeCommand:" << buildCommand.c_str() << "\n"); diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index 5bf9949..0f79d68 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -189,10 +189,10 @@ private: return true; } - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { this->CData.clear(); - if(strcmp(name, "logentry") == 0) + if(name == "logentry") { this->Rev = Revision(); if(const char* rev = this->FindAttribute(atts, "revision")) @@ -208,29 +208,29 @@ private: this->CData.insert(this->CData.end(), data, data+length); } - virtual void EndElement(const char* name) + virtual void EndElement(const std::string& name) { - if(strcmp(name, "logentry") == 0) + if(name == "logentry") { this->HG->DoRevision(this->Rev, this->Changes); } - else if(strcmp(name, "author") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "author") { this->Rev.Author.assign(&this->CData[0], this->CData.size()); } - else if ( strcmp(name, "email") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "email") { this->Rev.EMail.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "date") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "date") { this->Rev.Date.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "msg") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "msg") { this->Rev.Log.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "files") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "files") { std::vector paths = this->SplitCData(); for(unsigned int i = 0; i < paths.size(); ++i) @@ -242,7 +242,7 @@ private: this->Changes.push_back(this->CurChange); } } - else if(strcmp(name, "file_adds") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "file_adds") { std::string added_paths(this->CData.begin(), this->CData.end()); for(unsigned int i = 0; i < this->Changes.size(); ++i) @@ -253,7 +253,7 @@ private: } } } - else if(strcmp(name, "file_dels") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "file_dels") { std::string added_paths(this->CData.begin(), this->CData.end()); for(unsigned int i = 0; i < this->Changes.size(); ++i) diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index f2982a4..f27dbc0 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -49,21 +49,15 @@ class cmBoundsCheckerParser : public cmXMLParser { public: cmBoundsCheckerParser(cmCTest* c) { this->CTest = c;} - void StartElement(const char* name, const char** atts) + void StartElement(const std::string& name, const char** atts) { - if(strcmp(name, "MemoryLeak") == 0) + if(name == "MemoryLeak" || + name == "ResourceLeak") { this->Errors.push_back(cmCTestMemCheckHandler::MLK); } - if(strcmp(name, "ResourceLeak") == 0) - { - this->Errors.push_back(cmCTestMemCheckHandler::MLK); - } - if(strcmp(name, "Error") == 0) - { - this->ParseError(atts); - } - if(strcmp(name, "Dangling Pointer") == 0) + else if(name == "Error" || + name == "Dangling Pointer") { this->ParseError(atts); } @@ -79,7 +73,7 @@ public: ostr << "\n"; this->Log += ostr.str(); } - void EndElement(const char* ) + void EndElement(const std::string& ) { } diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 89592dd..86dc2f2 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -361,10 +361,10 @@ private: return true; } - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { this->CData.clear(); - if(strcmp(name, "logentry") == 0) + if(name == "logentry") { this->Rev = Revision(); this->Rev.SVNInfo = &SVNRepo; @@ -374,7 +374,7 @@ private: } this->Changes.clear(); } - else if(strcmp(name, "path") == 0) + else if(name == "path") { this->CurChange = Change(); if(const char* action = this->FindAttribute(atts, "action")) @@ -389,28 +389,28 @@ private: this->CData.insert(this->CData.end(), data, data+length); } - virtual void EndElement(const char* name) + virtual void EndElement(const std::string& name) { - if(strcmp(name, "logentry") == 0) + if(name == "logentry") { this->SVN->DoRevisionSVN(this->Rev, this->Changes); } - else if(strcmp(name, "path") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "path") { std::string orig_path(&this->CData[0], this->CData.size()); std::string new_path = SVNRepo.BuildLocalPath( orig_path ); this->CurChange.Path.assign(new_path); this->Changes.push_back(this->CurChange); } - else if(strcmp(name, "author") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "author") { this->Rev.Author.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "date") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "date") { this->Rev.Date.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "msg") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "msg") { this->Rev.Log.assign(&this->CData[0], this->CData.size()); } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 1cd8fc7..3173f15 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -68,10 +68,10 @@ private: return val; } - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { this->CurrentValue.clear(); - if(strcmp(name, "cdash") == 0) + if(name == "cdash") { this->CDashVersion = this->FindAttribute(atts, "version"); } @@ -82,9 +82,9 @@ private: this->CurrentValue.insert(this->CurrentValue.end(), data, data+length); } - virtual void EndElement(const char* name) + virtual void EndElement(const std::string& name) { - if(strcmp(name, "status") == 0) + if(name == "status") { std::string status = cmSystemTools::UpperCase(this->GetCurrentValue()); if(status == "OK" || status == "SUCCESS") @@ -100,15 +100,15 @@ private: this->Status = STATUS_ERROR; } } - else if(strcmp(name, "filename") == 0) + else if(name == "filename") { this->Filename = this->GetCurrentValue(); } - else if(strcmp(name, "md5") == 0) + else if(name == "md5") { this->MD5 = this->GetCurrentValue(); } - else if(strcmp(name, "message") == 0) + else if(name == "message") { this->Message = this->GetCurrentValue(); } diff --git a/Source/CTest/cmParsePythonCoverage.cxx b/Source/CTest/cmParsePythonCoverage.cxx index 38a770a..2578bb8 100644 --- a/Source/CTest/cmParsePythonCoverage.cxx +++ b/Source/CTest/cmParsePythonCoverage.cxx @@ -20,9 +20,9 @@ public: protected: - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { - if(strcmp(name, "class") == 0) + if(name == "class") { int tagCount = 0; while(true) @@ -57,7 +57,7 @@ protected: ++tagCount; } } - else if(strcmp(name, "line") == 0) + else if(name == "line") { int tagCount = 0; int curNumber = -1; @@ -85,7 +85,7 @@ protected: } } - virtual void EndElement(const char*) {} + virtual void EndElement(const std::string&) {} private: diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index 652b2df..aa680fb 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -89,7 +89,7 @@ void cmCursesOptionsWidget::PreviousOption() this->SetValue(this->Options[this->CurrentOption].c_str()); } -void cmCursesOptionsWidget::SetOption(const char* value) +void cmCursesOptionsWidget::SetOption(const std::string& value) { this->CurrentOption = 0; // default to 0 index this->SetValue(value); diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h index b52ac9d..5cee489 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.h +++ b/Source/CursesDialog/cmCursesOptionsWidget.h @@ -25,7 +25,7 @@ public: // when this widget has focus. Returns true if the input was // handled. virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w); - void SetOption(const char*); + void SetOption(const std::string&); void AddOption(std::string const &); void NextOption(); void PreviousOption(); diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index bd1ff71..d25022d 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -195,7 +195,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, return true; } -void cmCursesStringWidget::SetString(const char* value) +void cmCursesStringWidget::SetString(const std::string& value) { this->SetValue(value); } diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h index e939049..dd8c02a 100644 --- a/Source/CursesDialog/cmCursesStringWidget.h +++ b/Source/CursesDialog/cmCursesStringWidget.h @@ -37,7 +37,7 @@ public: /** * Set/Get the string. */ - void SetString(const char* value); + void SetString(const std::string& value); const char* GetString(); virtual const char* GetValue(); diff --git a/Source/CursesDialog/cmCursesWidget.cxx b/Source/CursesDialog/cmCursesWidget.cxx index 5dffcaa..e5363f4 100644 --- a/Source/CursesDialog/cmCursesWidget.cxx +++ b/Source/CursesDialog/cmCursesWidget.cxx @@ -46,10 +46,10 @@ void cmCursesWidget::Move(int x, int y, bool isNewPage) } } -void cmCursesWidget::SetValue(const char* value) +void cmCursesWidget::SetValue(const std::string& value) { this->Value = value; - set_field_buffer(this->Field, 0, value); + set_field_buffer(this->Field, 0, value.c_str()); } const char* cmCursesWidget::GetValue() diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h index 952c67a..d91a0cb 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -40,7 +40,7 @@ public: * Set/Get the value (setting the value also changes the contents * of the field buffer). */ - virtual void SetValue(const char* value); + virtual void SetValue(const std::string& value); virtual const char* GetValue(); /** diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 39b9ae5..159f9c3 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -94,7 +94,7 @@ bool cmCacheManager::LoadCache(const std::string& path, return this->LoadCache(path, internal, emptySet, emptySet); } -static bool ParseEntryWithoutType(const char* entry, +static bool ParseEntryWithoutType(const std::string& entry, std::string& var, std::string& value) { @@ -132,7 +132,7 @@ static bool ParseEntryWithoutType(const char* entry, return flag; } -bool cmCacheManager::ParseEntry(const char* entry, +bool cmCacheManager::ParseEntry(const std::string& entry, std::string& var, std::string& value, CacheEntryType& type) diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 573f828..07a8675 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -136,7 +136,7 @@ public: return static_cast(this->Cache.size()); } ///! Break up a line like VAR:type="value" into var, type and value - static bool ParseEntry(const char* entry, + static bool ParseEntry(const std::string& entry, std::string& var, std::string& value, CacheEntryType& type); diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index cf91c69..abd8ad5 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -50,7 +50,7 @@ public: const char *GetMainExportFileName() const; /** Set the namespace in which to place exported target names. */ - void SetNamespace(const char* ns) { this->Namespace = ns; } + void SetNamespace(const std::string& ns) { this->Namespace = ns; } std::string GetNamespace() const { return this->Namespace; } void SetExportOld(bool exportOld) { this->ExportOld = exportOld; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b7af21b..a14696d 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1790,7 +1790,7 @@ int cmGlobalGenerator::Build( //---------------------------------------------------------------------------- std::string cmGlobalGenerator::GenerateCMakeBuildCommand( const std::string& target, const std::string& config, - const char* native, + const std::string& native, bool ignoreErrors) { std::string makeCommand = cmSystemTools::GetCMakeCommand(); @@ -1819,7 +1819,7 @@ std::string cmGlobalGenerator::GenerateCMakeBuildCommand( sep = " "; } } - if(native && *native) + if(!native.empty()) { makeCommand += sep; makeCommand += native; @@ -2528,9 +2528,10 @@ std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage( } //---------------------------------------------------------------------------- -void cmGlobalGenerator::AppendDirectoryForConfig(const char*, +void cmGlobalGenerator::AppendDirectoryForConfig(const std::string&, const std::string&, - const char*, std::string&) + const std::string&, + std::string&) { // Subclasses that support multiple configurations should implement // this method to append the subdirectory for the given build diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index e9a1b47..5b97960 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -138,7 +138,7 @@ public: /** Generate a "cmake --build" call for a given target and config. */ std::string GenerateCMakeBuildCommand(const std::string& target, const std::string& config, - const char* native, + const std::string& native, bool ignoreErrors); ///! Set the CMake instance @@ -230,9 +230,9 @@ public: /** Append the subdirectory for the given configuration. If anything is appended the given prefix and suffix will be appended around it, which is useful for leading or trailing slashes. */ - virtual void AppendDirectoryForConfig(const char* prefix, + virtual void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir); /** Get the manifest of all targets that will be built for each @@ -292,7 +292,7 @@ public: return this->BinaryDirectories.insert(dir).second; } /** Supported systems creates a GUID for the given name */ - virtual void CreateGUID(const char*) {} + virtual void CreateGUID(const std::string&) {} /** Return true if the generated build tree may contain multiple builds. i.e. "Can I build Debug and Release in the same tree?" */ diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index f69bcfd..82047d7 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -418,9 +418,9 @@ void cmGlobalVisualStudio6Generator //---------------------------------------------------------------------------- void cmGlobalVisualStudio6Generator -::AppendDirectoryForConfig(const char* prefix, +::AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir) { if(!config.empty()) diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 22ec926..f7ef972 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -81,9 +81,9 @@ public: std::vector& generators); /** Append the subdirectory for the given configuration. */ - virtual void AppendDirectoryForConfig(const char* prefix, + virtual void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir); ///! What is the configurations directory variable called? diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 18f7f19..c65bdaa 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -924,7 +924,7 @@ std::string cmGlobalVisualStudio7Generator::GetGUID(const std::string& name) } -void cmGlobalVisualStudio7Generator::CreateGUID(const char* name) +void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name) { std::string guidStoreName = name; guidStoreName += "_GUID_CMAKE"; @@ -961,9 +961,9 @@ void cmGlobalVisualStudio7Generator //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator -::AppendDirectoryForConfig(const char* prefix, +::AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir) { if(!config.empty()) diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 009f002..342fa88 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -89,13 +89,13 @@ public: std::vector *GetConfigurations(); ///! Create a GUID or get an existing one. - void CreateGUID(const char* name); + void CreateGUID(const std::string& name); std::string GetGUID(const std::string& name); /** Append the subdirectory for the given configuration. */ - virtual void AppendDirectoryForConfig(const char* prefix, + virtual void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir); ///! What is the configurations directory variable called? diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index c0077b9..ec2e1e9 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -34,17 +34,17 @@ class cmXcodeVersionParser : public cmXMLParser { public: cmXcodeVersionParser(): Version("1.5") {} - void StartElement(const char* , const char** ) + void StartElement(const std::string&, const char**) { this->Data = ""; } - void EndElement(const char* name) + void EndElement(const std::string& name) { - if(strcmp(name, "key") == 0) + if(name == "key") { this->Key = this->Data; } - else if(strcmp(name, "string") == 0) + else if(name == "string") { if(this->Key == "CFBundleShortVersionString") { @@ -1005,7 +1005,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, gtgt->GetTargetSourceFileFlags(*i); if(filetype && - strcmp(filetype->GetString(), "compiled.mach-o.objfile") == 0) + filetype->GetString() == "compiled.mach-o.objfile") { externalObjFiles.push_back(xsf); } @@ -3771,9 +3771,9 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p) //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator -::AppendDirectoryForConfig(const char* prefix, +::AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir) { if(this->XcodeVersion > 20) diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 03e75c4..e9149c2 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -72,9 +72,9 @@ public: virtual void Generate(); /** Append the subdirectory for the given configuration. */ - virtual void AppendDirectoryForConfig(const char* prefix, + virtual void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir); ///! What is the configurations directory variable called? diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 2516613..f7088c2 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1299,7 +1299,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, //---------------------------------------------------------------------------- std::string cmLocalUnixMakefileGenerator3 -::CreateMakeVariable(const char* sin, const char* s2in) +::CreateMakeVariable(const std::string& sin, const std::string& s2in) { std::string s = sin; std::string s2 = s2in; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 37ee874..39f213b 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -75,7 +75,7 @@ public: /** * Set the flag used to keep the make program silent. */ - void SetMakeSilentFlag(const char* s) { this->MakeSilentFlag = s; } + void SetMakeSilentFlag(const std::string& s) { this->MakeSilentFlag = s; } std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; } /** @@ -130,8 +130,9 @@ public: * Set the string used to include one makefile into another default * is include. */ - void SetIncludeDirective(const char* s) { this->IncludeDirective = s; } - const char *GetIncludeDirective() { return this->IncludeDirective.c_str(); } + void SetIncludeDirective(const std::string& s) + { this->IncludeDirective = s; } + const std::string& GetIncludeDirective() { return this->IncludeDirective; } /** * Set max makefile variable size, default is 0 which means unlimited. @@ -192,7 +193,8 @@ public: static std::string ConvertToQuotedOutputPath(const char* p); - std::string CreateMakeVariable(const char* sin, const char* s2in); + std::string CreateMakeVariable(const std::string& sin, + const std::string& s2in); /** Called from command-line hook to bring dependencies up to date for a target. */ diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index aedd6ed..aa70ab9 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -19,7 +19,7 @@ class cmVS10XMLParser : public cmXMLParser { public: - virtual void EndElement(const char* /* name */) + virtual void EndElement(const std::string& /* name */) { } virtual void CharacterDataHandler(const char* data, int length) @@ -30,14 +30,14 @@ class cmVS10XMLParser : public cmXMLParser this->DoGUID = false; } } - virtual void StartElement(const char* name, const char**) + virtual void StartElement(const std::string& name, const char**) { // once the GUID is found do nothing if(this->GUID.size()) { return; } - if(strcmp("ProjectGUID", name) == 0 || strcmp("ProjectGuid", name) == 0) + if("ProjectGUID" == name || "ProjectGuid" == name) { this->DoGUID = true; } @@ -98,7 +98,7 @@ void cmLocalVisualStudio10Generator::Generate() void cmLocalVisualStudio10Generator -::ReadAndStoreExternalGUID(const char* name, +::ReadAndStoreExternalGUID(const std::string& name, const char* path) { cmVS10XMLParser parser; diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index 41db735..b50e345 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -34,7 +34,7 @@ public: * Generate the makefile for this directory. */ virtual void Generate(); - virtual void ReadAndStoreExternalGUID(const char* name, + virtual void ReadAndStoreExternalGUID(const std::string& name, const char* path); protected: diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 5f98a71..0bbafd8 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -2146,10 +2146,10 @@ std::string cmLocalVisualStudio7Generator class cmVS7XMLParser : public cmXMLParser { public: - virtual void EndElement(const char* /* name */) + virtual void EndElement(const std::string& /* name */) { } - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { // once the GUID is found do nothing if(this->GUID.size()) @@ -2157,7 +2157,7 @@ public: return; } int i =0; - if(strcmp("VisualStudioProject", name) == 0) + if("VisualStudioProject" == name) { while(atts[i]) { @@ -2194,7 +2194,7 @@ public: }; void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( - const char* name, + const std::string& name, const char* path) { cmVS7XMLParser parser; diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index f9bb6e1..d2e66a5 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -51,7 +51,7 @@ public: /** * Specify the type of the build: static, dll, or executable. */ - void SetBuildType(BuildType,const char *name); + void SetBuildType(BuildType,const std::string& name); void SetPlatformName(const char* n) { this->PlatformName = n;} @@ -62,7 +62,7 @@ public: void WriteStampFiles(); virtual std::string ComputeLongestObjectDirectory(cmTarget&) const; - virtual void ReadAndStoreExternalGUID(const char* name, + virtual void ReadAndStoreExternalGUID(const std::string& name, const char* path); virtual void AddCMakeListsRules(); protected: diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 11b0387..6e93d22 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -81,7 +81,7 @@ std::string cmLocalVisualStudioGenerator ::ConstructScript(cmCustomCommand const& cc, const std::string& configName, - const char* newline_text) + const std::string& newline_text) { bool useLocal = this->CustomCommandUseLocal(); const char* workingDirectory = cc.GetWorkingDirectory(); @@ -89,7 +89,7 @@ cmLocalVisualStudioGenerator RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT; // Avoid leading or trailing newlines. - const char* newline = ""; + std::string newline = ""; // Line to check for error between commands. std::string check_error = newline_text; diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 2297072..94a6293 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -48,7 +48,7 @@ public: /** Construct a script from the given list of command lines. */ std::string ConstructScript(cmCustomCommand const& cc, const std::string& configName, - const char* newline = "\n"); + const std::string& newline = "\n"); /** Label to which to jump in a batch file after a failed step in a sequence of custom commands. */ diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 25ca168..5952444 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4100,7 +4100,8 @@ bool cmTarget::ComputeOutputDir(const std::string& config, } //---------------------------------------------------------------------------- -bool cmTarget::ComputePDBOutputDir(const char* kind, const std::string& config, +bool cmTarget::ComputePDBOutputDir(const std::string& kind, + const std::string& config, std::string& out) const { // Look for a target property defining the target output directory diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 15f00be..d5ef18d 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -714,7 +714,7 @@ private: bool ComputeOutputDir(const std::string& config, bool implib, std::string& out) const; - bool ComputePDBOutputDir(const char* kind, const std::string& config, + bool ComputePDBOutputDir(const std::string& kind, const std::string& config, std::string& out) const; // Cache import information from properties for each configuration. diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx index 219a5eb..ca226fb 100644 --- a/Source/cmVisualStudioWCEPlatformParser.cxx +++ b/Source/cmVisualStudioWCEPlatformParser.cxx @@ -62,7 +62,7 @@ const char* cmVisualStudioWCEPlatformParser::GetArchitectureFamily() const return 0; } -void cmVisualStudioWCEPlatformParser::StartElement(const char* name, +void cmVisualStudioWCEPlatformParser::StartElement(const std::string& name, const char** attributes) { if(this->FoundRequiredName) @@ -72,7 +72,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name, this->CharacterData = ""; - if(strcmp(name, "PlatformData") == 0) + if(name == "PlatformData") { this->PlatformName = ""; this->OSMajorVersion = ""; @@ -80,7 +80,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name, this->Macros.clear(); } - if(strcmp(name, "Macro") == 0) + if(name == "Macro") { std::string macroName; std::string macroValue; @@ -102,7 +102,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name, this->Macros[macroName] = macroValue; } } - else if(strcmp(name, "Directories") == 0) + else if(name == "Directories") { for(const char** attr = attributes; *attr; attr += 2) { @@ -122,11 +122,11 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name, } } -void cmVisualStudioWCEPlatformParser::EndElement(const char* name) +void cmVisualStudioWCEPlatformParser::EndElement(const std::string& name) { if(!this->RequiredName) { - if(strcmp(name, "PlatformName") == 0) + if(name == "PlatformName") { this->AvailablePlatforms.push_back(this->CharacterData); } @@ -138,19 +138,19 @@ void cmVisualStudioWCEPlatformParser::EndElement(const char* name) return; } - if(strcmp(name, "PlatformName") == 0) + if(name == "PlatformName") { this->PlatformName = this->CharacterData; } - else if(strcmp(name, "OSMajorVersion") == 0) + else if(name == "OSMajorVersion") { this->OSMajorVersion = this->CharacterData; } - else if(strcmp(name, "OSMinorVersion") == 0) + else if(name == "OSMinorVersion") { this->OSMinorVersion = this->CharacterData; } - else if(strcmp(name, "Platform") == 0) + else if(name == "Platform") { if(this->PlatformName == this->RequiredName) { diff --git a/Source/cmVisualStudioWCEPlatformParser.h b/Source/cmVisualStudioWCEPlatformParser.h index 466e1dd..042df01 100644 --- a/Source/cmVisualStudioWCEPlatformParser.h +++ b/Source/cmVisualStudioWCEPlatformParser.h @@ -41,8 +41,8 @@ public: return this->AvailablePlatforms; } protected: - virtual void StartElement(const char* name, const char** attributes); - void EndElement(const char* name); + virtual void StartElement(const std::string& name, const char** attributes); + void EndElement(const std::string& name); void CharacterDataHandler(const char* data, int length); private: diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 3a6528a..ed2940a 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -38,12 +38,12 @@ public: PBXType GetIsA() { return this->IsA;} void SetString(const std::string& s); - const char* GetString() + const std::string& GetString() { - return this->String.c_str(); + return this->String; } - void AddAttribute(const char* name, cmXCodeObject* value) + void AddAttribute(const std::string& name, cmXCodeObject* value) { this->ObjectAttributes[name] = value; } @@ -79,11 +79,11 @@ public: static void PrintList(std::vector const&, std::ostream& out); - const char* GetId() + const std::string& GetId() { - return this->Id.c_str(); + return this->Id; } - void SetId(const char* id) + void SetId(const std::string& id) { this->Id = id; } @@ -95,8 +95,8 @@ public: { this->Target = t; } - const char* GetComment() {return this->Comment.c_str();} - bool HasComment() { return (this->Comment.size() != 0);} + const std::string& GetComment() {return this->Comment;} + bool HasComment() { return (!this->Comment.empty());} cmXCodeObject* GetObject(const char* name) { if(this->ObjectAttributes.count(name)) @@ -141,7 +141,7 @@ public: return this->DependTargets; } std::vector const& GetObjectList() { return this->List;} - void SetComment(const char* c) { this->Comment = c;} + void SetComment(const std::string& c) { this->Comment = c;} static void PrintString(std::ostream& os,std::string String); protected: void PrintString(std::ostream& os) const; diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx index 0c53440..a73fd70 100644 --- a/Source/cmXMLParser.cxx +++ b/Source/cmXMLParser.cxx @@ -152,14 +152,14 @@ int cmXMLParser::ParsingComplete() } //---------------------------------------------------------------------------- -void cmXMLParser::StartElement(const char * name, +void cmXMLParser::StartElement(const std::string& name, const char ** /*atts*/) { std::cout << "Start element: " << name << std::endl; } //---------------------------------------------------------------------------- -void cmXMLParser::EndElement(const char * name) +void cmXMLParser::EndElement(const std::string& name) { std::cout << "End element: " << name << std::endl; } diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h index d916075..84a5a7d 100644 --- a/Source/cmXMLParser.h +++ b/Source/cmXMLParser.h @@ -74,11 +74,11 @@ protected: * element. atts = Null-terminated array of attribute name/value pairs. * Even indices are attribute names, and odd indices are values. */ - virtual void StartElement(const char* name, const char** atts); + virtual void StartElement(const std::string& name, const char** atts); //! Called at the end of an element in the XML source opened when //StartElement was called. - virtual void EndElement(const char* name); + virtual void EndElement(const std::string& name); //! Called when there is character data to handle. virtual void CharacterDataHandler(const char* data, int length); -- cgit v0.12 From 11ed3e2cfe70e7d9d5a8e1f8e24fa61bbf6420b0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 21 Feb 2014 19:06:54 -0500 Subject: stringapi: Add string overload for the Def struct --- Source/cmDefinitions.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 4c1ad0a..d615fb0 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -59,6 +59,7 @@ private: public: Def(): std_string(), Exists(false) {} Def(const char* v): std_string(v?v:""), Exists(v?true:false) {} + Def(const std_string& v): std_string(v), Exists(true) {} Def(Def const& d): std_string(d), Exists(d.Exists) {} bool Exists; }; -- cgit v0.12 From 24b5e93de2c753e94cae3b41c1ca7cddaa03e5e7 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 17:38:30 -0500 Subject: stringapi: Use strings for directories --- Source/cmGlobalGenerator.cxx | 9 +++++---- Source/cmGlobalGenerator.h | 6 +++--- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 2 +- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmMakefile.cxx | 9 +++++---- Source/cmMakefile.h | 2 +- Source/cmQtAutoGenerators.cxx | 20 ++++++++++++-------- Source/cmQtAutoGenerators.h | 8 ++++---- Source/cmake.cxx | 2 +- 19 files changed, 44 insertions(+), 38 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a14696d..c1cce2e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1614,7 +1614,8 @@ void cmGlobalGenerator::CheckLocalGenerators() } } -int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, +int cmGlobalGenerator::TryCompile(const std::string& srcdir, + const std::string& bindir, const std::string& projectName, const std::string& target, bool fast, std::string *output, cmMakefile *mf) @@ -1665,7 +1666,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, void cmGlobalGenerator::GenerateBuildCommand( std::vector& makeCommand, const char*, const std::string&, - const char*, const std::string&, const std::string&, bool, + const std::string&, const std::string&, const std::string&, bool, std::vector const&) { makeCommand.push_back( @@ -1673,7 +1674,7 @@ void cmGlobalGenerator::GenerateBuildCommand( } int cmGlobalGenerator::Build( - const char *, const char *bindir, + const std::string&, const std::string& bindir, const std::string& projectName, const std::string& target, std::string *output, const char *makeCommandCSTR, @@ -1687,7 +1688,7 @@ int cmGlobalGenerator::Build( * Run an executable command and put the stdout in output. */ std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(bindir); + cmSystemTools::ChangeDirectory(bindir.c_str()); if(output) { *output += "Change Dir: "; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 5b97960..761fb07 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -105,7 +105,7 @@ public: * Try running cmake and building a file. This is used for dynamically * loaded commands, not as part of the usual build process. */ - virtual int TryCompile(const char *srcdir, const char *bindir, + virtual int TryCompile(const std::string& srcdir, const std::string& bindir, const std::string& projectName, const std::string& targetName, bool fast, std::string *output, cmMakefile* mf); @@ -117,7 +117,7 @@ public: * empty then all is assumed. clean indicates if a "make clean" should be * done first. */ - int Build(const char *srcdir, const char *bindir, + int Build(const std::string& srcdir, const std::string& bindir, const std::string& projectName, const std::string& targetName, std::string *output, const char *makeProgram, const std::string& config, @@ -130,7 +130,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const std::string& projectName, const char *projectDir, + const std::string& projectName, const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 16e9788..73a6245 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -553,7 +553,7 @@ void cmGlobalNinjaGenerator ::GenerateBuildCommand(std::vector& makeCommand, const char* makeProgram, const std::string& /*projectName*/, - const char* /*projectDir*/, + const std::string& /*projectDir*/, const std::string& targetName, const std::string& /*config*/, bool /*fast*/, diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 86c2912..4a28486 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -195,7 +195,7 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index d947150..9ddbe5b 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -567,7 +567,7 @@ void cmGlobalUnixMakefileGenerator3 ::GenerateBuildCommand(std::vector& makeCommand, const char* makeProgram, const std::string& /*projectName*/, - const char* /*projectDir*/, + const std::string& /*projectDir*/, const std::string& targetName, const std::string& /*config*/, bool fast, diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 8924fa8..d64afaf 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -111,7 +111,7 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 0bc572b..3819a5b 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -312,7 +312,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, @@ -334,7 +334,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( cmSlnData slnData; { std::string slnFile; - if(projectDir && *projectDir) + if(!projectDir.empty()) { slnFile = projectDir; slnFile += "/"; diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 085f2d2..5d902ee 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -36,7 +36,7 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 82047d7..3a51fce 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -118,7 +118,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* /*projectDir*/, + const std::string& /*projectDir*/, const std::string& targetName, const std::string& config, bool /*fast*/, diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index f7ef972..eb3dddf 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -56,7 +56,7 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index c65bdaa..3927100 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -185,7 +185,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* /*projectDir*/, + const std::string& /*projectDir*/, const std::string& targetName, const std::string& config, bool /*fast*/, diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 342fa88..b659480 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -64,7 +64,7 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ec2e1e9..e1f2a91 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -262,7 +262,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* /*projectDir*/, + const std::string& /*projectDir*/, const std::string& targetName, const std::string& config, bool /*fast*/, diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index e9149c2..aec7958 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -57,7 +57,7 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index bb88bc4..e61b12b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3060,7 +3060,8 @@ void cmMakefile::ExpandSourceListArguments( } } -int cmMakefile::TryCompile(const char *srcdir, const char *bindir, +int cmMakefile::TryCompile(const std::string& srcdir, + const std::string& bindir, const std::string& projectName, const std::string& targetName, bool fast, @@ -3069,15 +3070,15 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, { this->Internal->IsSourceFileTryCompile = fast; // does the binary directory exist ? If not create it... - if (!cmSystemTools::FileIsDirectory(bindir)) + if (!cmSystemTools::FileIsDirectory(bindir.c_str())) { - cmSystemTools::MakeDirectory(bindir); + cmSystemTools::MakeDirectory(bindir.c_str()); } // change to the tests directory and run cmake // use the cmake object instead of calling cmake std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(bindir); + cmSystemTools::ChangeDirectory(bindir.c_str()); // make sure the same generator is used // use this program as the cmake to be run, it should not diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 7c82ec2..fb40c1b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -126,7 +126,7 @@ public: * Try running cmake and building a file. This is used for dynalically * loaded commands, not as part of the usual build process. */ - int TryCompile(const char *srcdir, const char *bindir, + int TryCompile(const std::string& srcdir, const std::string& bindir, const std::string& projectName, const std::string& targetName, bool fast, const std::vector *cmakeArgs, diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 8eee991..48a6b38 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -952,7 +952,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) } static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, - const char* targetDirectory) + const std::string& targetDirectory) { cmGlobalGenerator* gg = new cmGlobalGenerator(); gg->SetCMakeInstance(cm); @@ -967,7 +967,7 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, return gg; } -bool cmQtAutoGenerators::Run(const char* targetDirectory, +bool cmQtAutoGenerators::Run(const std::string& targetDirectory, const std::string& config) { bool success = true; @@ -994,10 +994,11 @@ bool cmQtAutoGenerators::Run(const char* targetDirectory, } bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, - const char* targetDirectory, + const std::string& targetDirectory, const std::string& config) { - std::string filename(cmSystemTools::CollapseFullPath(targetDirectory)); + std::string filename( + cmSystemTools::CollapseFullPath(targetDirectory.c_str())); cmSystemTools::ConvertToUnixSlashes(filename); filename += "/AutogenInfo.cmake"; @@ -1137,9 +1138,10 @@ std::string cmQtAutoGenerators::MakeCompileSettingsString(cmMakefile* makefile) bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile, - const char* targetDirectory) + const std::string& targetDirectory) { - std::string filename(cmSystemTools::CollapseFullPath(targetDirectory)); + std::string filename( + cmSystemTools::CollapseFullPath(targetDirectory.c_str())); cmSystemTools::ConvertToUnixSlashes(filename); filename += "/AutomocOldMocDefinitions.cmake"; @@ -1153,9 +1155,11 @@ bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile, void -cmQtAutoGenerators::WriteOldMocDefinitionsFile(const char* targetDirectory) +cmQtAutoGenerators::WriteOldMocDefinitionsFile( + const std::string& targetDirectory) { - std::string filename(cmSystemTools::CollapseFullPath(targetDirectory)); + std::string filename( + cmSystemTools::CollapseFullPath(targetDirectory.c_str())); cmSystemTools::ConvertToUnixSlashes(filename); filename += "/AutomocOldMocDefinitions.cmake"; diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index af4ceb9..a593dd5 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -21,7 +21,7 @@ class cmQtAutoGenerators { public: cmQtAutoGenerators(); - bool Run(const char* targetDirectory, const std::string& config); + bool Run(const std::string& targetDirectory, const std::string& config); bool InitializeAutogenTarget(cmTarget* target); void SetupAutoGenerateTarget(cmTarget const* target); @@ -37,11 +37,11 @@ private: void SetupAutoRccTarget(cmTarget const* target); bool ReadAutogenInfoFile(cmMakefile* makefile, - const char* targetDirectory, + const std::string& targetDirectory, const std::string& config); bool ReadOldMocDefinitionsFile(cmMakefile* makefile, - const char* targetDirectory); - void WriteOldMocDefinitionsFile(const char* targetDirectory); + const std::string& targetDirectory); + void WriteOldMocDefinitionsFile(const std::string& targetDirectory); std::string MakeCompileSettingsString(cmMakefile* makefile); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5ada30e..13572f4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2667,7 +2667,7 @@ int cmake::Build(const std::string& dir, return 1; } projName = it.GetValue(); - return gen->Build(0, dir.c_str(), + return gen->Build("", dir.c_str(), projName.c_str(), target.c_str(), &output, 0, -- cgit v0.12 From 1a1b737c99ac0bd0d555fde2fadf77f08516a4ea Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 17:36:27 -0500 Subject: stringapi: Use strings for generator names --- Source/CTest/cmCTestBuildCommand.cxx | 3 +-- Source/cmComputeLinkInformation.cxx | 5 +++-- Source/cmExternalMakefileProjectGenerator.cxx | 22 ++++++++++---------- Source/cmExternalMakefileProjectGenerator.h | 11 +++++----- Source/cmExtraCodeBlocksGenerator.cxx | 9 +++++---- Source/cmExtraCodeBlocksGenerator.h | 6 +++--- Source/cmExtraCodeLiteGenerator.cxx | 2 +- Source/cmExtraCodeLiteGenerator.h | 6 +++--- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.h | 6 +++--- Source/cmExtraKateGenerator.cxx | 4 ++-- Source/cmExtraKateGenerator.h | 6 +++--- Source/cmExtraSublimeTextGenerator.cxx | 11 +++++----- Source/cmExtraSublimeTextGenerator.h | 6 +++--- Source/cmGlobalBorlandMakefileGenerator.h | 4 ++-- Source/cmGlobalGenerator.cxx | 4 ++-- Source/cmGlobalGenerator.h | 8 ++++---- Source/cmGlobalGeneratorFactory.h | 8 +++++--- Source/cmGlobalJOMMakefileGenerator.h | 4 ++-- Source/cmGlobalKdevelopGenerator.cxx | 2 +- Source/cmGlobalKdevelopGenerator.h | 6 +++--- Source/cmGlobalMSYSMakefileGenerator.h | 4 ++-- Source/cmGlobalMinGWMakefileGenerator.h | 4 ++-- Source/cmGlobalNMakeMakefileGenerator.h | 4 ++-- Source/cmGlobalNinjaGenerator.h | 4 ++-- Source/cmGlobalUnixMakefileGenerator3.cxx | 4 ++-- Source/cmGlobalUnixMakefileGenerator3.h | 4 ++-- Source/cmGlobalVisualStudio10Generator.cxx | 24 ++++++++++++---------- Source/cmGlobalVisualStudio10Generator.h | 7 ++++--- Source/cmGlobalVisualStudio11Generator.cxx | 24 ++++++++++++---------- Source/cmGlobalVisualStudio11Generator.h | 7 ++++--- Source/cmGlobalVisualStudio12Generator.cxx | 24 ++++++++++++---------- Source/cmGlobalVisualStudio12Generator.h | 7 ++++--- Source/cmGlobalVisualStudio6Generator.h | 4 ++-- Source/cmGlobalVisualStudio71Generator.cxx | 9 +++++---- Source/cmGlobalVisualStudio71Generator.h | 8 ++++---- Source/cmGlobalVisualStudio7Generator.cxx | 22 +++++++++++--------- Source/cmGlobalVisualStudio7Generator.h | 10 ++++----- Source/cmGlobalVisualStudio8Generator.cxx | 29 ++++++++++++++++----------- Source/cmGlobalVisualStudio8Generator.h | 9 +++++---- Source/cmGlobalVisualStudio9Generator.cxx | 14 +++++++------ Source/cmGlobalVisualStudio9Generator.h | 5 +++-- Source/cmGlobalVisualStudioGenerator.cxx | 4 ++-- Source/cmGlobalVisualStudioGenerator.h | 2 +- Source/cmGlobalWatcomWMakeGenerator.h | 4 ++-- Source/cmGlobalXCodeGenerator.cxx | 7 ++++--- Source/cmGlobalXCodeGenerator.h | 4 ++-- Source/cmLocalVisualStudio7Generator.h | 2 +- Source/cmMakefile.cxx | 4 ++-- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmake.cxx | 16 ++++++++------- Source/cmake.h | 4 ++-- 52 files changed, 221 insertions(+), 190 deletions(-) diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index c60ded0..04eabd2 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -101,8 +101,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() } if ( this->GlobalGenerator ) { - if ( strcmp(this->GlobalGenerator->GetName(), - cmakeGeneratorName) != 0 ) + if ( this->GlobalGenerator->GetName() != cmakeGeneratorName ) { delete this->GlobalGenerator; this->GlobalGenerator = 0; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index e4e2047..62eaec2 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1127,9 +1127,10 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item) // Full path libraries should specify a valid library file name. // See documentation of CMP0008. + std::string generator = this->GlobalGenerator->GetName(); if(this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW && - (strstr(this->GlobalGenerator->GetName(), "Visual Studio") || - strstr(this->GlobalGenerator->GetName(), "Xcode"))) + (generator.find("Visual Studio") != generator.npos || + generator.find("Xcode") != generator.npos)) { std::string file = cmSystemTools::GetFilenameName(item); if(!this->ExtractAnyLibraryName.find(file.c_str())) diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx index 0d42c35..d89a1c8 100644 --- a/Source/cmExternalMakefileProjectGenerator.cxx +++ b/Source/cmExternalMakefileProjectGenerator.cxx @@ -20,13 +20,13 @@ void cmExternalMakefileProjectGenerator } std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName( - const char* globalGenerator, - const char* extraGenerator) + const std::string& globalGenerator, + const std::string& extraGenerator) { std::string fullName; - if (globalGenerator) + if (!globalGenerator.empty()) { - if (extraGenerator && *extraGenerator) + if (!extraGenerator.empty()) { fullName = extraGenerator; fullName += " - "; @@ -36,22 +36,22 @@ std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName( return fullName; } -const char* cmExternalMakefileProjectGenerator::GetGlobalGeneratorName( - const char* fullName) +std::string cmExternalMakefileProjectGenerator::GetGlobalGeneratorName( + const std::string& fullName) { // at least one global generator must be supported assert(!this->SupportedGlobalGenerators.empty()); - if (fullName==0) + if (fullName.empty()) { - return 0; + return ""; } std::string currentName = fullName; // if we get only the short name, take the first global generator as default if (currentName == this->GetName()) { - return this->SupportedGlobalGenerators[0].c_str(); + return this->SupportedGlobalGenerators[0]; } // otherwise search for the matching global generator @@ -63,8 +63,8 @@ const char* cmExternalMakefileProjectGenerator::GetGlobalGeneratorName( if (this->CreateFullGeneratorName(it->c_str(), this->GetName()) == currentName) { - return it->c_str(); + return *it; } } - return 0; + return ""; } diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index bce441d..cba1c76 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -37,10 +37,10 @@ public: virtual ~cmExternalMakefileProjectGenerator() {} ///! Get the name for this generator. - virtual const char* GetName() const = 0; + virtual std::string GetName() const = 0; /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const = 0; + const std::string& fullName) const = 0; virtual void EnableLanguage(std::vector const& languages, cmMakefile *, bool optional); @@ -53,12 +53,13 @@ public: {return this->SupportedGlobalGenerators;} ///! Get the name of the global generator for the given full name - const char* GetGlobalGeneratorName(const char* fullName); + std::string GetGlobalGeneratorName(const std::string& fullName); /** Create a full name from the given global generator name and the * extra generator name */ - static std::string CreateFullGeneratorName(const char* globalGenerator, - const char* extraGenerator); + static std::string CreateFullGeneratorName( + const std::string& globalGenerator, + const std::string& extraGenerator); ///! Generate the project files, the Makefiles have already been generated virtual void Generate() = 0; diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 01d1155..4a59704 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -38,7 +38,7 @@ http://forums.codeblocks.org/index.php/topic,6789.0.html //---------------------------------------------------------------------------- void cmExtraCodeBlocksGenerator -::GetDocumentation(cmDocumentationEntry& entry, const char*) const +::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const { entry.Name = this->GetName(); entry.Brief = "Generates CodeBlocks project files."; @@ -761,7 +761,8 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand( const std::string& target) { std::string command = make; - if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0) + std::string generator = this->GlobalGenerator->GetName(); + if (generator == "NMake Makefiles") { // For Windows ConvertToOutputPath already adds quotes when required. // These need to be escaped, see @@ -772,7 +773,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand( command += " VERBOSE=1 "; command += target; } - else if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0) + else if (generator == "MinGW Makefiles") { // no escaping of spaces in this case, see // http://public.kitware.com/Bug/view.php?id=10014 @@ -783,7 +784,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand( command += " VERBOSE=1 "; command += target; } - else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0) + else if (generator == "Ninja") { command += " -v "; command += target; diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h index 1cbc3f3..0435ad8 100644 --- a/Source/cmExtraCodeBlocksGenerator.h +++ b/Source/cmExtraCodeBlocksGenerator.h @@ -28,14 +28,14 @@ class cmExtraCodeBlocksGenerator : public cmExternalMakefileProjectGenerator public: cmExtraCodeBlocksGenerator(); - virtual const char* GetName() const + virtual std::string GetName() const { return cmExtraCodeBlocksGenerator::GetActualName();} - static const char* GetActualName() { return "CodeBlocks";} + static std::string GetActualName() { return "CodeBlocks";} static cmExternalMakefileProjectGenerator* New() { return new cmExtraCodeBlocksGenerator; } /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const; + const std::string& fullName) const; virtual void Generate(); private: diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 1e34fe0..15fe8bb 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -28,7 +28,7 @@ //---------------------------------------------------------------------------- void cmExtraCodeLiteGenerator::GetDocumentation(cmDocumentationEntry& entry, - const char*) const + const std::string&) const { entry.Name = this->GetName(); entry.Brief = "Generates CodeLite project files."; diff --git a/Source/cmExtraCodeLiteGenerator.h b/Source/cmExtraCodeLiteGenerator.h index 984313e..6b4965d 100644 --- a/Source/cmExtraCodeLiteGenerator.h +++ b/Source/cmExtraCodeLiteGenerator.h @@ -35,14 +35,14 @@ protected: public: cmExtraCodeLiteGenerator(); - virtual const char* GetName() const + virtual std::string GetName() const { return cmExtraCodeLiteGenerator::GetActualName();} - static const char* GetActualName() { return "CodeLite";} + static std::string GetActualName() { return "CodeLite";} static cmExternalMakefileProjectGenerator* New() { return new cmExtraCodeLiteGenerator; } /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const; + const std::string& fullName) const; virtual void Generate(); void CreateProjectFile(const std::vector& lgs); diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 38a2470..4aabc7e 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -45,7 +45,7 @@ cmExtraEclipseCDT4Generator //---------------------------------------------------------------------------- void cmExtraEclipseCDT4Generator -::GetDocumentation(cmDocumentationEntry& entry, const char*) const +::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const { entry.Name = this->GetName(); entry.Brief = "Generates Eclipse CDT 4.0 project files."; diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index d88b247..ef99760 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -33,14 +33,14 @@ public: return new cmExtraEclipseCDT4Generator; } - virtual const char* GetName() const { + virtual std::string GetName() const { return cmExtraEclipseCDT4Generator::GetActualName(); } - static const char* GetActualName() { return "Eclipse CDT4"; } + static std::string GetActualName() { return "Eclipse CDT4"; } virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const; + const std::string& fullName) const; virtual void EnableLanguage(std::vector const& languages, cmMakefile *, bool optional); diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index a0d37d4..567542e 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -25,7 +25,7 @@ //---------------------------------------------------------------------------- void cmExtraKateGenerator -::GetDocumentation(cmDocumentationEntry& entry, const char*) const +::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const { entry.Name = this->GetName(); entry.Brief = "Generates Kate project files."; @@ -52,7 +52,7 @@ void cmExtraKateGenerator::Generate() this->ProjectName = this->GenerateProjectName(mf->GetProjectName(), mf->GetSafeDefinition("CMAKE_BUILD_TYPE"), this->GetPathBasename(mf->GetHomeOutputDirectory())); - this->UseNinja = (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0); + this->UseNinja = (this->GlobalGenerator->GetName() == "Ninja"); this->CreateKateProjectFile(mf); this->CreateDummyKateProjectFile(mf); diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h index 6ced5fe..f800feb 100644 --- a/Source/cmExtraKateGenerator.h +++ b/Source/cmExtraKateGenerator.h @@ -28,14 +28,14 @@ class cmExtraKateGenerator : public cmExternalMakefileProjectGenerator public: cmExtraKateGenerator(); - virtual const char* GetName() const + virtual std::string GetName() const { return cmExtraKateGenerator::GetActualName();} - static const char* GetActualName() { return "Kate";} + static std::string GetActualName() { return "Kate";} static cmExternalMakefileProjectGenerator* New() { return new cmExtraKateGenerator; } /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const; + const std::string& fullName) const; virtual void Generate(); private: diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 03c7c92..f973a84 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -41,7 +41,7 @@ http://sublimetext.info/docs/en/reference/build_systems.html //---------------------------------------------------------------------------- void cmExtraSublimeTextGenerator -::GetDocumentation(cmDocumentationEntry& entry, const char*) const +::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const { entry.Name = this->GetName(); entry.Brief = "Generates Sublime Text 2 project files."; @@ -290,7 +290,7 @@ void cmExtraSublimeTextGenerator:: // Ninja uses ninja.build files (look for a way to get the output file name // from cmMakefile or something) std::string makefileName; - if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0) + if (this->GlobalGenerator->GetName() == "Ninja") { makefileName = "build.ninja"; } @@ -320,7 +320,8 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand( { std::string command = "\""; command += make + "\""; - if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0) + std::string generator = this->GlobalGenerator->GetName(); + if (generator == "NMake Makefiles") { std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); command += ", \"/NOLOGO\", \"/f\", \""; @@ -329,7 +330,7 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand( command += target; command += "\""; } - else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0) + else if (generator == "Ninja") { std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); command += ", \"-f\", \""; @@ -341,7 +342,7 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand( else { std::string makefileName; - if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0) + if (generator == "MinGW Makefiles") { // no escaping of spaces in this case, see // http://public.kitware.com/Bug/view.php?id=10014 diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h index 44dfb31..4173b7d 100644 --- a/Source/cmExtraSublimeTextGenerator.h +++ b/Source/cmExtraSublimeTextGenerator.h @@ -31,15 +31,15 @@ public: typedef std::map > MapSourceFileFlags; cmExtraSublimeTextGenerator(); - virtual const char* GetName() const + virtual std::string GetName() const { return cmExtraSublimeTextGenerator::GetActualName();} - static const char* GetActualName() + static std::string GetActualName() { return "Sublime Text 2";} static cmExternalMakefileProjectGenerator* New() { return new cmExtraSublimeTextGenerator; } /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const; + const std::string& fullName) const; virtual void Generate(); private: diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 70004ea..470dea4 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -28,9 +28,9 @@ public: (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalBorlandMakefileGenerator::GetActualName();} - static const char* GetActualName() {return "Borland Makefiles";} + static std::string GetActualName() {return "Borland Makefiles";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index c1cce2e..5dee5d7 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2599,9 +2599,9 @@ void cmGlobalGenerator::SetExternalMakefileProjectGenerator( } } -const char* cmGlobalGenerator::GetExtraGeneratorName() const +std::string cmGlobalGenerator::GetExtraGeneratorName() const { - return this->ExtraGenerator==0 ? 0 : this->ExtraGenerator->GetName(); + return this->ExtraGenerator? this->ExtraGenerator->GetName() : std::string(); } void cmGlobalGenerator::FileReplacedDuringGenerate(const std::string& filename) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 761fb07..38dc63a 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -51,11 +51,11 @@ public: virtual cmLocalGenerator *CreateLocalGenerator(); ///! Get the name for this generator - virtual const char *GetName() const { return "Generic"; }; + virtual std::string GetName() const { return "Generic"; }; /** Check whether the given name matches the current generator. */ - virtual bool MatchesGeneratorName(const char* name) const - { return strcmp(this->GetName(), name) == 0; } + virtual bool MatchesGeneratorName(const std::string& name) const + { return this->GetName() == name; } /** Set the generator-specific toolset name. Returns true if toolset is supported and false otherwise. */ @@ -163,7 +163,7 @@ public: void SetExternalMakefileProjectGenerator( cmExternalMakefileProjectGenerator *extraGenerator); - const char* GetExtraGeneratorName() const; + std::string GetExtraGeneratorName() const; void AddInstallComponent(const char* component); diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index fd1d65f..3c2cd60 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -29,7 +29,8 @@ public: virtual ~cmGlobalGeneratorFactory() {} /** Create a GlobalGenerator */ - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* n) const = 0; + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& n) const = 0; /** Get the documentation entry for this factory */ virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0; @@ -43,8 +44,9 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory { public: /** Create a GlobalGenerator */ - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { - if (strcmp(name, T::GetActualName())) return 0; + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const { + if (name != T::GetActualName()) return 0; return new T; } /** Get the documentation entry for this factory */ diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index 28893bf..344e013 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -27,11 +27,11 @@ public: return new cmGlobalGeneratorSimpleFactory (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalJOMMakefileGenerator::GetActualName();} // use NMake Makefiles in the name so that scripts/tests that depend on the // name NMake Makefiles will work - static const char* GetActualName() {return "NMake Makefiles JOM";} + static std::string GetActualName() {return "NMake Makefiles JOM";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 2d485f6..71e08cc 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -25,7 +25,7 @@ //---------------------------------------------------------------------------- void cmGlobalKdevelopGenerator -::GetDocumentation(cmDocumentationEntry& entry, const char*) const +::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const { entry.Name = this->GetName(); entry.Brief = "Generates KDevelop 3 project files."; diff --git a/Source/cmGlobalKdevelopGenerator.h b/Source/cmGlobalKdevelopGenerator.h index a1ad39d..0d59fc5 100644 --- a/Source/cmGlobalKdevelopGenerator.h +++ b/Source/cmGlobalKdevelopGenerator.h @@ -33,14 +33,14 @@ class cmGlobalKdevelopGenerator : public cmExternalMakefileProjectGenerator public: cmGlobalKdevelopGenerator(); - virtual const char* GetName() const + virtual std::string GetName() const { return cmGlobalKdevelopGenerator::GetActualName();} - static const char* GetActualName() { return "KDevelop3";} + static std::string GetActualName() { return "KDevelop3";} static cmExternalMakefileProjectGenerator* New() { return new cmGlobalKdevelopGenerator; } /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const; + const std::string& fullName) const; virtual void Generate(); private: diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h index 659de11..c4825bd 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.h +++ b/Source/cmGlobalMSYSMakefileGenerator.h @@ -28,9 +28,9 @@ public: (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalMSYSMakefileGenerator::GetActualName();} - static const char* GetActualName() {return "MSYS Makefiles";} + static std::string GetActualName() {return "MSYS Makefiles";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h index 7951e98..4289422 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.h +++ b/Source/cmGlobalMinGWMakefileGenerator.h @@ -27,9 +27,9 @@ public: return new cmGlobalGeneratorSimpleFactory (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalMinGWMakefileGenerator::GetActualName();} - static const char* GetActualName() {return "MinGW Makefiles";} + static std::string GetActualName() {return "MinGW Makefiles";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index 5756fbd..2ff44e3 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -27,9 +27,9 @@ public: return new cmGlobalGeneratorSimpleFactory (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalNMakeMakefileGenerator::GetActualName();} - static const char* GetActualName() {return "NMake Makefiles";} + static std::string GetActualName() {return "NMake Makefiles";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 4a28486..2467af9 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -173,11 +173,11 @@ public: virtual cmLocalGenerator* CreateLocalGenerator(); /// Overloaded methods. @see cmGlobalGenerator::GetName(). - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalNinjaGenerator::GetActualName(); } /// @return the name of this generator. - static const char* GetActualName() { return "Ninja"; } + static std::string GetActualName() { return "Ninja"; } /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation() static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 9ddbe5b..08a1c62 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -72,7 +72,7 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const { // If generating for an extra IDE, the edit_cache target cannot // launch a terminal-interactive tool, so always use cmake-gui. - if(this->GetExtraGeneratorName()) + if(!this->GetExtraGeneratorName().empty()) { return cmSystemTools::GetCMakeGUICommand(); } @@ -579,7 +579,7 @@ void cmGlobalUnixMakefileGenerator3 // Since we have full control over the invocation of nmake, let us // make it quiet. - if ( strcmp(this->GetName(), "NMake Makefiles") == 0 ) + if ( this->GetName() == "NMake Makefiles" ) { makeCommand.push_back("/NOLOGO"); } diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index d64afaf..ea2b6c0 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -60,9 +60,9 @@ public: (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalUnixMakefileGenerator3::GetActualName();} - static const char* GetActualName() {return "Unix Makefiles";} + static std::string GetActualName() {return "Unix Makefiles";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 3819a5b..2dc658e 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -21,13 +21,14 @@ static const char vs10generatorName[] = "Visual Studio 10 2010"; // Map generator name without year to name with year. -static const char* cmVS10GenName(const char* name, std::string& genName) +static const char* cmVS10GenName(const std::string& name, std::string& genName) { - if(strncmp(name, vs10generatorName, sizeof(vs10generatorName)-6) != 0) + if(strncmp(name.c_str(), vs10generatorName, + sizeof(vs10generatorName)-6) != 0) { return 0; } - const char* p = name + sizeof(vs10generatorName) - 6; + const char* p = name.c_str() + sizeof(vs10generatorName) - 6; if(cmHasLiteralPrefix(p, " 2010")) { p += 5; @@ -40,27 +41,27 @@ class cmGlobalVisualStudio10Generator::Factory : public cmGlobalGeneratorFactory { public: - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const { std::string genName; const char* p = cmVS10GenName(name, genName); if(!p) { return 0; } - name = genName.c_str(); if(strcmp(p, "") == 0) { return new cmGlobalVisualStudio10Generator( - name, NULL, NULL); + genName, "", ""); } if(strcmp(p, " Win64") == 0) { return new cmGlobalVisualStudio10Generator( - name, "x64", "CMAKE_FORCE_WIN64"); + genName, "x64", "CMAKE_FORCE_WIN64"); } if(strcmp(p, " IA64") == 0) { return new cmGlobalVisualStudio10Generator( - name, "Itanium", "CMAKE_FORCE_IA64"); + genName, "Itanium", "CMAKE_FORCE_IA64"); } return 0; } @@ -87,8 +88,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( - const char* name, const char* platformName, - const char* additionalPlatformDefinition) + const std::string& name, const std::string& platformName, + const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio8Generator(name, platformName, additionalPlatformDefinition) { @@ -102,7 +103,8 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( //---------------------------------------------------------------------------- bool -cmGlobalVisualStudio10Generator::MatchesGeneratorName(const char* name) const +cmGlobalVisualStudio10Generator::MatchesGeneratorName( + const std::string& name) const { std::string genName; if(cmVS10GenName(name, genName)) diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 5d902ee..d3ad69e 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -24,11 +24,12 @@ class cmGlobalVisualStudio10Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio10Generator(const char* name, - const char* platformName, const char* additionalPlatformDefinition); + cmGlobalVisualStudio10Generator(const std::string& name, + const std::string& platformName, + const std::string& additionalPlatformDefinition); static cmGlobalGeneratorFactory* NewFactory(); - virtual bool MatchesGeneratorName(const char* name) const; + virtual bool MatchesGeneratorName(const std::string& name) const; virtual bool SetGeneratorToolset(std::string const& ts); diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 1f0c47a..4caa7f2 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -16,13 +16,14 @@ static const char vs11generatorName[] = "Visual Studio 11 2012"; // Map generator name without year to name with year. -static const char* cmVS11GenName(const char* name, std::string& genName) +static const char* cmVS11GenName(const std::string& name, std::string& genName) { - if(strncmp(name, vs11generatorName, sizeof(vs11generatorName)-6) != 0) + if(strncmp(name.c_str(), vs11generatorName, + sizeof(vs11generatorName)-6) != 0) { return 0; } - const char* p = name + sizeof(vs11generatorName) - 6; + const char* p = name.c_str() + sizeof(vs11generatorName) - 6; if(cmHasLiteralPrefix(p, " 2012")) { p += 5; @@ -35,27 +36,27 @@ class cmGlobalVisualStudio11Generator::Factory : public cmGlobalGeneratorFactory { public: - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const { std::string genName; const char* p = cmVS11GenName(name, genName); if(!p) { return 0; } - name = genName.c_str(); if(strcmp(p, "") == 0) { return new cmGlobalVisualStudio11Generator( - name, NULL, NULL); + genName, "", ""); } if(strcmp(p, " Win64") == 0) { return new cmGlobalVisualStudio11Generator( - name, "x64", "CMAKE_FORCE_WIN64"); + genName, "x64", "CMAKE_FORCE_WIN64"); } if(strcmp(p, " ARM") == 0) { return new cmGlobalVisualStudio11Generator( - name, "ARM", NULL); + genName, "ARM", ""); } if(*p++ != ' ') @@ -107,8 +108,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( - const char* name, const char* platformName, - const char* additionalPlatformDefinition) + const std::string& name, const std::string& platformName, + const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio10Generator(name, platformName, additionalPlatformDefinition) { @@ -121,7 +122,8 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( //---------------------------------------------------------------------------- bool -cmGlobalVisualStudio11Generator::MatchesGeneratorName(const char* name) const +cmGlobalVisualStudio11Generator::MatchesGeneratorName( + const std::string& name) const { std::string genName; if(cmVS11GenName(name, genName)) diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 7ef77e7..48ea489 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -20,11 +20,12 @@ class cmGlobalVisualStudio11Generator: public cmGlobalVisualStudio10Generator { public: - cmGlobalVisualStudio11Generator(const char* name, - const char* platformName, const char* additionalPlatformDefinition); + cmGlobalVisualStudio11Generator(const std::string& name, + const std::string& platformName, + const std::string& additionalPlatformDefinition); static cmGlobalGeneratorFactory* NewFactory(); - virtual bool MatchesGeneratorName(const char* name) const; + virtual bool MatchesGeneratorName(const std::string& name) const; virtual void WriteSLNHeader(std::ostream& fout); diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 3074794..6cd9f12 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -16,13 +16,14 @@ static const char vs12generatorName[] = "Visual Studio 12 2013"; // Map generator name without year to name with year. -static const char* cmVS12GenName(const char* name, std::string& genName) +static const char* cmVS12GenName(const std::string& name, std::string& genName) { - if(strncmp(name, vs12generatorName, sizeof(vs12generatorName)-6) != 0) + if(strncmp(name.c_str(), vs12generatorName, + sizeof(vs12generatorName)-6) != 0) { return 0; } - const char* p = name + sizeof(vs12generatorName) - 6; + const char* p = name.c_str() + sizeof(vs12generatorName) - 6; if(cmHasLiteralPrefix(p, " 2013")) { p += 5; @@ -35,27 +36,27 @@ class cmGlobalVisualStudio12Generator::Factory : public cmGlobalGeneratorFactory { public: - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const { std::string genName; const char* p = cmVS12GenName(name, genName); if(!p) { return 0; } - name = genName.c_str(); if(strcmp(p, "") == 0) { return new cmGlobalVisualStudio12Generator( - name, NULL, NULL); + genName, "", ""); } if(strcmp(p, " Win64") == 0) { return new cmGlobalVisualStudio12Generator( - name, "x64", "CMAKE_FORCE_WIN64"); + genName, "x64", "CMAKE_FORCE_WIN64"); } if(strcmp(p, " ARM") == 0) { return new cmGlobalVisualStudio12Generator( - name, "ARM", NULL); + genName, "ARM", ""); } return 0; } @@ -82,8 +83,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( - const char* name, const char* platformName, - const char* additionalPlatformDefinition) + const std::string& name, const std::string& platformName, + const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio11Generator(name, platformName, additionalPlatformDefinition) { @@ -96,7 +97,8 @@ cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( //---------------------------------------------------------------------------- bool -cmGlobalVisualStudio12Generator::MatchesGeneratorName(const char* name) const +cmGlobalVisualStudio12Generator::MatchesGeneratorName( + const std::string& name) const { std::string genName; if(cmVS12GenName(name, genName)) diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index 5a4a78d..4557f28 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -20,11 +20,12 @@ class cmGlobalVisualStudio12Generator: public cmGlobalVisualStudio11Generator { public: - cmGlobalVisualStudio12Generator(const char* name, - const char* platformName, const char* additionalPlatformDefinition); + cmGlobalVisualStudio12Generator(const std::string& name, + const std::string& platformName, + const std::string& additionalPlatformDefinition); static cmGlobalGeneratorFactory* NewFactory(); - virtual bool MatchesGeneratorName(const char* name) const; + virtual bool MatchesGeneratorName(const std::string& name) const; virtual void WriteSLNHeader(std::ostream& fout); diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index eb3dddf..14046f0 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -31,9 +31,9 @@ public: (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalVisualStudio6Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 6";} + static std::string GetActualName() {return "Visual Studio 6";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 08bcc5b..4bea5ac 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -17,7 +17,8 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator( - const char* platformName) : cmGlobalVisualStudio7Generator(platformName) + const std::string& platformName) + : cmGlobalVisualStudio7Generator(platformName) { this->ProjectConfigurationSectionName = "ProjectConfiguration"; } @@ -279,10 +280,10 @@ void cmGlobalVisualStudio71Generator ::WriteProjectConfigurations( std::ostream& fout, const std::string& name, cmTarget::TargetType, const std::set& configsPartOfDefaultBuild, - const char* platformMapping) + std::string const& platformMapping) { - const char* platformName = - platformMapping ? platformMapping : this->GetPlatformName(); + const std::string& platformName = + !platformMapping.empty() ? platformMapping : this->GetPlatformName(); std::string guid = this->GetGUID(name); for(std::vector::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 75cc6ae..2b5259a 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -23,15 +23,15 @@ class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator { public: - cmGlobalVisualStudio71Generator(const char* platformName = NULL); + cmGlobalVisualStudio71Generator(const std::string& platformName = ""); static cmGlobalGeneratorFactory* NewFactory() { return new cmGlobalGeneratorSimpleFactory (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalVisualStudio71Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 7 .NET 2003";} + static std::string GetActualName() {return "Visual Studio 7 .NET 2003";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); @@ -67,7 +67,7 @@ protected: virtual void WriteProjectConfigurations( std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, - const char* platformMapping = NULL); + const std::string& platformMapping = ""); virtual void WriteExternalProject(std::ostream& fout, const std::string& name, const char* path, diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 3927100..03772dd 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -19,16 +19,19 @@ #include cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( - const char* platformName) + const std::string& platformName) { this->IntelProjectVersion = 0; this->DevEnvCommandInitialized = false; - if (!platformName) + if (platformName.empty()) { - platformName = "Win32"; + this->PlatformName = "Win32"; + } + else + { + this->PlatformName = platformName; } - this->PlatformName = platformName; } cmGlobalVisualStudio7Generator::~cmGlobalVisualStudio7Generator() @@ -260,7 +263,7 @@ cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator() void cmGlobalVisualStudio7Generator::AddPlatformDefinitions(cmMakefile* mf) { cmGlobalVisualStudioGenerator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName()); + mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str()); mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION", this->GetIntelProjectVersion()); } @@ -381,9 +384,10 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( { std::set allConfigurations(this->Configurations.begin(), this->Configurations.end()); + const char* mapping = target->GetProperty("VS_PLATFORM_MAPPING"); this->WriteProjectConfigurations( fout, target->GetName().c_str(), target->GetType(), - allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING")); + allConfigurations, mapping ? mapping : ""); } else { @@ -732,10 +736,10 @@ void cmGlobalVisualStudio7Generator ::WriteProjectConfigurations( std::ostream& fout, const std::string& name, cmTarget::TargetType, const std::set& configsPartOfDefaultBuild, - const char* platformMapping) + const std::string& platformMapping) { - const char* platformName = - platformMapping ? platformMapping : this->GetPlatformName(); + const std::string& platformName = + !platformMapping.empty() ? platformMapping : this->GetPlatformName(); std::string guid = this->GetGUID(name); for(std::vector::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index b659480..9ab0462 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -26,7 +26,7 @@ struct cmIDEFlagTable; class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator { public: - cmGlobalVisualStudio7Generator(const char* platformName = NULL); + cmGlobalVisualStudio7Generator(const std::string& platformName = ""); ~cmGlobalVisualStudio7Generator(); static cmGlobalGeneratorFactory* NewFactory() { @@ -34,12 +34,12 @@ public: (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalVisualStudio7Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 7";} + static std::string GetActualName() {return "Visual Studio 7";} ///! Get the name for the platform. - const char* GetPlatformName() const { return this->PlatformName.c_str(); } + const std::string& GetPlatformName() const { return this->PlatformName; } ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); @@ -131,7 +131,7 @@ protected: virtual void WriteProjectConfigurations( std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, - const char* platformMapping = NULL); + const std::string& platformMapping = ""); virtual void WriteSLNGlobalSections(std::ostream& fout, cmLocalGenerator* root); virtual void WriteSLNFooter(std::ostream& fout); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 2ae1bbc..08c1397 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -23,17 +23,19 @@ class cmGlobalVisualStudio8Generator::Factory : public cmGlobalGeneratorFactory { public: - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { - if(strstr(name, vs8generatorName) != name) + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const { + if(strncmp(name.c_str(), vs8generatorName, + sizeof(vs8generatorName) - 1) != 0) { return 0; } - const char* p = name + sizeof(vs8generatorName) - 1; + const char* p = name.c_str() + sizeof(vs8generatorName) - 1; if(p[0] == '\0') { return new cmGlobalVisualStudio8Generator( - name, NULL, NULL); + name, "", ""); } if(p[0] != ' ') @@ -57,7 +59,7 @@ public: } cmGlobalVisualStudio8Generator* ret = new cmGlobalVisualStudio8Generator( - name, p, NULL); + name, p, ""); ret->WindowsCEVersion = parser.GetOSVersion(); return ret; } @@ -90,14 +92,14 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator( - const char* name, const char* platformName, - const char* additionalPlatformDefinition) + const std::string& name, const std::string& platformName, + const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio71Generator(platformName) { this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; this->Name = name; - if (additionalPlatformDefinition) + if (!additionalPlatformDefinition.empty()) { this->AdditionalPlatformDefinition = additionalPlatformDefinition; } @@ -374,7 +376,7 @@ cmGlobalVisualStudio8Generator ::WriteProjectConfigurations( std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, - const char* platformMapping) + std::string const& platformMapping) { std::string guid = this->GetGUID(name); for(std::vector::iterator i = this->Configurations.begin(); @@ -382,7 +384,8 @@ cmGlobalVisualStudio8Generator { fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() << ".ActiveCfg = " << *i << "|" - << (platformMapping ? platformMapping : this->GetPlatformName()) + << (!platformMapping.empty()? + platformMapping : this->GetPlatformName()) << "\n"; std::set::const_iterator ci = configsPartOfDefaultBuild.find(*i); @@ -390,7 +393,8 @@ cmGlobalVisualStudio8Generator { fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() << ".Build.0 = " << *i << "|" - << (platformMapping ? platformMapping : this->GetPlatformName()) + << (!platformMapping.empty()? + platformMapping : this->GetPlatformName()) << "\n"; } bool needsDeploy = (type == cmTarget::EXECUTABLE || @@ -399,7 +403,8 @@ cmGlobalVisualStudio8Generator { fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|" - << (platformMapping ? platformMapping : this->GetPlatformName()) + << (!platformMapping.empty()? + platformMapping : this->GetPlatformName()) << "\n"; } } diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index bafb9eb..2459c05 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -23,12 +23,13 @@ class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator { public: - cmGlobalVisualStudio8Generator(const char* name, - const char* platformName, const char* additionalPlatformDefinition); + cmGlobalVisualStudio8Generator(const std::string& name, + const std::string& platformName, + const std::string& additionalPlatformDefinition); static cmGlobalGeneratorFactory* NewFactory(); ///! Get the name for the generator. - virtual const char* GetName() const {return this->Name.c_str();} + virtual std::string GetName() const {return this->Name;} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); @@ -81,7 +82,7 @@ protected: virtual void WriteProjectConfigurations( std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, - const char* platformMapping = NULL); + const std::string& platformMapping = ""); virtual bool ComputeTargetDepends(); virtual void WriteProjectDepends(std::ostream& fout, const std::string& name, diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index ccc27ad..c0051c7 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -22,17 +22,19 @@ class cmGlobalVisualStudio9Generator::Factory : public cmGlobalGeneratorFactory { public: - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { - if(strstr(name, vs9generatorName) != name) + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const { + if(strncmp(name.c_str(), vs9generatorName, + sizeof(vs9generatorName) - 1) != 0) { return 0; } - const char* p = name + sizeof(vs9generatorName) - 1; + const char* p = name.c_str() + sizeof(vs9generatorName) - 1; if(p[0] == '\0') { return new cmGlobalVisualStudio9Generator( - name, NULL, NULL); + name, "", ""); } if(p[0] != ' ') @@ -96,8 +98,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( - const char* name, const char* platformName, - const char* additionalPlatformDefinition) + const std::string& name, const std::string& platformName, + const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio8Generator(name, platformName, additionalPlatformDefinition) { diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index 202aa8d..fb87bbe 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -24,8 +24,9 @@ class cmGlobalVisualStudio9Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio9Generator(const char* name, - const char* platformName, const char* additionalPlatformDefinition); + cmGlobalVisualStudio9Generator(const std::string& name, + const std::string& platformName, + const std::string& additionalPlatformDefinition); static cmGlobalGeneratorFactory* NewFactory(); ///! create the correct local generator diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index b2a705e..69c893c 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -22,7 +22,7 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() { - this->AdditionalPlatformDefinition = NULL; + this->AdditionalPlatformDefinition = ""; } //---------------------------------------------------------------------------- @@ -518,7 +518,7 @@ void cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf) //---------------------------------------------------------------------------- void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf) { - if(this->AdditionalPlatformDefinition) + if(!this->AdditionalPlatformDefinition.empty()) { mf->AddDefinition(this->AdditionalPlatformDefinition, "TRUE"); } diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index dc0f9c7..7e8dcf8 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -110,7 +110,7 @@ protected: std::string GetUtilityDepend(cmTarget const* target); typedef std::map UtilityDependsMap; UtilityDependsMap UtilityDepends; - const char* AdditionalPlatformDefinition; + std::string AdditionalPlatformDefinition; private: virtual std::string GetVSMakeProgram() = 0; diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index d5350ef..2057a42 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -27,9 +27,9 @@ public: return new cmGlobalGeneratorSimpleFactory (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalWatcomWMakeGenerator::GetActualName();} - static const char* GetActualName() {return "Watcom WMake";} + static std::string GetActualName() {return "Watcom WMake";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e1f2a91..30bded5 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -116,7 +116,8 @@ public: class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory { public: - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const; + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const; virtual void GetDocumentation(cmDocumentationEntry& entry) const { cmGlobalXCodeGenerator::GetDocumentation(entry); } @@ -152,9 +153,9 @@ cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory() //---------------------------------------------------------------------------- cmGlobalGenerator* cmGlobalXCodeGenerator::Factory -::CreateGlobalGenerator(const char* name) const +::CreateGlobalGenerator(const std::string& name) const { - if (strcmp(name, GetActualName())) + if (name != GetActualName()) return 0; #if defined(CMAKE_BUILD_WITH_CMAKE) cmXcodeVersionParser parser; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index aec7958..54c6f96 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -33,9 +33,9 @@ public: static cmGlobalGeneratorFactory* NewFactory(); ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalXCodeGenerator::GetActualName();} - static const char* GetActualName() {return "Xcode";} + static std::string GetActualName() {return "Xcode";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index d2e66a5..6c04559 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -53,7 +53,7 @@ public: */ void SetBuildType(BuildType,const std::string& name); - void SetPlatformName(const char* n) { this->PlatformName = n;} + void SetPlatformName(const std::string& n) { this->PlatformName = n;} void SetExtraFlagTable(cmVS7FlagTable const* table) { this->ExtraFlagTable = table; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e61b12b..e8be29f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1378,8 +1378,8 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) // VS6 IDE does not support definition values with spaces in // combination with '"', '$', or ';'. - if((strcmp(this->LocalGenerator->GetGlobalGenerator()->GetName(), - "Visual Studio 6") == 0) && + if((this->LocalGenerator->GetGlobalGenerator()->GetName() == + "Visual Studio 6") && (def.find(" ") != def.npos && def.find_first_of("\"$;") != def.npos)) { return false; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 48a6b38..c32f624 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -251,7 +251,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) bool usePRE_BUILD = false; cmLocalGenerator* localGen = makefile->GetLocalGenerator(); cmGlobalGenerator* gg = localGen->GetGlobalGenerator(); - if(strstr(gg->GetName(), "Visual Studio")) + if(gg->GetName().find("Visual Studio") != std::string::npos) { cmLocalVisualStudioGenerator* vslg = static_cast(localGen); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 13572f4..abe27a5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -965,7 +965,7 @@ int cmake::AddCMakePaths() return 1; } -void cmake::AddExtraGenerator(const char* name, +void cmake::AddExtraGenerator(const std::string& name, CreateExtraGeneratorFunctionType newFunction) { cmExternalMakefileProjectGenerator* extraGenerator = newFunction(); @@ -1034,9 +1034,10 @@ void cmake::GetRegisteredGenerators(std::vector& names) } } -cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name) +cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname) { cmExternalMakefileProjectGenerator* extraGenerator = 0; + std::string name = gname; RegisteredExtraGeneratorsMap::const_iterator extraGenIt = this->ExtraGenerators.find(name); if (extraGenIt != this->ExtraGenerators.end()) @@ -1324,7 +1325,8 @@ int cmake::ActualConfigure() if(genName) { std::string fullName = cmExternalMakefileProjectGenerator:: - CreateFullGeneratorName(genName, extraGenName); + CreateFullGeneratorName(genName, + extraGenName ? extraGenName : ""); this->GlobalGenerator = this->CreateGlobalGenerator(fullName.c_str()); } if(this->GlobalGenerator) @@ -1417,13 +1419,13 @@ int cmake::ActualConfigure() if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR")) { this->CacheManager->AddCacheEntry("CMAKE_GENERATOR", - this->GlobalGenerator->GetName(), + this->GlobalGenerator->GetName().c_str(), "Name of generator.", cmCacheManager::INTERNAL); this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR", - this->GlobalGenerator->GetExtraGeneratorName(), - "Name of external makefile project generator.", - cmCacheManager::INTERNAL); + this->GlobalGenerator->GetExtraGeneratorName().c_str(), + "Name of external makefile project generator.", + cmCacheManager::INTERNAL); } if(const char* tsName = diff --git a/Source/cmake.h b/Source/cmake.h index 933502a..3134493 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -175,7 +175,7 @@ class cmake void PreLoadCMakeFiles(); ///! Create a GlobalGenerator - cmGlobalGenerator* CreateGlobalGenerator(const char* name); + cmGlobalGenerator* CreateGlobalGenerator(const std::string& name); ///! Return the global generator assigned to this instance of cmake cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; } @@ -380,7 +380,7 @@ protected: void AddDefaultCommands(); void AddDefaultGenerators(); void AddDefaultExtraGenerators(); - void AddExtraGenerator(const char* name, + void AddExtraGenerator(const std::string& name, CreateExtraGeneratorFunctionType newFunction); cmPolicies *Policies; -- cgit v0.12 From 6557382dcffef8ed6b11394cb65775d82f1c0aa7 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 17:38:55 -0500 Subject: stringapi: Use strings for program paths --- Source/cmBuildCommand.cxx | 4 ++-- Source/cmGlobalGenerator.cxx | 31 ++++++++++++++++++------------ Source/cmGlobalGenerator.h | 8 ++++---- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 2 +- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 2 +- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmake.cxx | 2 +- 16 files changed, 38 insertions(+), 31 deletions(-) diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index d8e1a2c..780ffa8 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -107,7 +107,7 @@ bool cmBuildCommand std::string makecommand = this->Makefile->GetLocalGenerator() ->GetGlobalGenerator()->GenerateCMakeBuildCommand(target, configuration, - 0, true); + "", true); this->Makefile->AddDefinition(variable, makecommand.c_str()); @@ -137,7 +137,7 @@ bool cmBuildCommand std::string makecommand = this->Makefile->GetLocalGenerator() ->GetGlobalGenerator()->GenerateCMakeBuildCommand("", configType.c_str(), - 0, true); + "", true); if(cacheValue) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 5dee5d7..faed66a 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -89,19 +89,25 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts) return false; } -std::string cmGlobalGenerator::SelectMakeProgram(const char* makeProgram, - std::string makeDefault) const +std::string cmGlobalGenerator::SelectMakeProgram( + const std::string& inMakeProgram, + const std::string& makeDefault) const { - if(cmSystemTools::IsOff(makeProgram)) + std::string makeProgram = inMakeProgram; + if(cmSystemTools::IsOff(makeProgram.c_str())) { - makeProgram = + const char* makeProgramCSTR = this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM"); - if(cmSystemTools::IsOff(makeProgram)) + if(cmSystemTools::IsOff(makeProgramCSTR)) { - makeProgram = makeDefault.c_str(); + makeProgram = makeDefault; } - if(cmSystemTools::IsOff(makeProgram) && - !(makeProgram && *makeProgram)) + else + { + makeProgram = makeProgramCSTR; + } + if(cmSystemTools::IsOff(makeProgram.c_str()) && + !makeProgram.empty()) { makeProgram = "CMAKE_MAKE_PROGRAM-NOTFOUND"; } @@ -1660,13 +1666,14 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir, mf->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"); return this->Build(srcdir,bindir,projectName, newTarget.c_str(), - output,0,config,false,fast, + output,"",config,false,fast, this->TryCompileTimeout); } void cmGlobalGenerator::GenerateBuildCommand( - std::vector& makeCommand, const char*, const std::string&, - const std::string&, const std::string&, const std::string&, bool, + std::vector& makeCommand, const std::string&, + const std::string&, const std::string&, const std::string&, + const std::string&, bool, std::vector const&) { makeCommand.push_back( @@ -1677,7 +1684,7 @@ int cmGlobalGenerator::Build( const std::string&, const std::string& bindir, const std::string& projectName, const std::string& target, std::string *output, - const char *makeCommandCSTR, + const std::string& makeCommandCSTR, const std::string& config, bool clean, bool fast, double timeout, diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 38dc63a..91e71a8 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -120,7 +120,7 @@ public: int Build(const std::string& srcdir, const std::string& bindir, const std::string& projectName, const std::string& targetName, std::string *output, - const char *makeProgram, const std::string& config, + const std::string& makeProgram, const std::string& config, bool clean, bool fast, double timeout, cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE, @@ -129,7 +129,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, std::vector const& makeOptions = std::vector() @@ -345,8 +345,8 @@ protected: cmTarget const*> > AutogensType; void CreateQtAutoGeneratorsTargets(AutogensType& autogens); - std::string SelectMakeProgram(const char* makeProgram, - std::string makeDefault = "") const; + std::string SelectMakeProgram(const std::string& makeProgram, + const std::string& makeDefault = "") const; // Fill the ProjectMap, this must be called after LocalGenerators // has been populated. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 73a6245..785b902 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -551,7 +551,7 @@ bool cmGlobalNinjaGenerator::UsingMinGW = false; // cmGlobalGenerator::Build() void cmGlobalNinjaGenerator ::GenerateBuildCommand(std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& /*projectName*/, const std::string& /*projectDir*/, const std::string& targetName, diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 2467af9..7725cf3 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -193,7 +193,7 @@ public: /// Overloaded methods. @see cmGlobalGenerator::GenerateBuildCommand() virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 08a1c62..d41cee6 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -565,7 +565,7 @@ cmGlobalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmGlobalUnixMakefileGenerator3 ::GenerateBuildCommand(std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& /*projectName*/, const std::string& /*projectDir*/, const std::string& targetName, diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index ea2b6c0..8115176 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -109,7 +109,7 @@ public: // change the build command for speed virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 2dc658e..840e888 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -312,7 +312,7 @@ std::string cmGlobalVisualStudio10Generator::FindDevEnvCommand() //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator::GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index d3ad69e..999a9d5 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -35,7 +35,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 3a51fce..7397bbb 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -116,7 +116,7 @@ std::string cmGlobalVisualStudio6Generator::FindMSDevCommand() void cmGlobalVisualStudio6Generator::GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& /*projectDir*/, const std::string& targetName, diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 14046f0..2797e11 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -54,7 +54,7 @@ public: */ virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 03772dd..320b440 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -186,7 +186,7 @@ const char* cmGlobalVisualStudio7Generator::ExternalProjectType( //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator::GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& /*projectDir*/, const std::string& targetName, diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 9ab0462..0d2e410 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -62,7 +62,7 @@ public: */ virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 30bded5..30a2a1e 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -261,7 +261,7 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vectorconst& void cmGlobalXCodeGenerator::GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& /*projectDir*/, const std::string& targetName, diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 54c6f96..93315ba 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -55,7 +55,7 @@ public: */ virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmake.cxx b/Source/cmake.cxx index abe27a5..ab12411 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2672,7 +2672,7 @@ int cmake::Build(const std::string& dir, return gen->Build("", dir.c_str(), projName.c_str(), target.c_str(), &output, - 0, + "", config.c_str(), clean, false, 0, cmSystemTools::OUTPUT_PASSTHROUGH, nativeOptions); -- cgit v0.12 From 85fc9f26a703f28b356c93d405446c39bba43846 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 20:19:17 -0500 Subject: stringapi: Command names --- Source/CTest/cmCTestBuildCommand.h | 2 +- Source/CTest/cmCTestConfigureCommand.h | 2 +- Source/CTest/cmCTestCoverageCommand.h | 2 +- Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h | 2 +- Source/CTest/cmCTestMemCheckCommand.h | 2 +- Source/CTest/cmCTestReadCustomFilesCommand.h | 2 +- Source/CTest/cmCTestRunScriptCommand.h | 2 +- Source/CTest/cmCTestSleepCommand.h | 2 +- Source/CTest/cmCTestStartCommand.h | 2 +- Source/CTest/cmCTestSubmitCommand.h | 2 +- Source/CTest/cmCTestTestCommand.h | 2 +- Source/CTest/cmCTestTestHandler.cxx | 8 ++++---- Source/CTest/cmCTestUpdateCommand.h | 2 +- Source/CTest/cmCTestUploadCommand.h | 2 +- Source/cmAddCompileOptionsCommand.h | 2 +- Source/cmAddCustomCommandCommand.h | 2 +- Source/cmAddCustomTargetCommand.h | 2 +- Source/cmAddDefinitionsCommand.h | 2 +- Source/cmAddDependenciesCommand.h | 2 +- Source/cmAddExecutableCommand.h | 2 +- Source/cmAddLibraryCommand.h | 2 +- Source/cmAddSubDirectoryCommand.h | 2 +- Source/cmAddTestCommand.h | 2 +- Source/cmAuxSourceDirectoryCommand.h | 2 +- Source/cmBreakCommand.h | 2 +- Source/cmBuildCommand.h | 2 +- Source/cmBuildNameCommand.h | 2 +- Source/cmCMakeHostSystemInformationCommand.h | 2 +- Source/cmCMakeMinimumRequired.h | 2 +- Source/cmCMakePolicyCommand.h | 2 +- Source/cmCommand.h | 2 +- Source/cmConfigureFileCommand.h | 2 +- Source/cmCreateTestSourceList.h | 2 +- Source/cmDefinePropertyCommand.h | 2 +- Source/cmDocumentationSection.h | 4 ++-- Source/cmElseCommand.h | 2 +- Source/cmElseIfCommand.h | 2 +- Source/cmEnableLanguageCommand.h | 2 +- Source/cmEnableTestingCommand.h | 2 +- Source/cmEndForEachCommand.h | 2 +- Source/cmEndFunctionCommand.h | 2 +- Source/cmEndIfCommand.h | 2 +- Source/cmEndMacroCommand.h | 2 +- Source/cmEndWhileCommand.h | 2 +- Source/cmExecProgramCommand.h | 2 +- Source/cmExecuteProcessCommand.h | 2 +- Source/cmExportCommand.h | 2 +- Source/cmExportLibraryDependenciesCommand.h | 2 +- Source/cmFLTKWrapUICommand.h | 2 +- Source/cmFileCommand.h | 2 +- Source/cmFindFileCommand.h | 2 +- Source/cmFindLibraryCommand.h | 2 +- Source/cmFindPackageCommand.h | 2 +- Source/cmFindPathCommand.h | 2 +- Source/cmFindProgramCommand.h | 2 +- Source/cmForEachCommand.h | 2 +- Source/cmFunctionCommand.cxx | 2 +- Source/cmFunctionCommand.h | 2 +- Source/cmGetCMakePropertyCommand.h | 2 +- Source/cmGetDirectoryPropertyCommand.h | 2 +- Source/cmGetFilenameComponentCommand.h | 2 +- Source/cmGetPropertyCommand.h | 2 +- Source/cmGetSourceFilePropertyCommand.h | 2 +- Source/cmGetTargetPropertyCommand.h | 2 +- Source/cmGetTestPropertyCommand.h | 2 +- Source/cmIfCommand.h | 2 +- Source/cmIncludeCommand.h | 2 +- Source/cmIncludeDirectoryCommand.h | 2 +- Source/cmIncludeExternalMSProjectCommand.h | 2 +- Source/cmIncludeRegularExpressionCommand.h | 2 +- Source/cmInstallCommand.h | 2 +- Source/cmInstallFilesCommand.h | 2 +- Source/cmInstallProgramsCommand.h | 2 +- Source/cmInstallTargetsCommand.h | 2 +- Source/cmLinkDirectoriesCommand.h | 2 +- Source/cmLinkLibrariesCommand.h | 2 +- Source/cmListCommand.h | 2 +- Source/cmLoadCacheCommand.h | 2 +- Source/cmLoadCommandCommand.cxx | 2 +- Source/cmLoadCommandCommand.h | 2 +- Source/cmMacroCommand.cxx | 2 +- Source/cmMacroCommand.h | 2 +- Source/cmMakeDirectoryCommand.h | 2 +- Source/cmMarkAsAdvancedCommand.h | 2 +- Source/cmMathCommand.h | 2 +- Source/cmMessageCommand.h | 2 +- Source/cmOptionCommand.h | 2 +- Source/cmOutputRequiredFilesCommand.h | 2 +- Source/cmProjectCommand.h | 2 +- Source/cmQTWrapCPPCommand.h | 2 +- Source/cmQTWrapUICommand.h | 2 +- Source/cmRemoveCommand.h | 2 +- Source/cmRemoveDefinitionsCommand.h | 2 +- Source/cmReturnCommand.h | 2 +- Source/cmSeparateArgumentsCommand.h | 2 +- Source/cmSetCommand.h | 2 +- Source/cmSetDirectoryPropertiesCommand.h | 2 +- Source/cmSetPropertyCommand.h | 2 +- Source/cmSetSourceFilesPropertiesCommand.h | 2 +- Source/cmSetTargetPropertiesCommand.h | 2 +- Source/cmSetTestsPropertiesCommand.h | 2 +- Source/cmSiteNameCommand.h | 2 +- Source/cmSourceGroupCommand.h | 2 +- Source/cmStringCommand.h | 2 +- Source/cmSubdirCommand.h | 2 +- Source/cmSubdirDependsCommand.h | 2 +- Source/cmTargetCompileDefinitionsCommand.h | 2 +- Source/cmTargetCompileOptionsCommand.h | 2 +- Source/cmTargetIncludeDirectoriesCommand.h | 2 +- Source/cmTargetLinkLibrariesCommand.h | 2 +- Source/cmTryCompileCommand.h | 2 +- Source/cmTryRunCommand.h | 2 +- Source/cmUnsetCommand.h | 2 +- Source/cmUseMangledMesaCommand.h | 2 +- Source/cmUtilitySourceCommand.h | 2 +- Source/cmVariableRequiresCommand.h | 2 +- Source/cmVariableWatchCommand.h | 2 +- Source/cmWhileCommand.h | 2 +- Source/cmWriteFileCommand.h | 2 +- Source/cmake.cxx | 9 +++++---- Source/cmake.h | 8 ++++---- 121 files changed, 132 insertions(+), 131 deletions(-) diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index 08887fe..2632ebc 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -43,7 +43,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_build";} + virtual std::string GetName() const { return "ctest_build";} virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h index b592c5a..7941d4e 100644 --- a/Source/CTest/cmCTestConfigureCommand.h +++ b/Source/CTest/cmCTestConfigureCommand.h @@ -38,7 +38,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_configure";} + virtual std::string GetName() const { return "ctest_configure";} cmTypeMacro(cmCTestConfigureCommand, cmCTestHandlerCommand); diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h index 3731592..5762e07 100644 --- a/Source/CTest/cmCTestCoverageCommand.h +++ b/Source/CTest/cmCTestCoverageCommand.h @@ -39,7 +39,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_coverage";} + virtual std::string GetName() const { return "ctest_coverage";} cmTypeMacro(cmCTestCoverageCommand, cmCTestHandlerCommand); diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h index 07e59a4..d182d17 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h @@ -48,7 +48,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_empty_binary_directory";} + virtual std::string GetName() const { return "ctest_empty_binary_directory";} cmTypeMacro(cmCTestEmptyBinaryDirectoryCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h index b50170d..e239d46 100644 --- a/Source/CTest/cmCTestMemCheckCommand.h +++ b/Source/CTest/cmCTestMemCheckCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_memcheck";} + virtual std::string GetName() const { return "ctest_memcheck";} cmTypeMacro(cmCTestMemCheckCommand, cmCTestTestCommand); diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h index 9c0af81..c95694a 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.h +++ b/Source/CTest/cmCTestReadCustomFilesCommand.h @@ -46,7 +46,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_read_custom_files";} + virtual std::string GetName() const { return "ctest_read_custom_files";} cmTypeMacro(cmCTestReadCustomFilesCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h index f34bd13..0998e5c 100644 --- a/Source/CTest/cmCTestRunScriptCommand.h +++ b/Source/CTest/cmCTestRunScriptCommand.h @@ -47,7 +47,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_run_script";} + virtual std::string GetName() const { return "ctest_run_script";} cmTypeMacro(cmCTestRunScriptCommand, cmCTestCommand); }; diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index c6baf1c..740a7e1 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/Source/CTest/cmCTestSleepCommand.h @@ -47,7 +47,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_sleep";} + virtual std::string GetName() const { return "ctest_sleep";} cmTypeMacro(cmCTestSleepCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index e5535c1..3b8843f 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -55,7 +55,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_start";} + virtual std::string GetName() const { return "ctest_start";} cmTypeMacro(cmCTestStartCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h index 64c6cae..3673fbd 100644 --- a/Source/CTest/cmCTestSubmitCommand.h +++ b/Source/CTest/cmCTestSubmitCommand.h @@ -48,7 +48,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_submit";} + virtual std::string GetName() const { return "ctest_submit";} cmTypeMacro(cmCTestSubmitCommand, cmCTestHandlerCommand); diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index 451ac99..a1e5f36 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -39,7 +39,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_test";} + virtual std::string GetName() const { return "ctest_test";} cmTypeMacro(cmCTestTestCommand, cmCTestHandlerCommand); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index b1dddcb..5970656 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -60,7 +60,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "subdirs";} + virtual std::string GetName() const { return "subdirs";} cmTypeMacro(cmCTestSubdirCommand, cmCommand); @@ -157,7 +157,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_subdirectory";} + virtual std::string GetName() const { return "add_subdirectory";} cmTypeMacro(cmCTestAddSubdirectoryCommand, cmCommand); @@ -243,7 +243,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_test";} + virtual std::string GetName() const { return "add_test";} cmTypeMacro(cmCTestAddTestCommand, cmCommand); @@ -287,7 +287,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "set_tests_properties";} + virtual std::string GetName() const { return "set_tests_properties";} cmTypeMacro(cmCTestSetTestsPropertiesCommand, cmCommand); diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h index a785bd8..fb80333 100644 --- a/Source/CTest/cmCTestUpdateCommand.h +++ b/Source/CTest/cmCTestUpdateCommand.h @@ -39,7 +39,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_update";} + virtual std::string GetName() const { return "ctest_update";} cmTypeMacro(cmCTestUpdateCommand, cmCTestHandlerCommand); diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h index e867fb6..4a07608 100644 --- a/Source/CTest/cmCTestUploadCommand.h +++ b/Source/CTest/cmCTestUploadCommand.h @@ -43,7 +43,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_upload";} + virtual std::string GetName() const { return "ctest_upload";} cmTypeMacro(cmCTestUploadCommand, cmCTestHandlerCommand); diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h index 38ed208..f147ec0 100644 --- a/Source/cmAddCompileOptionsCommand.h +++ b/Source/cmAddCompileOptionsCommand.h @@ -35,7 +35,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "add_compile_options";} + virtual std::string GetName() const {return "add_compile_options";} cmTypeMacro(cmAddCompileOptionsCommand, cmCommand); }; diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index 114957f..1d6ddb2 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/Source/cmAddCustomCommandCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "add_custom_command";} + virtual std::string GetName() const {return "add_custom_command";} cmTypeMacro(cmAddCustomCommandCommand, cmCommand); protected: diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h index d0fcdad..d2b00ad 100644 --- a/Source/cmAddCustomTargetCommand.h +++ b/Source/cmAddCustomTargetCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const + virtual std::string GetName() const {return "add_custom_target";} cmTypeMacro(cmAddCustomTargetCommand, cmCommand); diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h index d05f187..9800fd2 100644 --- a/Source/cmAddDefinitionsCommand.h +++ b/Source/cmAddDefinitionsCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "add_definitions";} + virtual std::string GetName() const {return "add_definitions";} cmTypeMacro(cmAddDefinitionsCommand, cmCommand); }; diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h index 247cc54..db3712a 100644 --- a/Source/cmAddDependenciesCommand.h +++ b/Source/cmAddDependenciesCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_dependencies";} + virtual std::string GetName() const { return "add_dependencies";} cmTypeMacro(cmAddDependenciesCommand, cmCommand); }; diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h index 30ecce3..e134077 100644 --- a/Source/cmAddExecutableCommand.h +++ b/Source/cmAddExecutableCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_executable";} + virtual std::string GetName() const { return "add_executable";} cmTypeMacro(cmAddExecutableCommand, cmCommand); }; diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h index 1001043..350708b 100644 --- a/Source/cmAddLibraryCommand.h +++ b/Source/cmAddLibraryCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_library";} + virtual std::string GetName() const { return "add_library";} cmTypeMacro(cmAddLibraryCommand, cmCommand); }; diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h index 1e5b1ab..abf3efc 100644 --- a/Source/cmAddSubDirectoryCommand.h +++ b/Source/cmAddSubDirectoryCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_subdirectory";} + virtual std::string GetName() const { return "add_subdirectory";} cmTypeMacro(cmAddSubDirectoryCommand, cmCommand); }; diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index 9173454..624288f 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_test";} + virtual std::string GetName() const { return "add_test";} cmTypeMacro(cmAddTestCommand, cmCommand); private: diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h index 8b5fa8a..6615273 100644 --- a/Source/cmAuxSourceDirectoryCommand.h +++ b/Source/cmAuxSourceDirectoryCommand.h @@ -44,7 +44,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "aux_source_directory";} + virtual std::string GetName() const { return "aux_source_directory";} cmTypeMacro(cmAuxSourceDirectoryCommand, cmCommand); }; diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h index 52f0e9c..1fcae50 100644 --- a/Source/cmBreakCommand.h +++ b/Source/cmBreakCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "break";} + virtual std::string GetName() const {return "break";} cmTypeMacro(cmBreakCommand, cmCommand); }; diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h index 2160655..3fb618f 100644 --- a/Source/cmBuildCommand.h +++ b/Source/cmBuildCommand.h @@ -50,7 +50,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "build_command";} + virtual std::string GetName() const {return "build_command";} cmTypeMacro(cmBuildCommand, cmCommand); }; diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h index 2f7acde..8f8038f 100644 --- a/Source/cmBuildNameCommand.h +++ b/Source/cmBuildNameCommand.h @@ -21,7 +21,7 @@ public: virtual cmCommand* Clone() { return new cmBuildNameCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const {return "build_name";} + virtual std::string GetName() const {return "build_name";} virtual bool IsScriptable() const { return true; } virtual bool IsDiscouraged() const { return true; } }; diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h index 27ba638..463b180 100644 --- a/Source/cmCMakeHostSystemInformationCommand.h +++ b/Source/cmCMakeHostSystemInformationCommand.h @@ -48,7 +48,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const + virtual std::string GetName() const { return "cmake_host_system_information"; } diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index 0cdd4c5..31b7271 100644 --- a/Source/cmCMakeMinimumRequired.h +++ b/Source/cmCMakeMinimumRequired.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "cmake_minimum_required";} + virtual std::string GetName() const {return "cmake_minimum_required";} cmTypeMacro(cmCMakeMinimumRequired, cmCommand); diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h index 7e3f4e6..8dc8fbe 100644 --- a/Source/cmCMakePolicyCommand.h +++ b/Source/cmCMakePolicyCommand.h @@ -46,7 +46,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "cmake_policy";} + virtual std::string GetName() const {return "cmake_policy";} cmTypeMacro(cmCMakePolicyCommand, cmCommand); private: diff --git a/Source/cmCommand.h b/Source/cmCommand.h index 2378ef0..b15869a 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -124,7 +124,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const = 0; + virtual std::string GetName() const = 0; /** * Enable the command. diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index 86de92c..8155ef7 100644 --- a/Source/cmConfigureFileCommand.h +++ b/Source/cmConfigureFileCommand.h @@ -34,7 +34,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "configure_file";} + virtual std::string GetName() const { return "configure_file";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h index 8b1e4de..2f6b541 100644 --- a/Source/cmCreateTestSourceList.h +++ b/Source/cmCreateTestSourceList.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "create_test_sourcelist";} + virtual std::string GetName() const {return "create_test_sourcelist";} cmTypeMacro(cmCreateTestSourceList, cmCommand); }; diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h index 8dc4d96..bc5c8a4 100644 --- a/Source/cmDefinePropertyCommand.h +++ b/Source/cmDefinePropertyCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "define_property";} + virtual std::string GetName() const { return "define_property";} cmTypeMacro(cmDefinePropertyCommand, cmCommand); private: diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h index 636860d..d796da8 100644 --- a/Source/cmDocumentationSection.h +++ b/Source/cmDocumentationSection.h @@ -34,8 +34,8 @@ public: void Clear() { this->Entries.clear(); } /** Return the name of this section. */ - const char* GetName() const - { return this->Name.c_str(); } + std::string GetName() const + { return this->Name; } /** Return a pointer to the first entry of this section. */ const std::vector &GetEntries() const diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h index d472e99..dde5fcc 100644 --- a/Source/cmElseCommand.h +++ b/Source/cmElseCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "else";} + virtual std::string GetName() const { return "else";} cmTypeMacro(cmElseCommand, cmCommand); }; diff --git a/Source/cmElseIfCommand.h b/Source/cmElseIfCommand.h index d811b35..c627cbe 100644 --- a/Source/cmElseIfCommand.h +++ b/Source/cmElseIfCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "elseif";} + virtual std::string GetName() const { return "elseif";} cmTypeMacro(cmElseIfCommand, cmCommand); }; diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h index a248042..2b09e11 100644 --- a/Source/cmEnableLanguageCommand.h +++ b/Source/cmEnableLanguageCommand.h @@ -43,7 +43,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "enable_language";} + virtual std::string GetName() const {return "enable_language";} cmTypeMacro(cmEnableLanguageCommand, cmCommand); }; diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h index e102f5e..d028c59 100644 --- a/Source/cmEnableTestingCommand.h +++ b/Source/cmEnableTestingCommand.h @@ -48,7 +48,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "enable_testing";} + virtual std::string GetName() const { return "enable_testing";} cmTypeMacro(cmEnableTestingCommand, cmCommand); diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h index 44d29b5..c3be387 100644 --- a/Source/cmEndForEachCommand.h +++ b/Source/cmEndForEachCommand.h @@ -52,7 +52,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "endforeach";} + virtual std::string GetName() const { return "endforeach";} cmTypeMacro(cmEndForEachCommand, cmCommand); }; diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h index 4fdca6b..3a42c17 100644 --- a/Source/cmEndFunctionCommand.h +++ b/Source/cmEndFunctionCommand.h @@ -52,7 +52,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "endfunction";} + virtual std::string GetName() const { return "endfunction";} cmTypeMacro(cmEndFunctionCommand, cmCommand); }; diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h index 634da60..a8248c8 100644 --- a/Source/cmEndIfCommand.h +++ b/Source/cmEndIfCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "endif";} + virtual std::string GetName() const { return "endif";} cmTypeMacro(cmEndIfCommand, cmCommand); }; diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h index db15f27..fdc04ee 100644 --- a/Source/cmEndMacroCommand.h +++ b/Source/cmEndMacroCommand.h @@ -52,7 +52,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "endmacro";} + virtual std::string GetName() const { return "endmacro";} cmTypeMacro(cmEndMacroCommand, cmCommand); }; diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h index 41138d1..ec1cb65 100644 --- a/Source/cmEndWhileCommand.h +++ b/Source/cmEndWhileCommand.h @@ -52,7 +52,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "endwhile";} + virtual std::string GetName() const { return "endwhile";} cmTypeMacro(cmEndWhileCommand, cmCommand); }; diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h index 6d28cdc..23d10f9 100644 --- a/Source/cmExecProgramCommand.h +++ b/Source/cmExecProgramCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const + virtual std::string GetName() const {return "exec_program";} /** diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h index bd0f783..6906a08 100644 --- a/Source/cmExecuteProcessCommand.h +++ b/Source/cmExecuteProcessCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const + virtual std::string GetName() const {return "execute_process";} /** diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index c0e445f..f9506bb 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "export";} + virtual std::string GetName() const { return "export";} cmTypeMacro(cmExportCommand, cmCommand); diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h index 29b568f..2ea4e79 100644 --- a/Source/cmExportLibraryDependenciesCommand.h +++ b/Source/cmExportLibraryDependenciesCommand.h @@ -21,7 +21,7 @@ public: virtual cmCommand* Clone() { return new cmExportLibraryDependenciesCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const { return "export_library_dependencies";} + virtual std::string GetName() const { return "export_library_dependencies";} virtual bool IsDiscouraged() const { return true; } virtual void FinalPass(); diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h index b94390c..617fcd9 100644 --- a/Source/cmFLTKWrapUICommand.h +++ b/Source/cmFLTKWrapUICommand.h @@ -52,7 +52,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "fltk_wrap_ui";} + virtual std::string GetName() const { return "fltk_wrap_ui";} private: /** diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index ba45815..8d66fdf 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -46,7 +46,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "file";} + virtual std::string GetName() const { return "file";} cmTypeMacro(cmFileCommand, cmCommand); diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h index 3f0baa2..daf1d65 100644 --- a/Source/cmFindFileCommand.h +++ b/Source/cmFindFileCommand.h @@ -33,7 +33,7 @@ public: { return new cmFindFileCommand; } - virtual const char* GetName() const { return "find_file";} + virtual std::string GetName() const { return "find_file";} cmTypeMacro(cmFindFileCommand, cmFindPathCommand); }; diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index a9ec40e..e257174 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -49,7 +49,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "find_library";} + virtual std::string GetName() const {return "find_library";} cmTypeMacro(cmFindLibraryCommand, cmFindBase); diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 72c1e3c..2249459 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -49,7 +49,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "find_package";} + virtual std::string GetName() const { return "find_package";} cmTypeMacro(cmFindPackageCommand, cmFindCommon); private: diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index 8df4540..a51da79 100644 --- a/Source/cmFindPathCommand.h +++ b/Source/cmFindPathCommand.h @@ -49,7 +49,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "find_path";} + virtual std::string GetName() const {return "find_path";} cmTypeMacro(cmFindPathCommand, cmFindBase); bool IncludeFileInPath; diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h index 7f4811c..70f758f 100644 --- a/Source/cmFindProgramCommand.h +++ b/Source/cmFindProgramCommand.h @@ -48,7 +48,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "find_program";} + virtual std::string GetName() const { return "find_program";} cmTypeMacro(cmFindProgramCommand, cmFindBase); diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index e548ba8..9b7c85a 100644 --- a/Source/cmForEachCommand.h +++ b/Source/cmForEachCommand.h @@ -59,7 +59,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "foreach";} + virtual std::string GetName() const { return "foreach";} cmTypeMacro(cmForEachCommand, cmCommand); private: diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 85b89d9..9b981a3 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -64,7 +64,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return this->Args[0].c_str(); } + virtual std::string GetName() const { return this->Args[0]; } cmTypeMacro(cmFunctionHelperCommand, cmCommand); diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index a8bd3e7..2df435e 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -57,7 +57,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "function";} + virtual std::string GetName() const { return "function";} cmTypeMacro(cmFunctionCommand, cmCommand); }; diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h index 6c58bb4..1511406 100644 --- a/Source/cmGetCMakePropertyCommand.h +++ b/Source/cmGetCMakePropertyCommand.h @@ -37,7 +37,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_cmake_property";} + virtual std::string GetName() const { return "get_cmake_property";} cmTypeMacro(cmGetCMakePropertyCommand, cmCommand); }; diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index aea04ad..6c5750a 100644 --- a/Source/cmGetDirectoryPropertyCommand.h +++ b/Source/cmGetDirectoryPropertyCommand.h @@ -37,7 +37,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_directory_property";} + virtual std::string GetName() const { return "get_directory_property";} cmTypeMacro(cmGetDirectoryPropertyCommand, cmCommand); }; diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index e2cd219..534de53 100644 --- a/Source/cmGetFilenameComponentCommand.h +++ b/Source/cmGetFilenameComponentCommand.h @@ -46,7 +46,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_filename_component";} + virtual std::string GetName() const { return "get_filename_component";} cmTypeMacro(cmGetFilenameComponentCommand, cmCommand); }; diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h index e1630ff..8c3738f 100644 --- a/Source/cmGetPropertyCommand.h +++ b/Source/cmGetPropertyCommand.h @@ -39,7 +39,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_property";} + virtual std::string GetName() const { return "get_property";} cmTypeMacro(cmGetPropertyCommand, cmCommand); private: diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h index 338318e..ab8ce36 100644 --- a/Source/cmGetSourceFilePropertyCommand.h +++ b/Source/cmGetSourceFilePropertyCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_source_file_property";} + virtual std::string GetName() const { return "get_source_file_property";} cmTypeMacro(cmGetSourceFilePropertyCommand, cmCommand); }; diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h index 4985b3c..a35c6fe 100644 --- a/Source/cmGetTargetPropertyCommand.h +++ b/Source/cmGetTargetPropertyCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_target_property";} + virtual std::string GetName() const { return "get_target_property";} cmTypeMacro(cmGetTargetPropertyCommand, cmCommand); }; diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h index 2dccabe..2819492 100644 --- a/Source/cmGetTestPropertyCommand.h +++ b/Source/cmGetTestPropertyCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_test_property";} + virtual std::string GetName() const { return "get_test_property";} cmTypeMacro(cmGetTestPropertyCommand, cmCommand); }; diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 02d87ed..b9de845 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -63,7 +63,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "if";} + virtual std::string GetName() const { return "if";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h index 267723d..0dcd7de 100644 --- a/Source/cmIncludeCommand.h +++ b/Source/cmIncludeCommand.h @@ -46,7 +46,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "include";} + virtual std::string GetName() const {return "include";} cmTypeMacro(cmIncludeCommand, cmCommand); }; diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index c621dcb..6cc2c83 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "include_directories";} + virtual std::string GetName() const { return "include_directories";} cmTypeMacro(cmIncludeDirectoryCommand, cmCommand); diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h index 8ca674f..081f77a 100644 --- a/Source/cmIncludeExternalMSProjectCommand.h +++ b/Source/cmIncludeExternalMSProjectCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "include_external_msproject";} + virtual std::string GetName() const {return "include_external_msproject";} cmTypeMacro(cmIncludeExternalMSProjectCommand, cmCommand); }; diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h index 0c5fa6f..c58f018 100644 --- a/Source/cmIncludeRegularExpressionCommand.h +++ b/Source/cmIncludeRegularExpressionCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "include_regular_expression";} + virtual std::string GetName() const {return "include_regular_expression";} cmTypeMacro(cmIncludeRegularExpressionCommand, cmCommand); }; diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 9db2490..8e14a08 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "install";} + virtual std::string GetName() const { return "install";} cmTypeMacro(cmInstallCommand, cmCommand); diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h index 5583fe4..4551ab1 100644 --- a/Source/cmInstallFilesCommand.h +++ b/Source/cmInstallFilesCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "install_files";} + virtual std::string GetName() const { return "install_files";} /** * This is called at the end after all the information diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h index 95acfa2..90c7ba3 100644 --- a/Source/cmInstallProgramsCommand.h +++ b/Source/cmInstallProgramsCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "install_programs";} + virtual std::string GetName() const { return "install_programs";} /** * This is called at the end after all the information diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h index 2aa34db..e6cbe6e 100644 --- a/Source/cmInstallTargetsCommand.h +++ b/Source/cmInstallTargetsCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "install_targets";} + virtual std::string GetName() const { return "install_targets";} /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index c6eb40c..8e04baf 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.h @@ -43,7 +43,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "link_directories";} + virtual std::string GetName() const { return "link_directories";} cmTypeMacro(cmLinkDirectoriesCommand, cmCommand); private: diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h index 74de23c..c572439 100644 --- a/Source/cmLinkLibrariesCommand.h +++ b/Source/cmLinkLibrariesCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "link_libraries";} + virtual std::string GetName() const { return "link_libraries";} /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index b79ff0d..5ea1d9f 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -44,7 +44,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "list";} + virtual std::string GetName() const { return "list";} cmTypeMacro(cmListCommand, cmCommand); protected: diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h index ff8625f..04207d0 100644 --- a/Source/cmLoadCacheCommand.h +++ b/Source/cmLoadCacheCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "load_cache";} + virtual std::string GetName() const { return "load_cache";} cmTypeMacro(cmLoadCacheCommand, cmCommand); protected: diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 21ee0fe..36e9980 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -69,7 +69,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return info.Name; } + virtual std::string GetName() const { return info.Name; } static const char* LastName; static void TrapsForSignals(int sig) diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index 11bcf09..4581269 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.h @@ -20,7 +20,7 @@ public: virtual cmCommand* Clone() { return new cmLoadCommandCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const {return "load_command";} + virtual std::string GetName() const {return "load_command";} virtual bool IsDiscouraged() const { return true; } cmTypeMacro(cmLoadCommandCommand, cmCommand); }; diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 499d3c6..9d253b8 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -65,7 +65,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return this->Args[0].c_str(); } + virtual std::string GetName() const { return this->Args[0]; } cmTypeMacro(cmMacroHelperCommand, cmCommand); diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index 4c585d8..5c1cc00 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -57,7 +57,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "macro";} + virtual std::string GetName() const { return "macro";} cmTypeMacro(cmMacroCommand, cmCommand); }; diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h index 49a4009..71b97eb 100644 --- a/Source/cmMakeDirectoryCommand.h +++ b/Source/cmMakeDirectoryCommand.h @@ -44,7 +44,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "make_directory";} + virtual std::string GetName() const { return "make_directory";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index b65e4a8..38064a3 100644 --- a/Source/cmMarkAsAdvancedCommand.h +++ b/Source/cmMarkAsAdvancedCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "mark_as_advanced";} + virtual std::string GetName() const {return "mark_as_advanced";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h index c826ef1..76dc102 100644 --- a/Source/cmMathCommand.h +++ b/Source/cmMathCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "math";} + virtual std::string GetName() const { return "math";} cmTypeMacro(cmMathCommand, cmCommand); protected: diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index fec9a32..c0ae2a3 100644 --- a/Source/cmMessageCommand.h +++ b/Source/cmMessageCommand.h @@ -39,7 +39,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "message";} + virtual std::string GetName() const { return "message";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h index 89e3ac1..12a6472 100644 --- a/Source/cmOptionCommand.h +++ b/Source/cmOptionCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "option";} + virtual std::string GetName() const {return "option";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h index dd5ed6c..95eba38 100644 --- a/Source/cmOutputRequiredFilesCommand.h +++ b/Source/cmOutputRequiredFilesCommand.h @@ -22,7 +22,7 @@ public: virtual cmCommand* Clone() { return new cmOutputRequiredFilesCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const { return "output_required_files";} + virtual std::string GetName() const { return "output_required_files";} virtual bool IsDiscouraged() const { return true; } void ListDependencies(cmDependInformation const *info, diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index f7d086d..7aacb55 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -43,7 +43,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "project";} + virtual std::string GetName() const {return "project";} cmTypeMacro(cmProjectCommand, cmCommand); }; diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h index 868eb91..85729dd 100644 --- a/Source/cmQTWrapCPPCommand.h +++ b/Source/cmQTWrapCPPCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "qt_wrap_cpp";} + virtual std::string GetName() const { return "qt_wrap_cpp";} }; diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h index 3406dac..4aa9a61 100644 --- a/Source/cmQTWrapUICommand.h +++ b/Source/cmQTWrapUICommand.h @@ -43,7 +43,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "qt_wrap_ui";} + virtual std::string GetName() const { return "qt_wrap_ui";} }; diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h index ad73908..94161f8 100644 --- a/Source/cmRemoveCommand.h +++ b/Source/cmRemoveCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "remove";} + virtual std::string GetName() const {return "remove";} /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h index 4e291fc..cac94be 100644 --- a/Source/cmRemoveDefinitionsCommand.h +++ b/Source/cmRemoveDefinitionsCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "remove_definitions";} + virtual std::string GetName() const {return "remove_definitions";} cmTypeMacro(cmRemoveDefinitionsCommand, cmCommand); }; diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h index 2822b62..4ff81ef 100644 --- a/Source/cmReturnCommand.h +++ b/Source/cmReturnCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "return";} + virtual std::string GetName() const {return "return";} cmTypeMacro(cmReturnCommand, cmCommand); }; diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h index ce02360..a527ae7 100644 --- a/Source/cmSeparateArgumentsCommand.h +++ b/Source/cmSeparateArgumentsCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "separate_arguments";} + virtual std::string GetName() const {return "separate_arguments";} cmTypeMacro(cmSeparateArgumentsCommand, cmCommand); }; diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h index 6cef0a0..4adc2d9 100644 --- a/Source/cmSetCommand.h +++ b/Source/cmSetCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "set";} + virtual std::string GetName() const {return "set";} cmTypeMacro(cmSetCommand, cmCommand); }; diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h index 6240598..f444a1b 100644 --- a/Source/cmSetDirectoryPropertiesCommand.h +++ b/Source/cmSetDirectoryPropertiesCommand.h @@ -37,7 +37,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "set_directory_properties";} + virtual std::string GetName() const { return "set_directory_properties";} /** * Static entry point for use by other commands diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index 5757d21..eaa0233 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -34,7 +34,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "set_property";} + virtual std::string GetName() const { return "set_property";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h index 8541a96..5fa5a3a 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.h +++ b/Source/cmSetSourceFilesPropertiesCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "set_source_files_properties";} + virtual std::string GetName() const { return "set_source_files_properties";} cmTypeMacro(cmSetSourceFilesPropertiesCommand, cmCommand); diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index cfe35df..3981ef3 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "set_target_properties";} + virtual std::string GetName() const { return "set_target_properties";} /** * Used by this command and cmSetPropertiesCommand diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index 7f8d57d..dabe944 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "set_tests_properties";} + virtual std::string GetName() const { return "set_tests_properties";} cmTypeMacro(cmSetTestsPropertiesCommand, cmCommand); diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h index eb9d4d8..ec63ef8 100644 --- a/Source/cmSiteNameCommand.h +++ b/Source/cmSiteNameCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "site_name";} + virtual std::string GetName() const {return "site_name";} cmTypeMacro(cmSiteNameCommand, cmCommand); }; diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h index 5d8b48c..410411b 100644 --- a/Source/cmSourceGroupCommand.h +++ b/Source/cmSourceGroupCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "source_group";} + virtual std::string GetName() const {return "source_group";} cmTypeMacro(cmSourceGroupCommand, cmCommand); }; diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index 66b48e6..b8053c5 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -50,7 +50,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "string";} + virtual std::string GetName() const { return "string";} cmTypeMacro(cmStringCommand, cmCommand); static void ClearMatches(cmMakefile* mf); diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h index 8be8335..6addd8f 100644 --- a/Source/cmSubdirCommand.h +++ b/Source/cmSubdirCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "subdirs";} + virtual std::string GetName() const { return "subdirs";} /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h index f78cfb7..75a5685 100644 --- a/Source/cmSubdirDependsCommand.h +++ b/Source/cmSubdirDependsCommand.h @@ -20,7 +20,7 @@ public: virtual cmCommand* Clone() { return new cmSubdirDependsCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const { return "subdir_depends";} + virtual std::string GetName() const { return "subdir_depends";} virtual bool IsDiscouraged() const { return true; } cmTypeMacro(cmSubdirDependsCommand, cmCommand); }; diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h index 7405e90..5ba9e03 100644 --- a/Source/cmTargetCompileDefinitionsCommand.h +++ b/Source/cmTargetCompileDefinitionsCommand.h @@ -36,7 +36,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "target_compile_definitions";} + virtual std::string GetName() const { return "target_compile_definitions";} cmTypeMacro(cmTargetCompileDefinitionsCommand, cmTargetPropCommandBase); diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h index 3713e5a..d58dc07 100644 --- a/Source/cmTargetCompileOptionsCommand.h +++ b/Source/cmTargetCompileOptionsCommand.h @@ -36,7 +36,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "target_compile_options";} + virtual std::string GetName() const { return "target_compile_options";} cmTypeMacro(cmTargetCompileOptionsCommand, cmTargetPropCommandBase); diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h index 6863ee5..c8b22fb 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.h +++ b/Source/cmTargetIncludeDirectoriesCommand.h @@ -37,7 +37,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "target_include_directories";} + virtual std::string GetName() const { return "target_include_directories";} cmTypeMacro(cmTargetIncludeDirectoriesCommand, cmTargetPropCommandBase); diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index e2f3743..47dd8bd 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "target_link_libraries";} + virtual std::string GetName() const { return "target_link_libraries";} cmTypeMacro(cmTargetLinkLibrariesCommand, cmCommand); private: diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h index 8e6bbc1..a09c47f 100644 --- a/Source/cmTryCompileCommand.h +++ b/Source/cmTryCompileCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "try_compile";} + virtual std::string GetName() const { return "try_compile";} cmTypeMacro(cmTryCompileCommand, cmCoreTryCompile); diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h index d0bf9ce..9b97b16 100644 --- a/Source/cmTryRunCommand.h +++ b/Source/cmTryRunCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "try_run";} + virtual std::string GetName() const { return "try_run";} cmTypeMacro(cmTryRunCommand, cmCoreTryCompile); private: diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h index 2308139..62c2bd3 100644 --- a/Source/cmUnsetCommand.h +++ b/Source/cmUnsetCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "unset";} + virtual std::string GetName() const {return "unset";} cmTypeMacro(cmUnsetCommand, cmCommand); }; diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h index dca75a5..da927c7 100644 --- a/Source/cmUseMangledMesaCommand.h +++ b/Source/cmUseMangledMesaCommand.h @@ -21,7 +21,7 @@ public: virtual cmCommand* Clone() { return new cmUseMangledMesaCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const { return "use_mangled_mesa";} + virtual std::string GetName() const { return "use_mangled_mesa";} virtual bool IsScriptable() const { return true; } virtual bool IsDiscouraged() const { return true; } protected: diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h index 83d115c..23afdbe 100644 --- a/Source/cmUtilitySourceCommand.h +++ b/Source/cmUtilitySourceCommand.h @@ -21,7 +21,7 @@ public: virtual cmCommand* Clone() { return new cmUtilitySourceCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const { return "utility_source";} + virtual std::string GetName() const { return "utility_source";} virtual bool IsDiscouraged() const { return true; } }; diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h index 881b149..7e68de1 100644 --- a/Source/cmVariableRequiresCommand.h +++ b/Source/cmVariableRequiresCommand.h @@ -21,7 +21,7 @@ public: virtual cmCommand* Clone() { return new cmVariableRequiresCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const { return "variable_requires";} + virtual std::string GetName() const { return "variable_requires";} virtual bool IsDiscouraged() const { return true; } }; diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h index fb6062c..c1ee9b1 100644 --- a/Source/cmVariableWatchCommand.h +++ b/Source/cmVariableWatchCommand.h @@ -54,7 +54,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "variable_watch";} + virtual std::string GetName() const { return "variable_watch";} cmTypeMacro(cmVariableWatchCommand, cmCommand); diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index 45badd0..9fafffc 100644 --- a/Source/cmWhileCommand.h +++ b/Source/cmWhileCommand.h @@ -66,7 +66,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "while";} + virtual std::string GetName() const { return "while";} cmTypeMacro(cmWhileCommand, cmCommand); }; diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h index 84a38fc..0d06878 100644 --- a/Source/cmWriteFileCommand.h +++ b/Source/cmWriteFileCommand.h @@ -44,7 +44,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "write_file";} + virtual std::string GetName() const { return "write_file";} /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ab12411..d37bd94 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -221,13 +221,13 @@ void cmake::CleanupCommandsAndMacros() } } -bool cmake::CommandExists(const char* name) const +bool cmake::CommandExists(const std::string& name) const { std::string sName = cmSystemTools::LowerCase(name); return (this->Commands.find(sName) != this->Commands.end()); } -cmCommand *cmake::GetCommand(const char *name) +cmCommand *cmake::GetCommand(const std::string& name) { cmCommand* rm = 0; std::string sName = cmSystemTools::LowerCase(name); @@ -239,7 +239,8 @@ cmCommand *cmake::GetCommand(const char *name) return rm; } -void cmake::RenameCommand(const char*oldName, const char* newName) +void cmake::RenameCommand(const std::string& oldName, + const std::string& newName) { // if the command already exists, free the old one std::string sOldName = cmSystemTools::LowerCase(oldName); @@ -262,7 +263,7 @@ void cmake::RenameCommand(const char*oldName, const char* newName) this->Commands.erase(pos); } -void cmake::RemoveCommand(const char* name) +void cmake::RemoveCommand(const std::string& name) { std::string sName = cmSystemTools::LowerCase(name); RegisteredCommandsMap::iterator pos = this->Commands.find(sName); diff --git a/Source/cmake.h b/Source/cmake.h index 3134493..6772740 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -218,20 +218,20 @@ class cmake * Add a command to this cmake instance */ void AddCommand(cmCommand* ); - void RenameCommand(const char* oldName, const char* newName); - void RemoveCommand(const char* name); + void RenameCommand(const std::string& oldName, const std::string& newName); + void RemoveCommand(const std::string& name); void RemoveUnscriptableCommands(); /** * Get a command by its name */ - cmCommand *GetCommand(const char *name); + cmCommand *GetCommand(const std::string& name); /** Get list of all commands */ RegisteredCommandsMap* GetCommands() { return &this->Commands; } /** Check if a command exists. */ - bool CommandExists(const char* name) const; + bool CommandExists(const std::string& name) const; ///! Parse command line arguments void SetArgs(const std::vector&, -- cgit v0.12 From 94fc63e2d5402bc4fa570a92e1f5fe6aba088392 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 20:24:01 -0500 Subject: stringapi: Use strings for cache iterator values --- Source/CursesDialog/cmCursesCacheEntryComposite.cxx | 5 +++-- Source/QtDialog/QCMake.cxx | 12 ++++++------ Source/cmCacheManager.h | 6 +++--- Source/cmMakefile.cxx | 8 ++++++-- Source/cmOptionCommand.cxx | 5 +---- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 7929ce7..682f95f 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -51,7 +51,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( { case cmCacheManager::BOOL: this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1); - if (cmSystemTools::IsOn(it.GetValue())) + if (cmSystemTools::IsOn(it.GetValue().c_str())) { static_cast(this->Entry)->SetValueAsBool(true); } @@ -94,7 +94,8 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } break; case cmCacheManager::UNINITIALIZED: - cmSystemTools::Error("Found an undefined variable: ", it.GetName()); + cmSystemTools::Error("Found an undefined variable: ", + it.GetName().c_str()); break; default: // TODO : put warning message here diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 0fe5f8c..12da320 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -111,7 +111,7 @@ void QCMake::setBinaryDirectory(const QString& _dir) cmCacheManager::CacheIterator itm = cachem->NewIterator(); if ( itm.Find("CMAKE_HOME_DIRECTORY")) { - setSourceDirectory(QString::fromLocal8Bit(itm.GetValue())); + setSourceDirectory(QString::fromLocal8Bit(itm.GetValue().c_str())); } if ( itm.Find("CMAKE_GENERATOR")) { @@ -201,11 +201,11 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) } QCMakeProperty prop; - prop.Key = QString::fromLocal8Bit(i.GetName()); + prop.Key = QString::fromLocal8Bit(i.GetName().c_str()); int idx = props.indexOf(prop); if(idx == -1) { - toremove.append(QString::fromLocal8Bit(i.GetName())); + toremove.append(QString::fromLocal8Bit(i.GetName().c_str())); } else { @@ -286,15 +286,15 @@ QCMakePropertyList QCMake::properties() const } QCMakeProperty prop; - prop.Key = QString::fromLocal8Bit(i.GetName()); + prop.Key = QString::fromLocal8Bit(i.GetName().c_str()); prop.Help = QString::fromLocal8Bit(i.GetProperty("HELPSTRING")); - prop.Value = QString::fromLocal8Bit(i.GetValue()); + prop.Value = QString::fromLocal8Bit(i.GetValue().c_str()); prop.Advanced = i.GetPropertyAsBool("ADVANCED"); if(i.GetType() == cmCacheManager::BOOL) { prop.Type = QCMakeProperty::BOOL; - prop.Value = cmSystemTools::IsOn(i.GetValue()); + prop.Value = cmSystemTools::IsOn(i.GetValue().c_str()); } else if(i.GetType() == cmCacheManager::PATH) { diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 07a8675..d9a9112 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -56,8 +56,8 @@ public: bool Find(const std::string&); bool IsAtEnd() const; void Next(); - const char *GetName() const { - return this->Position->first.c_str(); } + std::string GetName() const { + return this->Position->first; } const char* GetProperty(const std::string&) const ; bool GetPropertyAsBool(const std::string&) const ; bool PropertyExists(const std::string&) const; @@ -65,7 +65,7 @@ public: void AppendProperty(const std::string& property, const char* value, bool asString=false); void SetProperty(const std::string& property, bool value); - const char* GetValue() const { return this->GetEntry().Value.c_str(); } + std::string GetValue() const { return this->GetEntry().Value; } bool GetValueAsBool() const; void SetValue(const char*); CacheEntryType GetType() const { return this->GetEntry().Type; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e8be29f..a083c78 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1796,7 +1796,8 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, cmCacheManager::CacheEntryType type, bool force) { - const char* val = value; + bool haveVal = value ? true : false; + std::string val = haveVal ? value : ""; cmCacheManager::CacheIterator it = this->GetCacheManager()->GetCacheIterator(name.c_str()); if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) && @@ -1807,6 +1808,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, if(!force) { val = it.GetValue(); + haveVal = true; } if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH ) { @@ -1829,10 +1831,12 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type); val = it.GetValue(); + haveVal = true; } } - this->GetCacheManager()->AddCacheEntry(name, val, doc, type); + this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, doc, + type); // if there was a definition then remove it this->Internal->VarStack.top().Set(name, 0); } diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 776a3a4..dbe2478 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -55,10 +55,7 @@ bool cmOptionCommand it.SetProperty("HELPSTRING", args[1].c_str()); return true; } - if ( it.GetValue() ) - { - initialValue = it.GetValue(); - } + initialValue = it.GetValue(); } if(args.size() == 3) { -- cgit v0.12 From 7abf4e313d8e8d59c38f402efaf9cca4e4a2d3ba Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 20:32:55 -0500 Subject: stringapi: Use strings for dependency information --- Source/cmFLTKWrapUICommand.cxx | 2 +- Source/cmGlobalVisualStudio8Generator.cxx | 2 +- Source/cmLocalGenerator.cxx | 2 +- Source/cmLocalVisualStudio6Generator.cxx | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 2 +- Source/cmMakefile.cxx | 14 +++++++------- Source/cmMakefile.h | 6 +++--- Source/cmMakefileTargetGenerator.cxx | 10 ++++------ Source/cmMakefileTargetGenerator.h | 2 +- Source/cmQTWrapCPPCommand.cxx | 2 +- Source/cmQTWrapUICommand.cxx | 2 +- 11 files changed, 22 insertions(+), 24 deletions(-) diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index 4dd81be..dd99c43 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -78,7 +78,7 @@ bool cmFLTKWrapUICommand commandLines.push_back(commandLine); // Add command for generating the .h and .cxx files - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; const char* no_comment = 0; const char* no_working_dir = 0; this->Makefile->AddCustomCommandToOutput(cxxres.c_str(), diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 08c1397..ab4380c 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -316,7 +316,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() // file as the main dependency because it would get // overwritten by the CreateVCProjBuildRule. // (this could be avoided with per-target source files) - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; if(cmSourceFile* file = mf->AddCustomCommandToOutput( stamps, listFiles, diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cd9f9bd..761db48 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -747,7 +747,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, this->Makefile->AddCustomCommandToOutput( targetFullPath.c_str(), objVector, - 0, + "", commandLines, comment.c_str(), this->Makefile->GetStartOutputDirectory() diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 0e246a5..f1fd994 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -578,7 +578,7 @@ cmLocalVisualStudio6Generator std::string comment = this->ConstructComment(origCommand, ""); // Add the rule with the given dependencies and commands. - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; if(cmSourceFile* outsf = this->Makefile->AddCustomCommandToOutput( output, depends, no_main_dependency, diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 0bbafd8..4491140 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -141,7 +141,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() force_command.push_back("."); cmCustomCommandLines force_commands; force_commands.push_back(force_command); - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; std::string force = this->Makefile->GetStartOutputDirectory(); force += cmake::GetCMakeFilesDirectory(); force += "/"; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a083c78..92177c8 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -950,7 +950,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target, cmSourceFile* cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, const std::vector& depends, - const char* main_dependency, + const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, @@ -980,7 +980,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, // Choose a source file on which to store the custom command. cmSourceFile* file = 0; - if(main_dependency && main_dependency[0]) + if(!main_dependency.empty()) { // The main dependency was specified. Use it unless a different // custom command already used it. @@ -1048,7 +1048,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, // Construct a complete list of dependencies. std::vector depends2(depends); - if(main_dependency && main_dependency[0]) + if(!main_dependency.empty()) { depends2.push_back(main_dependency); } @@ -1104,7 +1104,7 @@ cmMakefile::UpdateOutputToSourceMap(std::string const& output, cmSourceFile* cmMakefile::AddCustomCommandToOutput(const std::string& output, const std::vector& depends, - const char* main_dependency, + const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, @@ -1123,7 +1123,7 @@ void cmMakefile::AddCustomCommandOldStyle(const std::string& target, const std::vector& outputs, const std::vector& depends, - const char* source, + const std::string& source, const cmCustomCommandLines& commandLines, const char* comment) { @@ -1160,7 +1160,7 @@ cmMakefile::AddCustomCommandOldStyle(const std::string& target, else { // The source may not be a real file. Do not use a main dependency. - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; std::vector depends2 = depends; depends2.push_back(source); sf = this->AddCustomCommandToOutput(output, depends2, no_main_dependency, @@ -1251,7 +1251,7 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName, force += cmake::GetCMakeFilesDirectory(); force += "/"; force += utilityName; - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; bool no_replace = false; this->AddCustomCommandToOutput(force.c_str(), depends, no_main_dependency, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index fb40c1b..460a85c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -177,7 +177,7 @@ public: cmSourceFile* AddCustomCommandToOutput( const std::vector& outputs, const std::vector& depends, - const char* main_dependency, + const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, bool replace = false, @@ -185,7 +185,7 @@ public: cmSourceFile* AddCustomCommandToOutput( const std::string& output, const std::vector& depends, - const char* main_dependency, + const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, bool replace = false, @@ -193,7 +193,7 @@ public: void AddCustomCommandOldStyle(const std::string& target, const std::vector& outputs, const std::vector& depends, - const char* source, + const std::string& source, const cmCustomCommandLines& commandLines, const char* comment); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index f0c9a3f..28a8f04 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1496,8 +1496,9 @@ cmMakefileTargetGenerator } //---------------------------------------------------------------------------- -void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output, - bool relink) +void cmMakefileTargetGenerator::WriteTargetDriverRule( + const std::string& main_output, + bool relink) { // Compute the name of the driver target. std::string dir = @@ -1510,10 +1511,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output, // Build the list of target outputs to drive. std::vector depends; - if(main_output) - { - depends.push_back(main_output); - } + depends.push_back(main_output); const char* comment = 0; if(relink) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 573ce22..bed945b 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -119,7 +119,7 @@ protected: std::string::size_type limit = std::string::npos); // write the driver rule to build target outputs - void WriteTargetDriverRule(const char* main_output, bool relink); + void WriteTargetDriverRule(const std::string& main_output, bool relink); void DriveCustomCommands(std::vector& depends); diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index 0d3c994..ca007cb 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -97,7 +97,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn, depends.push_back(moc_exe); depends.push_back(hname); - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; const char* no_working_dir = 0; this->Makefile->AddCustomCommandToOutput(newName.c_str(), depends, diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index a6a4b51..2a1129d 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -128,7 +128,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn, std::vector depends; depends.push_back(uiName); - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; const char* no_comment = 0; const char* no_working_dir = 0; this->Makefile->AddCustomCommandToOutput(hName.c_str(), -- cgit v0.12 From caaad357598ec8c92f15ab0d682add9e70e2223c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 20:47:20 -0500 Subject: speedup: Cache strings for comparisons --- Source/cmExtraCodeBlocksGenerator.cxx | 3 ++- Source/cmExtraCodeLiteGenerator.cxx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 4a59704..03f59c4 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -414,12 +414,13 @@ void cmExtraCodeBlocksGenerator std::string lang = (*si)->GetLanguage(); if (lang == "C" || lang == "CXX") { + std::string srcext = (*si)->GetExtension(); for(std::vector::const_iterator ext = mf->GetSourceExtensions().begin(); ext != mf->GetSourceExtensions().end(); ++ext) { - if ((*si)->GetExtension() == *ext) + if (srcext == *ext) { isCFile = true; break; diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 15fe8bb..5a9e125 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -223,12 +223,13 @@ void cmExtraCodeLiteGenerator std::string lang = (*si)->GetLanguage(); if (lang == "C" || lang == "CXX") { + std::string srcext = (*si)->GetExtension(); for(std::vector::const_iterator ext = mf->GetSourceExtensions().begin(); ext != mf->GetSourceExtensions().end(); ++ext) { - if ((*si)->GetExtension() == *ext) + if (srcext == *ext) { isCFile = true; break; -- cgit v0.12 From 219d6ad6101cb90f951b193d721a19896f7a6b20 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 20:31:04 -0500 Subject: speedup: Avoid excess iterator dereferences --- Source/cmGlobalUnixMakefileGenerator3.cxx | 125 ++++++++++++++++-------------- 1 file changed, 68 insertions(+), 57 deletions(-) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index d41cee6..2cdc976 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -477,24 +477,26 @@ cmGlobalUnixMakefileGenerator3 for(cmGeneratorTargetsType::iterator l = targets.begin(); l != targets.end(); ++l) { - if((l->second->GetType() == cmTarget::EXECUTABLE) || - (l->second->GetType() == cmTarget::STATIC_LIBRARY) || - (l->second->GetType() == cmTarget::SHARED_LIBRARY) || - (l->second->GetType() == cmTarget::MODULE_LIBRARY) || - (l->second->GetType() == cmTarget::OBJECT_LIBRARY) || - (l->second->GetType() == cmTarget::UTILITY)) + cmGeneratorTarget* gtarget = l->second; + int type = gtarget->GetType(); + if((type == cmTarget::EXECUTABLE) || + (type == cmTarget::STATIC_LIBRARY) || + (type == cmTarget::SHARED_LIBRARY) || + (type == cmTarget::MODULE_LIBRARY) || + (type == cmTarget::OBJECT_LIBRARY) || + (type == cmTarget::UTILITY)) { - if(l->second->Target->IsImported()) + if(gtarget->Target->IsImported()) { continue; } // Add this to the list of depends rules in this directory. - if((!check_all || !l->second->GetPropertyAsBool("EXCLUDE_FROM_ALL")) && + if((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) && (!check_relink || - l->second->Target + gtarget->Target ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))) { - std::string tname = lg->GetRelativeTargetDirectory(*l->second->Target); + std::string tname = lg->GetRelativeTargetDirectory(*gtarget->Target); tname += "/"; tname += pass; depends.push_back(tname); @@ -643,45 +645,48 @@ cmGlobalUnixMakefileGenerator3 for(cmGeneratorTargetsType::iterator t = targets.begin(); t != targets.end(); ++t) { - if(t->second->Target->IsImported()) + cmGeneratorTarget* gtarget = t->second; + if(gtarget->Target->IsImported()) { continue; } // Don't emit the same rule twice (e.g. two targets with the same // simple name) - if(!t->second->GetName().empty() && - emitted.insert(t->second->GetName()).second && + int type = gtarget->GetType(); + std::string name = gtarget->GetName(); + if(!name.empty() && + emitted.insert(name).second && // Handle user targets here. Global targets are handled in // the local generator on a per-directory basis. - ((t->second->GetType() == cmTarget::EXECUTABLE) || - (t->second->GetType() == cmTarget::STATIC_LIBRARY) || - (t->second->GetType() == cmTarget::SHARED_LIBRARY) || - (t->second->GetType() == cmTarget::MODULE_LIBRARY) || - (t->second->GetType() == cmTarget::OBJECT_LIBRARY) || - (t->second->GetType() == cmTarget::UTILITY))) + ((type == cmTarget::EXECUTABLE) || + (type == cmTarget::STATIC_LIBRARY) || + (type == cmTarget::SHARED_LIBRARY) || + (type == cmTarget::MODULE_LIBRARY) || + (type == cmTarget::OBJECT_LIBRARY) || + (type == cmTarget::UTILITY))) { // Add a rule to build the target by name. lg->WriteDivider(ruleFileStream); ruleFileStream << "# Target rules for targets named " - << t->second->GetName() << "\n\n"; + << name << "\n\n"; // Write the rule. commands.clear(); std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); tmp += "Makefile2"; commands.push_back(lg->GetRecursiveMakeCall - (tmp.c_str(),t->second->GetName())); + (tmp.c_str(),name)); depends.clear(); depends.push_back("cmake_check_build_system"); lg->WriteMakeRule(ruleFileStream, "Build rule for target.", - t->second->GetName(), depends, commands, + name, depends, commands, true); // Add a fast rule to build the target std::string localName = - lg->GetRelativeTargetDirectory(*t->second->Target); + lg->GetRelativeTargetDirectory(*gtarget->Target); std::string makefileName; makefileName = localName; makefileName += "/build.make"; @@ -689,7 +694,7 @@ cmGlobalUnixMakefileGenerator3 commands.clear(); std::string makeTargetName = localName; makeTargetName += "/build"; - localName = t->second->GetName(); + localName = name; localName += "/fast"; commands.push_back(lg->GetRecursiveMakeCall (makefileName.c_str(), makeTargetName.c_str())); @@ -698,12 +703,12 @@ cmGlobalUnixMakefileGenerator3 // Add a local name for the rule to relink the target before // installation. - if(t->second->Target + if(gtarget->Target ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())) { - makeTargetName = lg->GetRelativeTargetDirectory(*t->second->Target); + makeTargetName = lg->GetRelativeTargetDirectory(*gtarget->Target); makeTargetName += "/preinstall"; - localName = t->second->GetName(); + localName = name; localName += "/preinstall"; depends.clear(); commands.clear(); @@ -741,25 +746,28 @@ cmGlobalUnixMakefileGenerator3 for(cmGeneratorTargetsType::iterator t = targets.begin(); t != targets.end(); ++t) { - if(t->second->Target->IsImported()) + cmGeneratorTarget* gtarget = t->second; + if(gtarget->Target->IsImported()) { continue; } - if (!t->second->GetName().empty() - && ((t->second->GetType() == cmTarget::EXECUTABLE) - || (t->second->GetType() == cmTarget::STATIC_LIBRARY) - || (t->second->GetType() == cmTarget::SHARED_LIBRARY) - || (t->second->GetType() == cmTarget::MODULE_LIBRARY) - || (t->second->GetType() == cmTarget::OBJECT_LIBRARY) - || (t->second->GetType() == cmTarget::UTILITY))) + int type = gtarget->GetType(); + std::string name = gtarget->GetName(); + if (!name.empty() + && ( (type == cmTarget::EXECUTABLE) + || (type == cmTarget::STATIC_LIBRARY) + || (type == cmTarget::SHARED_LIBRARY) + || (type == cmTarget::MODULE_LIBRARY) + || (type == cmTarget::OBJECT_LIBRARY) + || (type == cmTarget::UTILITY))) { std::string makefileName; // Add a rule to build the target by name. - localName = lg->GetRelativeTargetDirectory(*t->second->Target); + localName = lg->GetRelativeTargetDirectory(*gtarget->Target); makefileName = localName; makefileName += "/build.make"; - bool needRequiresStep = this->NeedRequiresStep(*t->second->Target); + bool needRequiresStep = this->NeedRequiresStep(*gtarget->Target); lg->WriteDivider(ruleFileStream); ruleFileStream @@ -801,7 +809,7 @@ cmGlobalUnixMakefileGenerator3 cmLocalGenerator::SHELL); progCmd << " "; std::vector& progFiles = - this->ProgressMap[t->second->Target].Marks; + this->ProgressMap[gtarget->Target].Marks; for (std::vector::iterator i = progFiles.begin(); i != progFiles.end(); ++i) { @@ -810,15 +818,15 @@ cmGlobalUnixMakefileGenerator3 commands.push_back(progCmd.str()); } progressDir = "Built target "; - progressDir += t->second->GetName(); + progressDir += name; lg->AppendEcho(commands,progressDir.c_str()); - this->AppendGlobalTargetDepends(depends,*t->second->Target); + this->AppendGlobalTargetDepends(depends,*gtarget->Target); lg->WriteMakeRule(ruleFileStream, "All Build rule for target.", localName.c_str(), depends, commands, true); // add the all/all dependency - if(!this->IsExcluded(this->LocalGenerators[0], *t->second->Target)) + if(!this->IsExcluded(this->LocalGenerators[0], *gtarget->Target)) { depends.clear(); depends.push_back(localName); @@ -843,7 +851,7 @@ cmGlobalUnixMakefileGenerator3 // std::set emitted; progCmd << " " - << this->CountProgressMarksInTarget(t->second->Target, emitted); + << this->CountProgressMarksInTarget(gtarget->Target, emitted); commands.push_back(progCmd.str()); } std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); @@ -861,7 +869,7 @@ cmGlobalUnixMakefileGenerator3 } depends.clear(); depends.push_back("cmake_check_build_system"); - localName = lg->GetRelativeTargetDirectory(*t->second->Target); + localName = lg->GetRelativeTargetDirectory(*gtarget->Target); localName += "/rule"; lg->WriteMakeRule(ruleFileStream, "Build rule for subdir invocation for target.", @@ -872,13 +880,13 @@ cmGlobalUnixMakefileGenerator3 depends.clear(); depends.push_back(localName); lg->WriteMakeRule(ruleFileStream, "Convenience name for target.", - t->second->GetName(), depends, commands, true); + name, depends, commands, true); // Add rules to prepare the target for installation. - if(t->second->Target + if(gtarget->Target ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())) { - localName = lg->GetRelativeTargetDirectory(*t->second->Target); + localName = lg->GetRelativeTargetDirectory(*gtarget->Target); localName += "/preinstall"; depends.clear(); commands.clear(); @@ -888,7 +896,7 @@ cmGlobalUnixMakefileGenerator3 "Pre-install relink rule for target.", localName.c_str(), depends, commands, true); - if(!this->IsExcluded(this->LocalGenerators[0], *t->second->Target)) + if(!this->IsExcluded(this->LocalGenerators[0], *gtarget->Target)) { depends.clear(); depends.push_back(localName); @@ -899,7 +907,7 @@ cmGlobalUnixMakefileGenerator3 } // add the clean rule - localName = lg->GetRelativeTargetDirectory(*t->second->Target); + localName = lg->GetRelativeTargetDirectory(*gtarget->Target); makeTargetName = localName; makeTargetName += "/clean"; depends.clear(); @@ -1066,18 +1074,21 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule cmTargets& targets = lg2->GetMakefile()->GetTargets(); for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) { - if((t->second.GetType() == cmTarget::EXECUTABLE) || - (t->second.GetType() == cmTarget::STATIC_LIBRARY) || - (t->second.GetType() == cmTarget::SHARED_LIBRARY) || - (t->second.GetType() == cmTarget::MODULE_LIBRARY) || - (t->second.GetType() == cmTarget::OBJECT_LIBRARY) || - (t->second.GetType() == cmTarget::GLOBAL_TARGET) || - (t->second.GetType() == cmTarget::UTILITY)) + cmTarget const& target = t->second; + cmTarget::TargetType type = target.GetType(); + if((type == cmTarget::EXECUTABLE) || + (type == cmTarget::STATIC_LIBRARY) || + (type == cmTarget::SHARED_LIBRARY) || + (type == cmTarget::MODULE_LIBRARY) || + (type == cmTarget::OBJECT_LIBRARY) || + (type == cmTarget::GLOBAL_TARGET) || + (type == cmTarget::UTILITY)) { - if(emittedTargets.insert(t->second.GetName()).second) + std::string name = target.GetName(); + if(emittedTargets.insert(name).second) { path = "... "; - path += t->second.GetName(); + path += name; lg->AppendEcho(commands,path.c_str()); } } -- cgit v0.12 From 191f25e2bd0a8b63d5abfecfd403b9f1414dfc8d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 6 Mar 2014 17:22:09 -0500 Subject: stringapi: Prevent a NULL dereference in WiX --- Source/CPack/cmCPackGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index a8e104b..3915b31 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1089,7 +1089,7 @@ int cmCPackGenerator::DoPackage() * may update this during PackageFiles. * (either putting several names or updating the provided one) */ - packageFileNames.push_back(tempPackageFileName); + packageFileNames.push_back(tempPackageFileName ? tempPackageFileName : ""); toplevel = tempDirectory; if ( !this->PackageFiles() || cmSystemTools::GetErrorOccuredFlag()) { -- cgit v0.12 From b633b263082ae2c74a030aefb9048b0a20098b61 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 7 Mar 2014 10:53:45 -0500 Subject: CPackWiX: Fix test to build with expected config --- Tests/CMakeLists.txt | 2 ++ Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 854b239..7b4d149 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -829,6 +829,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ if(WIX_LIGHT_EXECUTABLE) add_test(CPackWiXGenerator ${CMAKE_CTEST_COMMAND} + -C \${CTEST_CONFIGURATION_TYPE} --build-and-test "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator" "${CMake_BINARY_DIR}/Tests/CPackWiXGenerator" @@ -837,6 +838,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-options ${build_options} --test-command ${CMAKE_CMAKE_COMMAND} "-DCPackWiXGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackWiXGenerator" + "-Dconfig=\${CTEST_CONFIGURATION_TYPE}" -P "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake") endif() endif() diff --git a/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake b/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake index 30e33cf2..ca9fd90 100644 --- a/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake +++ b/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake @@ -10,7 +10,12 @@ message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") message(STATUS "CMAKE_CPACK_COMMAND: ${CMAKE_CPACK_COMMAND}") message(STATUS "CPackWiXGenerator_BINARY_DIR: ${CPackWiXGenerator_BINARY_DIR}") +if(config) + set(_C_config -C ${config}) +endif() + execute_process(COMMAND "${CMAKE_CPACK_COMMAND}" + ${_C_config} RESULT_VARIABLE CPack_result OUTPUT_VARIABLE CPack_output ERROR_VARIABLE CPack_error -- cgit v0.12