summaryrefslogtreecommitdiff
path: root/Source/cmMacroCommand.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-02-11 20:47:16 +0100
committerStephen Kelly <steveire@gmail.com>2015-02-11 22:58:31 +0100
commit17b5ebd383df4c0c731b5c687ccaa3608b2d188f (patch)
treef5a5ec87208e5364b88d5888dd9329fb0f25ee02 /Source/cmMacroCommand.cxx
parent7c3f637680ac0cdb6cec5e75ba4a9b188de5017b (diff)
downloadcmake-17b5ebd383df4c0c731b5c687ccaa3608b2d188f.tar.gz
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.
Diffstat (limited to 'Source/cmMacroCommand.cxx')
-rw-r--r--Source/cmMacroCommand.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 8f6364d7db..de52fc9ea3 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -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());