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