Improve wording of the error message of find_package() in config-mode

As suggested by Brad, this improves the wording of the error message
in config-mode when config-files were found, but no suitable version.
The patch also contains the small loop-optimization suggested by Brad.

Alex
This commit is contained in:
Alex Neundorf 2010-08-31 21:10:00 +02:00
parent 4969c3b5bb
commit 5cdfc9c8ea
1 changed files with 10 additions and 9 deletions

View File

@ -820,10 +820,12 @@ bool cmFindPackageCommand::HandlePackageMode()
// have been found, but they didn't have appropriate versions. // have been found, but they didn't have appropriate versions.
if (this->ConsideredConfigs.size() > 0) if (this->ConsideredConfigs.size() > 0)
{ {
e << "Could not find configuration file for package " << this->Name e << "Could not find a configuration file for package \""
<< " with " << (this->VersionExact ? "exact " : "at least ") << this->Name << "\" that "
<< "version " << this->Version << " .\n" << (this->VersionExact? "exactly matches" : "is compatible with")
<< "Found the following files:\n"; << " requested version \"" << this->Version << "\".\n"
<< "The following configuration files were considered but not "
"accepted:\n";
for(std::vector<ConfigFileInfo>::size_type i=0; for(std::vector<ConfigFileInfo>::size_type i=0;
i<this->ConsideredConfigs.size(); i++) i<this->ConsideredConfigs.size(); i++)
{ {
@ -932,16 +934,15 @@ bool cmFindPackageCommand::HandlePackageMode()
std::string consideredConfigFiles; std::string consideredConfigFiles;
std::string consideredVersions; std::string consideredVersions;
const char* sep = "";
for(std::vector<ConfigFileInfo>::size_type i=0; for(std::vector<ConfigFileInfo>::size_type i=0;
i<this->ConsideredConfigs.size(); i++) i<this->ConsideredConfigs.size(); i++)
{ {
if (i>0) consideredConfigFiles += sep;
{ consideredVersions += sep;
consideredConfigFiles += ";";
consideredVersions += ";";
}
consideredConfigFiles += this->ConsideredConfigs[i].filename; consideredConfigFiles += this->ConsideredConfigs[i].filename;
consideredVersions += this->ConsideredConfigs[i].version; consideredVersions += this->ConsideredConfigs[i].version;
sep = ";";
} }
this->Makefile->AddDefinition(consideredConfigsVar.c_str(), this->Makefile->AddDefinition(consideredConfigsVar.c_str(),