cmMacroCommand: Join the args strings outside of the loops.

This means that we compute the strings even if not used in the macro
but this shouldn't be expensive and it simplifies the code.
This commit is contained in:
Stephen Kelly 2015-02-11 20:47:16 +01:00
parent 7c3f637680
commit 17b5ebd383
1 changed files with 6 additions and 4 deletions

View File

@ -114,6 +114,10 @@ bool cmMacroHelperCommand::InvokeInitialPass
// declare varuiables for ARGV ARGN but do not compute until needed
std::string argvDef;
std::string argnDef;
std::vector<std::string>::const_iterator eit
= expandedArgs.begin() + (this->Args.size() - 1);
std::string expandedArgn = cmJoin(cmRange(eit, expandedArgs.end()), ";");
std::string expandedArgv = cmJoin(expandedArgs, ";");
bool argnDefInitialized = false;
bool argvDefInitialized = false;
if(!this->Functions.empty())
@ -170,9 +174,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
{
argnDef += ";";
}
std::vector<std::string>::const_iterator eit
= expandedArgs.begin() + (this->Args.size() - 1);
argnDef += cmJoin(cmRange(eit, expandedArgs.end()), ";");
argnDef += expandedArgn;
}
argnDefInitialized = true;
}
@ -192,7 +194,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
{
argvDef += ";";
}
argvDef += cmJoin(expandedArgs, ";");
argvDef += expandedArgv;
argvDefInitialized = true;
}
cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str());