cmFindPackageCommand: remove duplicate paths from error message
Fixes #15252.
This commit is contained in:
parent
ebf18df580
commit
919db25c3b
|
@ -664,6 +664,8 @@ bool cmFindPackageCommand::HandlePackageMode()
|
||||||
// If there are files in ConsideredConfigs, it means that FooConfig.cmake
|
// If there are files in ConsideredConfigs, it means that FooConfig.cmake
|
||||||
// have been found, but they didn't have appropriate versions.
|
// have been found, but they didn't have appropriate versions.
|
||||||
else if (!this->ConsideredConfigs.empty()) {
|
else if (!this->ConsideredConfigs.empty()) {
|
||||||
|
std::vector<ConfigFileInfo>::const_iterator duplicate_end =
|
||||||
|
cmRemoveDuplicates(this->ConsideredConfigs);
|
||||||
e << "Could not find a configuration file for package \"" << this->Name
|
e << "Could not find a configuration file for package \"" << this->Name
|
||||||
<< "\" that "
|
<< "\" that "
|
||||||
<< (this->VersionExact ? "exactly matches" : "is compatible with")
|
<< (this->VersionExact ? "exactly matches" : "is compatible with")
|
||||||
|
@ -672,7 +674,7 @@ bool cmFindPackageCommand::HandlePackageMode()
|
||||||
"accepted:\n";
|
"accepted:\n";
|
||||||
for (std::vector<ConfigFileInfo>::const_iterator i =
|
for (std::vector<ConfigFileInfo>::const_iterator i =
|
||||||
this->ConsideredConfigs.begin();
|
this->ConsideredConfigs.begin();
|
||||||
i != this->ConsideredConfigs.end(); ++i) {
|
i != duplicate_end; ++i) {
|
||||||
e << " " << i->filename << ", version: " << i->version << "\n";
|
e << " " << i->filename << ", version: " << i->version << "\n";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -159,6 +159,21 @@ private:
|
||||||
{
|
{
|
||||||
std::string filename;
|
std::string filename;
|
||||||
std::string version;
|
std::string version;
|
||||||
|
|
||||||
|
bool operator<(ConfigFileInfo const& rhs) const
|
||||||
|
{
|
||||||
|
return this->filename < rhs.filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(ConfigFileInfo const& rhs) const
|
||||||
|
{
|
||||||
|
return this->filename == rhs.filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(ConfigFileInfo const& rhs) const
|
||||||
|
{
|
||||||
|
return !(*this == rhs);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
std::vector<ConfigFileInfo> ConsideredConfigs;
|
std::vector<ConfigFileInfo> ConsideredConfigs;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue