ENH: Improve message for bad find_package call
Use the new-style error reporting mechanism to provide more context information for a find_package call with a bad package name. When the package is not required, issue a warning instead of an error.
This commit is contained in:
parent
947521f437
commit
d8bfafeff8
|
@ -699,7 +699,7 @@ bool cmFindPackageCommand::HandlePackageMode()
|
||||||
{
|
{
|
||||||
// The variable is not set.
|
// The variable is not set.
|
||||||
cmOStringStream e;
|
cmOStringStream e;
|
||||||
e << "could not find ";
|
e << "Could not find ";
|
||||||
if(!this->NoModule)
|
if(!this->NoModule)
|
||||||
{
|
{
|
||||||
e << "module Find" << this->Name << ".cmake or ";
|
e << "module Find" << this->Name << ".cmake or ";
|
||||||
|
@ -729,15 +729,8 @@ bool cmFindPackageCommand::HandlePackageMode()
|
||||||
e << " " << *ci << "\n";
|
e << " " << *ci << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this->Required)
|
this->Makefile->IssueMessage(
|
||||||
{
|
this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str());
|
||||||
this->SetError(e.str().c_str());
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cmSystemTools::Error("find_package ", e.str().c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set a variable marking whether the package was found.
|
// Set a variable marking whether the package was found.
|
||||||
|
|
Loading…
Reference in New Issue