diff options
author | Ken Martin <ken.martin@kitware.com> | 2002-07-19 18:42:34 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2002-07-19 18:42:34 (GMT) |
commit | 8d8470c30e9b2cba6529d0d04df88ec9312d0183 (patch) | |
tree | 34fd7c1c71321440309aee06879667b3b7b6ee9d /Source/cmMakefile.cxx | |
parent | 6bbc8e9d4592c503f7c9b174c86610c9307e337a (diff) | |
download | CMake-8d8470c30e9b2cba6529d0d04df88ec9312d0183.zip CMake-8d8470c30e9b2cba6529d0d04df88ec9312d0183.tar.gz CMake-8d8470c30e9b2cba6529d0d04df88ec9312d0183.tar.bz2 |
full variable replacement and removal or empty arguments
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9dbf31d..75dd641 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<std::string> expandedArguments = arguments; - for(std::vector<std::string>::iterator i = expandedArguments.begin(); - i != expandedArguments.end(); ++i) + std::vector<std::string> expandedArguments; + for(std::vector<std::string>::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<cmFunctionBlocker *>::iterator pos; - std::vector<std::string> expandedArguments = args; - for(std::vector<std::string>::iterator i = expandedArguments.begin(); - i != expandedArguments.end(); ++i) + std::vector<std::string> expandedArguments; + for(std::vector<std::string>::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) |