set: Improve error message consistency

There are exactly two places that use `ParseResult::AddKeywordError`:
the parser itself, and the `set` command. Adjust the format of the
message generated by the latter to be consistent with the former.
This commit is contained in:
Matthew Woehlke
2025-12-03 12:23:08 -05:00
committed by Brad King
parent 20e81dbd5e
commit 2ca58c5ac9
2 changed files with 4 additions and 3 deletions

View File

@@ -98,8 +98,8 @@ bool cmSetCommand(std::vector<std::string> const& args,
{
if (!cmState::StringToCacheEntryType(std::string{ type },
this->Type)) {
this->AddKeywordError("TYPE"_s,
cmStrCat("Invalid value: ", type, '.'));
this->AddKeywordError(
"TYPE"_s, cmStrCat(" invalid value: \""_s, type, "\"\n"_s));
}
return ArgumentParser::Continue::No;
}

View File

@@ -1,6 +1,7 @@
CMake Error at CacheWrongTYPE\.cmake:[0-9]+ \(set\):
Error after keyword "TYPE":
Invalid value: FOO\.
invalid value: "FOO"
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)