Skip to content
Snippets Groups Projects
Commit d8bfafef authored by Brad King's avatar Brad King
Browse files

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.
parent 947521f4
No related branches found
No related tags found
No related merge requests found
......@@ -699,7 +699,7 @@ bool cmFindPackageCommand::HandlePackageMode()
{
// The variable is not set.
cmOStringStream e;
e << "could not find ";
e << "Could not find ";
if(!this->NoModule)
{
e << "module Find" << this->Name << ".cmake or ";
......@@ -729,15 +729,8 @@ bool cmFindPackageCommand::HandlePackageMode()
e << " " << *ci << "\n";
}
}
if(this->Required)
{
this->SetError(e.str().c_str());
result = false;
}
else
{
cmSystemTools::Error("find_package ", e.str().c_str());
}
this->Makefile->IssueMessage(
this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str());
}
// Set a variable marking whether the package was found.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment