diff options
author | Brad King <brad.king@kitware.com> | 2016-06-16 09:46:42 -0400 |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-06-16 09:46:42 -0400 |
commit | ce624540199a4685e04425a7668e8f2e0384267d (patch) | |
tree | 5b0af10cc8c18971ecadcc58884b004ac6c758cc /Source/cmFindPackageCommand.cxx | |
parent | 83ae79442c8bc16cca72977e0671845efe191696 (diff) | |
parent | 919db25c3b54f0303a19abb4a9e4f16056a3c1b6 (diff) | |
download | cmake-ce624540199a4685e04425a7668e8f2e0384267d.tar.gz |
Merge topic 'find_package-duplicate-search-paths'
919db25c cmFindPackageCommand: remove duplicate paths from error message
ebf18df5 cmFindPackageCommand: use iterators to loop over configurations
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 1a44d73dc4..d074b055f4 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -672,16 +672,18 @@ bool cmFindPackageCommand::HandlePackageMode() // If there are files in ConsideredConfigs, it means that FooConfig.cmake // have been found, but they didn't have appropriate versions. 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 << "\" that " << (this->VersionExact ? "exactly matches" : "is compatible with") << " requested version \"" << this->Version << "\".\n" << "The following configuration files were considered but not " "accepted:\n"; - for (std::vector<ConfigFileInfo>::size_type i = 0; - i < this->ConsideredConfigs.size(); i++) { - e << " " << this->ConsideredConfigs[i].filename - << ", version: " << this->ConsideredConfigs[i].version << "\n"; + for (std::vector<ConfigFileInfo>::const_iterator i = + this->ConsideredConfigs.begin(); + i != duplicate_end; ++i) { + e << " " << i->filename << ", version: " << i->version << "\n"; } } else { std::string requestedVersionString; @@ -774,12 +776,13 @@ bool cmFindPackageCommand::HandlePackageMode() std::string consideredVersions; const char* sep = ""; - for (std::vector<ConfigFileInfo>::size_type i = 0; - i < this->ConsideredConfigs.size(); i++) { + for (std::vector<ConfigFileInfo>::const_iterator i = + this->ConsideredConfigs.begin(); + i != this->ConsideredConfigs.end(); ++i) { consideredConfigFiles += sep; consideredVersions += sep; - consideredConfigFiles += this->ConsideredConfigs[i].filename; - consideredVersions += this->ConsideredConfigs[i].version; + consideredConfigFiles += i->filename; + consideredVersions += i->version; sep = ";"; } |