BUG: Skip a command if its arguments fail to parse

If the arguments to a command fail to parse correctly due to a syntax
error, the command should not be invoked.  This avoids problems created
by processing of commands with bad arguments.  Even though the build
system will not be generated, the command may affect files on disk that
persist across CMake runs.
This commit is contained in:
Brad King 2008-09-24 08:51:33 -04:00
parent dbd88e00c7
commit 5f57efb417
3 changed files with 9 additions and 3 deletions

View File

@ -64,7 +64,12 @@ public:
cmExecutionStatus &status)
{
std::vector<std::string> expandedArguments;
this->Makefile->ExpandArguments(args, expandedArguments);
if(!this->Makefile->ExpandArguments(args, expandedArguments))
{
// There was an error expanding arguments. It was already
// reported, so we can skip this command without error.
return true;
}
return this->InitialPass(expandedArguments,status);
}

View File

@ -2364,7 +2364,7 @@ bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff,
return false;
}
void cmMakefile::ExpandArguments(
bool cmMakefile::ExpandArguments(
std::vector<cmListFileArgument> const& inArgs,
std::vector<std::string>& outArgs)
{
@ -2390,6 +2390,7 @@ void cmMakefile::ExpandArguments(
cmSystemTools::ExpandListArgument(value, outArgs);
}
}
return !cmSystemTools::GetFatalErrorOccured();
}
void cmMakefile::RemoveFunctionBlocker(const cmListFileFunction& lff)

View File

@ -702,7 +702,7 @@ public:
* Expand the given list file arguments into the full set after
* variable replacement and list expansion.
*/
void ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
bool ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
std::vector<std::string>& outArgs);
/**
* Get the instance