From 8d8470c30e9b2cba6529d0d04df88ec9312d0183 Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Fri, 19 Jul 2002 14:42:34 -0400 Subject: [PATCH] full variable replacement and removal or empty arguments --- Source/cmMakefile.cxx | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9dbf31dae..75dd6410e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -212,11 +212,17 @@ void cmMakefile::ExecuteCommand(std::string &name, // if the command is inherited then InitialPass it. if(!m_Inheriting || usedCommand->IsInherited()) { - std::vector expandedArguments = arguments; - for(std::vector::iterator i = expandedArguments.begin(); - i != expandedArguments.end(); ++i) + std::vector expandedArguments; + for(std::vector::const_iterator i = arguments.begin(); + i != arguments.end(); ++i) { - this->ExpandVariablesInString(*i); + std::string tmps = *i; + this->ExpandVariablesInString(tmps); + if (tmps.find_first_not_of(" ") != std::string::npos) + { + // we found something in the args + expandedArguments.push_back(tmps); + } } if(!usedCommand->InitialPass(expandedArguments)) { @@ -1070,12 +1076,14 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source, result += var; result += "@"; } - else + // do nothing, we remove the variable +/* else { result += (markerStartSize == 5 ? "$ENV{" : "${"); result += var; result += "}"; } +*/ } // lookup var, and replace it currentPos = endVariablePos+1; @@ -1235,11 +1243,17 @@ bool cmMakefile::IsFunctionBlocked(const char *name, // loop over all function blockers to see if any block this command std::list::iterator pos; - std::vector expandedArguments = args; - for(std::vector::iterator i = expandedArguments.begin(); - i != expandedArguments.end(); ++i) + std::vector expandedArguments; + for(std::vector::const_iterator i = args.begin(); + i != args.end(); ++i) { - this->ExpandVariablesInString(*i); + std::string tmps = *i; + this->ExpandVariablesInString(tmps); + if (tmps.find_first_not_of(" ") != std::string::npos) + { + // we found something in the args + expandedArguments.push_back(tmps); + } } for (pos = m_FunctionBlockers.begin(); pos != m_FunctionBlockers.end(); ++pos)