1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 10:47:59 +08:00

cmExecuteProcessCommand: Report keyword errors via argument parser results

This commit is contained in:
Brad King
2022-07-18 17:12:54 -04:00
parent b7c82b26b0
commit e56108f629
3 changed files with 11 additions and 10 deletions

View File

@@ -47,7 +47,7 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
return false;
}
struct Arguments
struct Arguments : public ArgumentParser::ParseResult
{
std::vector<std::vector<std::string>> Commands;
std::string OutputVariable;
@@ -95,14 +95,10 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
.Bind("COMMAND_ERROR_IS_FATAL"_s, &Arguments::CommandErrorIsFatal);
std::vector<std::string> unparsedArguments;
std::vector<cm::string_view> keywordsMissingValue;
Arguments const arguments =
parser.Parse(args, &unparsedArguments, &keywordsMissingValue);
Arguments const arguments = parser.Parse(args, &unparsedArguments);
if (!keywordsMissingValue.empty()) {
status.SetError(cmStrCat(" called with no value for ",
keywordsMissingValue.front(), "."));
return false;
if (arguments.MaybeReportError(status.GetMakefile())) {
return true;
}
if (!unparsedArguments.empty()) {
status.SetError(" given unknown argument \"" + unparsedArguments.front() +