From d8bfafeff8087c90010053ba37b4072f23f36508 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 8 Sep 2008 10:08:33 -0400 Subject: [PATCH] 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. --- Source/cmFindPackageCommand.cxx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index f8ec695ae..d60acea19 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -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.