cmPackageInfoArguments: Improve error message

When given the name of a project that doesn't exist, report it as an
"unknown project" rather than an "invalid project". This is more
consistent with other, similar reporting.
This commit is contained in:
Matthew Woehlke
2025-10-27 12:29:40 -04:00
parent 68721a1726
commit f2b7184b98
3 changed files with 3 additions and 3 deletions

View File

@@ -163,7 +163,7 @@ bool cmPackageInfoArguments::SetEffectiveProject(cmExecutionStatus& status)
if (!this->ProjectName.empty()) {
// User specified a project; make sure it exists.
if (!mf.GetStateSnapshot().CheckProjectName(this->ProjectName)) {
status.SetError(cmStrCat(R"(PROJECT given invalid project name ")"_s,
status.SetError(cmStrCat(R"(PROJECT given unknown project name ")"_s,
this->ProjectName, R"(".)"_s));
return false;
}

View File

@@ -17,6 +17,6 @@ Call Stack \(most recent call first\):
CMake Error at BadArgs1\.cmake:6 \(export\):
export PROJECT given invalid project name "bar"\.
export PROJECT given unknown project name "bar"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)

View File

@@ -17,6 +17,6 @@ Call Stack \(most recent call first\):
CMake Error at BadArgs1\.cmake:6 \(install\):
install PROJECT given invalid project name "bar"\.
install PROJECT given unknown project name "bar"\.
Call Stack \(most recent call first\):
CMakeLists\.txt:3 \(include\)