full variable replacement and removal or empty arguments

This commit is contained in:
Ken Martin 2002-07-19 14:42:34 -04:00
parent 6bbc8e9d45
commit 8d8470c30e
1 changed files with 23 additions and 9 deletions

View File

@ -212,11 +212,17 @@ void cmMakefile::ExecuteCommand(std::string &name,
// if the command is inherited then InitialPass it. // if the command is inherited then InitialPass it.
if(!m_Inheriting || usedCommand->IsInherited()) if(!m_Inheriting || usedCommand->IsInherited())
{ {
std::vector<std::string> expandedArguments = arguments; std::vector<std::string> expandedArguments;
for(std::vector<std::string>::iterator i = expandedArguments.begin(); for(std::vector<std::string>::const_iterator i = arguments.begin();
i != expandedArguments.end(); ++i) 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)) if(!usedCommand->InitialPass(expandedArguments))
{ {
@ -1070,12 +1076,14 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source,
result += var; result += var;
result += "@"; result += "@";
} }
else // do nothing, we remove the variable
/* else
{ {
result += (markerStartSize == 5 ? "$ENV{" : "${"); result += (markerStartSize == 5 ? "$ENV{" : "${");
result += var; result += var;
result += "}"; result += "}";
} }
*/
} }
// lookup var, and replace it // lookup var, and replace it
currentPos = endVariablePos+1; 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 // loop over all function blockers to see if any block this command
std::list<cmFunctionBlocker *>::iterator pos; std::list<cmFunctionBlocker *>::iterator pos;
std::vector<std::string> expandedArguments = args; std::vector<std::string> expandedArguments;
for(std::vector<std::string>::iterator i = expandedArguments.begin(); for(std::vector<std::string>::const_iterator i = args.begin();
i != expandedArguments.end(); ++i) 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(); for (pos = m_FunctionBlockers.begin();
pos != m_FunctionBlockers.end(); ++pos) pos != m_FunctionBlockers.end(); ++pos)