Replace common loop pattern with cmJoin
This commit is contained in:
parent
7b8725bf84
commit
8910224950
|
@ -1064,26 +1064,11 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
|
|||
}
|
||||
|
||||
|
||||
std::string tmp;
|
||||
const char* sep ="";
|
||||
for(size_t i=0; i<foundContents.size(); i++)
|
||||
{
|
||||
tmp += sep;
|
||||
tmp += foundContents[i];
|
||||
sep = ";";
|
||||
}
|
||||
|
||||
std::string tmp = cmJoin(foundContents, ";");
|
||||
this->Makefile->GetCMakeInstance()->SetProperty("PACKAGES_FOUND",
|
||||
tmp.c_str());
|
||||
|
||||
tmp = "";
|
||||
sep = "";
|
||||
for(size_t i=0; i<notFoundContents.size(); i++)
|
||||
{
|
||||
tmp += sep;
|
||||
tmp += notFoundContents[i];
|
||||
sep = ";";
|
||||
}
|
||||
tmp = cmJoin(notFoundContents, ";");
|
||||
this->Makefile->GetCMakeInstance()->SetProperty("PACKAGES_NOT_FOUND",
|
||||
tmp.c_str());
|
||||
}
|
||||
|
|
|
@ -193,12 +193,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
|
|||
if (!this->Depth)
|
||||
{
|
||||
std::string name = this->Args[0];
|
||||
std::vector<std::string>::size_type cc;
|
||||
name += "(";
|
||||
for ( cc = 0; cc < this->Args.size(); cc ++ )
|
||||
{
|
||||
name += " " + this->Args[cc];
|
||||
}
|
||||
name += "( ";
|
||||
name += cmJoin(this->Args, " ");
|
||||
name += " )";
|
||||
|
||||
// create a new command and add it to cmake
|
||||
|
|
|
@ -34,15 +34,7 @@ bool cmGetCMakePropertyCommand
|
|||
std::vector<std::string> vars = this->Makefile->GetDefinitions(cacheonly);
|
||||
if (!vars.empty())
|
||||
{
|
||||
output = "";
|
||||
const char* sep = "";
|
||||
std::vector<std::string>::size_type cc;
|
||||
for ( cc = 0; cc < vars.size(); ++cc )
|
||||
{
|
||||
output += sep;
|
||||
output += vars[cc];
|
||||
sep = ";";
|
||||
}
|
||||
output = cmJoin(vars, ";");
|
||||
}
|
||||
}
|
||||
else if ( args[1] == "MACROS" )
|
||||
|
@ -54,15 +46,7 @@ bool cmGetCMakePropertyCommand
|
|||
const std::set<std::string>* components
|
||||
= this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
|
||||
->GetInstallComponents();
|
||||
std::set<std::string>::const_iterator compIt;
|
||||
output = "";
|
||||
const char* sep = "";
|
||||
for (compIt = components->begin(); compIt != components->end(); ++compIt)
|
||||
{
|
||||
output += sep;
|
||||
output += *compIt;
|
||||
sep = ";";
|
||||
}
|
||||
output = cmJoin(*components, ";");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -197,14 +197,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
|
|||
{
|
||||
argvDef += ";";
|
||||
}
|
||||
const char* sep = "";
|
||||
std::vector<std::string>::const_iterator eit;
|
||||
for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit)
|
||||
{
|
||||
argvDef += sep;
|
||||
argvDef += *eit;
|
||||
sep = ";";
|
||||
}
|
||||
argvDef += cmJoin(expandedArgs, ";");
|
||||
argvDefInitialized = true;
|
||||
}
|
||||
cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str());
|
||||
|
|
|
@ -4202,15 +4202,7 @@ const char *cmMakefile::GetProperty(const std::string& prop,
|
|||
}
|
||||
else if (prop == "LISTFILE_STACK")
|
||||
{
|
||||
const char* sep = "";
|
||||
for (std::deque<std::string>::const_iterator
|
||||
i = this->ListFileStack.begin();
|
||||
i != this->ListFileStack.end(); ++i)
|
||||
{
|
||||
output += sep;
|
||||
output += *i;
|
||||
sep = ";";
|
||||
}
|
||||
output = cmJoin(this->ListFileStack, ";");
|
||||
return output.c_str();
|
||||
}
|
||||
else if (prop == "VARIABLES" || prop == "CACHE_VARIABLES")
|
||||
|
@ -4220,14 +4212,7 @@ const char *cmMakefile::GetProperty(const std::string& prop,
|
|||
{
|
||||
cacheonly = 1;
|
||||
}
|
||||
std::vector<std::string> vars = this->GetDefinitions(cacheonly);
|
||||
const char* sep = "";
|
||||
for (unsigned int cc = 0; cc < vars.size(); cc ++ )
|
||||
{
|
||||
output += sep;
|
||||
output += vars[cc];
|
||||
sep = ";";
|
||||
}
|
||||
output = cmJoin(this->GetDefinitions(cacheonly), ";");
|
||||
return output.c_str();
|
||||
}
|
||||
else if (prop == "MACROS")
|
||||
|
@ -4242,16 +4227,7 @@ const char *cmMakefile::GetProperty(const std::string& prop,
|
|||
}
|
||||
else if (prop == "LINK_DIRECTORIES")
|
||||
{
|
||||
const char* sep = "";
|
||||
for (std::vector<std::string>::const_iterator
|
||||
it = this->GetLinkDirectories().begin();
|
||||
it != this->GetLinkDirectories().end();
|
||||
++ it )
|
||||
{
|
||||
output += sep;
|
||||
output += *it;
|
||||
sep = ";";
|
||||
}
|
||||
output = cmJoin(this->GetLinkDirectories(), ";");
|
||||
return output.c_str();
|
||||
}
|
||||
else if (prop == "INCLUDE_DIRECTORIES")
|
||||
|
|
|
@ -34,11 +34,7 @@ bool cmOptionCommand
|
|||
if(argError)
|
||||
{
|
||||
std::string m = "called with incorrect number of arguments: ";
|
||||
for(size_t i =0; i < args.size(); ++i)
|
||||
{
|
||||
m += args[i];
|
||||
m += " ";
|
||||
}
|
||||
m += cmJoin(args, " ");
|
||||
this->SetError(m);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue