Improve error message in Config-mode when no appropriate version was found
If in config-mode config files have been found by find_package(), but their version didn't match the requested version, now all considered files and their versions are printed (instead of saying "didn't find config file) Alex
This commit is contained in:
parent
dfe9c95129
commit
130b0e2195
|
@ -817,6 +817,23 @@ bool cmFindPackageCommand::HandlePackageMode()
|
||||||
{
|
{
|
||||||
// The variable is not set.
|
// The variable is not set.
|
||||||
cmOStringStream e;
|
cmOStringStream e;
|
||||||
|
// If there are files in ConsideredConfigs, it means that FooConfig.cmake
|
||||||
|
// have been found, but they didn't have appropriate versions.
|
||||||
|
if (this->ConsideredConfigFiles.size() > 0)
|
||||||
|
{
|
||||||
|
e << "Could not find configuration file for package " << this->Name
|
||||||
|
<< " with " << (this->VersionExact ? "exact " : "at least ")
|
||||||
|
<< "version " << this->Version << " .\n"
|
||||||
|
<< "Found the following files:\n";
|
||||||
|
for(std::vector<std::string>::size_type i=0;
|
||||||
|
i<this->ConsideredConfigFiles.size(); i++)
|
||||||
|
{
|
||||||
|
e << " " << this->ConsideredConfigFiles[i]
|
||||||
|
<< ", version: " << this->ConsideredVersions[i] << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
e << "Could not find ";
|
e << "Could not find ";
|
||||||
if(!this->NoModule)
|
if(!this->NoModule)
|
||||||
{
|
{
|
||||||
|
@ -847,6 +864,9 @@ bool cmFindPackageCommand::HandlePackageMode()
|
||||||
e << " " << *ci << "\n";
|
e << " " << *ci << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this->Makefile->IssueMessage(
|
this->Makefile->IssueMessage(
|
||||||
this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str());
|
this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str());
|
||||||
}
|
}
|
||||||
|
@ -911,20 +931,14 @@ bool cmFindPackageCommand::HandlePackageMode()
|
||||||
consideredVersionsVar += "_CONSIDERED_VERSIONS";
|
consideredVersionsVar += "_CONSIDERED_VERSIONS";
|
||||||
|
|
||||||
std::string consideredConfigFiles;
|
std::string consideredConfigFiles;
|
||||||
for(std::vector<std::string>::const_iterator
|
|
||||||
it = this->ConsideredConfigFiles.begin();
|
|
||||||
it != this->ConsideredConfigFiles.end(); ++it)
|
|
||||||
{
|
|
||||||
consideredConfigFiles += *it;
|
|
||||||
consideredConfigFiles += ";";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string consideredVersions;
|
std::string consideredVersions;
|
||||||
for(std::vector<std::string>::const_iterator
|
|
||||||
it = this->ConsideredVersions.begin();
|
for(std::vector<std::string>::size_type i=0;
|
||||||
it != this->ConsideredVersions.end(); ++it)
|
i<this->ConsideredConfigFiles.size(); i++)
|
||||||
{
|
{
|
||||||
consideredVersions += *it;
|
consideredConfigFiles += this->ConsideredConfigFiles[i];
|
||||||
|
consideredConfigFiles += ";";
|
||||||
|
consideredVersions += this->ConsideredVersions[i];
|
||||||
consideredVersions += ";";
|
consideredVersions += ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue