Replace the two vector<string,string> with one vector<struct{string,string}>
Before this patch there were two separate vectors, and the code made sure they always had the same size. With this patch the code doesn't have to ensure this anymore, there is only one vector now. Alex
This commit is contained in:
parent
130b0e2195
commit
0367245f0c
|
@ -726,8 +726,7 @@ bool cmFindPackageCommand::FindModule(bool& found)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmFindPackageCommand::HandlePackageMode()
|
bool cmFindPackageCommand::HandlePackageMode()
|
||||||
{
|
{
|
||||||
this->ConsideredConfigFiles.clear();
|
this->ConsideredConfigs.clear();
|
||||||
this->ConsideredVersions.clear();
|
|
||||||
|
|
||||||
// Support old capitalization behavior.
|
// Support old capitalization behavior.
|
||||||
std::string upperDir = cmSystemTools::UpperCase(this->Name);
|
std::string upperDir = cmSystemTools::UpperCase(this->Name);
|
||||||
|
@ -819,17 +818,17 @@ bool cmFindPackageCommand::HandlePackageMode()
|
||||||
cmOStringStream e;
|
cmOStringStream e;
|
||||||
// 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.
|
||||||
if (this->ConsideredConfigFiles.size() > 0)
|
if (this->ConsideredConfigs.size() > 0)
|
||||||
{
|
{
|
||||||
e << "Could not find configuration file for package " << this->Name
|
e << "Could not find configuration file for package " << this->Name
|
||||||
<< " with " << (this->VersionExact ? "exact " : "at least ")
|
<< " with " << (this->VersionExact ? "exact " : "at least ")
|
||||||
<< "version " << this->Version << " .\n"
|
<< "version " << this->Version << " .\n"
|
||||||
<< "Found the following files:\n";
|
<< "Found the following files:\n";
|
||||||
for(std::vector<std::string>::size_type i=0;
|
for(std::vector<ConfigFileInfo>::size_type i=0;
|
||||||
i<this->ConsideredConfigFiles.size(); i++)
|
i<this->ConsideredConfigs.size(); i++)
|
||||||
{
|
{
|
||||||
e << " " << this->ConsideredConfigFiles[i]
|
e << " " << this->ConsideredConfigs[i].filename
|
||||||
<< ", version: " << this->ConsideredVersions[i] << "\n";
|
<< ", version: " << this->ConsideredConfigs[i].version << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -933,12 +932,12 @@ bool cmFindPackageCommand::HandlePackageMode()
|
||||||
std::string consideredConfigFiles;
|
std::string consideredConfigFiles;
|
||||||
std::string consideredVersions;
|
std::string consideredVersions;
|
||||||
|
|
||||||
for(std::vector<std::string>::size_type i=0;
|
for(std::vector<ConfigFileInfo>::size_type i=0;
|
||||||
i<this->ConsideredConfigFiles.size(); i++)
|
i<this->ConsideredConfigs.size(); i++)
|
||||||
{
|
{
|
||||||
consideredConfigFiles += this->ConsideredConfigFiles[i];
|
consideredConfigFiles += this->ConsideredConfigs[i].filename;
|
||||||
consideredConfigFiles += ";";
|
consideredConfigFiles += ";";
|
||||||
consideredVersions += this->ConsideredVersions[i];
|
consideredVersions += this->ConsideredConfigs[i].version;
|
||||||
consideredVersions += ";";
|
consideredVersions += ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1554,8 +1553,10 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
|
||||||
haveResult = true;
|
haveResult = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->ConsideredConfigFiles.push_back(config_file);
|
ConfigFileInfo configFileInfo;
|
||||||
this->ConsideredVersions.push_back(version);
|
configFileInfo.filename = config_file;
|
||||||
|
configFileInfo.version = version;
|
||||||
|
this->ConsideredConfigs.push_back(configFileInfo);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,8 +138,9 @@ private:
|
||||||
std::vector<std::string> Names;
|
std::vector<std::string> Names;
|
||||||
std::vector<std::string> Configs;
|
std::vector<std::string> Configs;
|
||||||
std::set<std::string> IgnoredPaths;
|
std::set<std::string> IgnoredPaths;
|
||||||
std::vector<std::string> ConsideredConfigFiles;
|
|
||||||
std::vector<std::string> ConsideredVersions;
|
struct ConfigFileInfo { std::string filename; std::string version; };
|
||||||
|
std::vector<ConfigFileInfo> ConsideredConfigs;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue