1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 19:08:07 +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() +

View File

@@ -1,2 +1,4 @@
CMake Error at .*EchoCommand.cmake:.*\(execute_process\):
execute_process called with no value for COMMAND_ECHO.
Error after keyword "COMMAND_ECHO":
missing required value

View File

@@ -1,4 +1,7 @@
^CMake Error at EncodingMissing.cmake:[0-9]+ \(execute_process\):
execute_process called with no value for ENCODING.
Error after keyword "ENCODING":
missing required value
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)$