Merge topic 'improve-subcommand-message-consistency' into release-4.2

a1a75f4008 cmake_file_api: Improve error message consistency
61143d7cef export: Improve error message consistency

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11470
This commit is contained in:
Brad King
2025-12-02 20:31:35 +00:00
committed by Kitware Robot
8 changed files with 30 additions and 33 deletions

View File

@@ -269,8 +269,8 @@ static bool HandleExportMode(std::vector<std::string> const& args,
}
if (!unknownArgs.empty()) {
status.SetError("EXPORT subcommand given unknown argument: \"" +
unknownArgs.front() + "\".");
status.SetError("EXPORT given unknown argument: \"" + unknownArgs.front() +
"\".");
return false;
}
@@ -383,8 +383,8 @@ static bool HandleSetupMode(std::vector<std::string> const& args,
SetupArguments arguments = parser.Parse(args, &unknownArgs);
if (!unknownArgs.empty()) {
status.SetError("SETUP subcommand given unknown argument: \"" +
unknownArgs.front() + "\".");
status.SetError("SETUP given unknown argument: \"" + unknownArgs.front() +
"\".");
return false;
}

View File

@@ -68,7 +68,7 @@ bool handleQueryCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
if (args.empty()) {
status.SetError("QUERY subcommand called without required arguments.");
status.SetError("QUERY called without required arguments.");
return false;
}
@@ -97,21 +97,20 @@ bool handleQueryCommand(std::vector<std::string> const& args,
return true;
}
if (!unparsedArguments.empty()) {
status.SetError("QUERY subcommand given unknown argument \"" +
status.SetError("QUERY given unknown argument \"" +
unparsedArguments.front() + "\".");
return false;
}
if (!std::all_of(arguments.ApiVersion.begin(), arguments.ApiVersion.end(),
isCharDigit)) {
status.SetError("QUERY subcommand given a non-integer API_VERSION.");
status.SetError("QUERY given non-integer API_VERSION.");
return false;
}
int const apiVersion = std::atoi(arguments.ApiVersion.c_str());
if (apiVersion != 1) {
status.SetError(
cmStrCat("QUERY subcommand given an unsupported API_VERSION \"",
arguments.ApiVersion,
cmStrCat("QUERY given unsupported API_VERSION \"", arguments.ApiVersion,
"\" (the only currently supported version is 1)."));
return false;
}
@@ -138,7 +137,7 @@ bool handleQueryCommand(std::vector<std::string> const& args,
if (!std::all_of(errors.begin(), errors.end(),
[](std::string const& s) -> bool { return s.empty(); })) {
std::string message("QUERY subcommand was given invalid arguments:");
std::string message("QUERY given invalid arguments:");
for (std::string const& s : errors) {
if (!s.empty()) {
message = cmStrCat(message, "\n ", s);

View File

@@ -1,64 +1,64 @@
CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument: "LOWER_CASE_FILE"\.
export EXPORT given unknown argument: "LOWER_CASE_FILE"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)
CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument: "APPENDIX"\.
export EXPORT given unknown argument: "APPENDIX"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)
CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument: "VERSION"\.
export EXPORT given unknown argument: "VERSION"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)
CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument: "LICENSE"\.
export EXPORT given unknown argument: "LICENSE"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)
CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument: "DEFAULT_LICENSE"\.
export EXPORT given unknown argument: "DEFAULT_LICENSE"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)
CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument: "DESCRIPTION"\.
export EXPORT given unknown argument: "DESCRIPTION"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)
CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument: "HOMEPAGE_URL"\.
export EXPORT given unknown argument: "HOMEPAGE_URL"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)
CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument: "DEFAULT_TARGETS"\.
export EXPORT given unknown argument: "DEFAULT_TARGETS"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)
CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument: "DEFAULT_CONFIGURATIONS"\.
export EXPORT given unknown argument: "DEFAULT_CONFIGURATIONS"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)
CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument: "PROJECT"\.
export EXPORT given unknown argument: "PROJECT"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)
CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument: "NO_PROJECT_METADATA"\.
export EXPORT given unknown argument: "NO_PROJECT_METADATA"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)

View File

@@ -1,2 +1,2 @@
CMake Error at ExperimentalGate\.cmake:5 \(export\):
export EXPORT subcommand given unknown argument: "PACKAGE_INFO"\.
export EXPORT given unknown argument: "PACKAGE_INFO"\.

View File

@@ -4,15 +4,15 @@ CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
.*
Invalid API version checks
CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
cmake_file_api QUERY subcommand given an unsupported API_VERSION "2" \(the
only currently supported version is 1\)\.
cmake_file_api QUERY given unsupported API_VERSION "2" \(the only currently
supported version is 1\)\.
.*
CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
cmake_file_api QUERY subcommand given a non-integer API_VERSION\.
cmake_file_api QUERY given non-integer API_VERSION\.
.*
Invalid version numbers check
CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
cmake_file_api QUERY subcommand was given invalid arguments:
cmake_file_api QUERY given invalid arguments:
Given a malformed version "nope" for CODEMODEL\.
Given a malformed version "-2" for CACHE\.
@@ -21,7 +21,7 @@ CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
.*
Requested versions too high check
CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
cmake_file_api QUERY subcommand was given invalid arguments:
cmake_file_api QUERY given invalid arguments:
None of the specified CODEMODEL versions is supported by this version of CMake\.
None of the specified CACHE versions is supported by this version of CMake\.
@@ -30,7 +30,7 @@ CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
.*
Requested versions too low check
CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
cmake_file_api QUERY subcommand was given invalid arguments:
cmake_file_api QUERY given invalid arguments:
None of the specified CODEMODEL versions is supported by this version of CMake\.
None of the specified CACHE versions is supported by this version of CMake\.

View File

@@ -1,4 +1,4 @@
CMake Error at AppendExport\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument: "APPEND"\.
export EXPORT given unknown argument: "APPEND"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)

View File

@@ -1,5 +1,4 @@
^CMake Error at FindDependencyExportGate\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument:
"EXPORT_PACKAGE_DEPENDENCIES"\.
export EXPORT given unknown argument: "EXPORT_PACKAGE_DEPENDENCIES"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)$

View File

@@ -1,5 +1,4 @@
CMake Error at OldIface\.cmake:[0-9]+ \(export\):
export EXPORT subcommand given unknown argument:
"EXPORT_LINK_INTERFACE_LIBRARIES"\.
export EXPORT given unknown argument: "EXPORT_LINK_INTERFACE_LIBRARIES"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)