summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.cxx
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2012-02-24 19:33:21 (GMT)
committerBrad King <brad.king@kitware.com>2012-02-28 14:56:49 (GMT)
commit7d67dcf52bddcd8863f00d7bb6e6e7e22a966951 (patch)
tree701ae6b95979e13b9d09215793a94e48788be3fd /Source/cmFindPackageCommand.cxx
parent978d89b99db233f2fbe5a9cfa4c7acdca93e6442 (diff)
downloadCMake-7d67dcf52bddcd8863f00d7bb6e6e7e22a966951.zip
CMake-7d67dcf52bddcd8863f00d7bb6e6e7e22a966951.tar.gz
CMake-7d67dcf52bddcd8863f00d7bb6e6e7e22a966951.tar.bz2
find_package: improve error message when no Find module is present
Explain exactly why CMake is looking for a package configuration file and who is expected to provide what: CMake Error at CMakeLists.txt:7 (find_package): By not providing "Find<pkg>.cmake" in CMAKE_MODULE_PATH the caller has asked CMake to find a package configuration file provided by "<pkg>", but CMake did not find one. Could not find a package configuration file provided by "<pkg>" with any of the names: <pkg>Config.cmake <pkg>-config.cmake Add the installation prefix of "<pkg>" to CMAKE_PREFIX_PATH or set "<pkg>_DIR" to a directory containing one of the above files. If "<pkg>" provides separate development package or SDK be sure it has been installed. The first paragraph explains how CMake is interpreting the intention of the caller. This puts the blame or credit at the call site in the project code where it belongs both when it is a bug and when it is intentional. It can be dropped in NO_MODULE mode. Suggested-by: Brad King <brad.king@kitware.com>
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r--Source/cmFindPackageCommand.cxx35
1 files changed, 17 insertions, 18 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 5254de8..c02d385 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -912,38 +912,37 @@ bool cmFindPackageCommand::HandlePackageMode()
}
else
{
- e << "Could not find ";
if(this->UseFindModules)
{
- e << "module Find" << this->Name << ".cmake or ";
+ e << "By not providing \"Find" << this->Name << ".cmake\" in "
+ "CMAKE_MODULE_PATH this project has asked CMake to find a "
+ "package configuration file provided by \""<<this->Name<< "\", "
+ "but CMake did not find one.\n";
}
- e << "a configuration file for package " << this->Name << ".\n";
- if(this->UseFindModules)
- {
- e << "Adjust CMAKE_MODULE_PATH to find Find"
- << this->Name << ".cmake or set ";
- }
- else
- {
- e << "Set ";
- }
- e << this->Variable << " to the directory containing a CMake "
- << "configuration file for " << this->Name << ". ";
+
if(this->Configs.size() == 1)
{
- e << "The file will be called " << this->Configs[0];
+ e << "Could not find a package configuration file named \""
+ << this->Configs[0] << "\" provided by package \"" << this->Name << "\".\n";
}
else
{
- e << "The file will have one of the following names:\n";
- for(std::vector<std::string>::const_iterator ci=this->Configs.begin();
+ e << "Could not find a package configuration file provided by \""
+ << this->Name << "\" with any of the following names:\n";
+ for(std::vector<std::string>::const_iterator ci =
+ this->Configs.begin();
ci != this->Configs.end(); ++ci)
{
e << " " << *ci << "\n";
}
}
- }
+ e << "Add the installation prefix of \"" << this->Name << "\" to "
+ "CMAKE_PREFIX_PATH or set \"" << this->Variable << "\" to a "
+ "directory containing one of the above files. "
+ "If \"" << this->Name << "\" provides a separate development "
+ "package or SDK, be sure it has been installed.";
+ }
this->Makefile->IssueMessage(
this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str());