summaryrefslogtreecommitdiff
path: root/Source/cmFindLibraryCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-09-01 13:39:55 -0400
committerBrad King <brad.king@kitware.com>2015-09-02 10:17:21 -0400
commitbf32b95efed986eed7f5e0c568c5bc9559bcb854 (patch)
treed070605675bac8a287cc3693d8326be019a1d5b0 /Source/cmFindLibraryCommand.cxx
parent72c11e590273d100c49f472afc3a7569b233ff00 (diff)
downloadcmake-bf32b95efed986eed7f5e0c568c5bc9559bcb854.tar.gz
cmFindLibraryCommand: Avoid repeating search for the same name
In FindNormalLibraryDirsPerName we consider one name at a time and search the entire path. Avoid repeated consideration of names by removing each one from the list of candidates before considering the next one. This will not change behavior because we already know the earlier candidates were not found on repeated considering anyway.
Diffstat (limited to 'Source/cmFindLibraryCommand.cxx')
-rw-r--r--Source/cmFindLibraryCommand.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index e8d158ebb0..e7696af402 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -203,6 +203,7 @@ struct cmFindLibraryHelper
}
bool HasValidSuffix(std::string const& name);
void AddName(std::string const& name);
+ void SetName(std::string const& name);
bool CheckDirectory(std::string const& path);
bool CheckDirectoryForName(std::string const& path, Name& name);
};
@@ -322,6 +323,13 @@ void cmFindLibraryHelper::AddName(std::string const& name)
}
//----------------------------------------------------------------------------
+void cmFindLibraryHelper::SetName(std::string const& name)
+{
+ this->Names.clear();
+ this->AddName(name);
+}
+
+//----------------------------------------------------------------------------
bool cmFindLibraryHelper::CheckDirectory(std::string const& path)
{
for(std::vector<Name>::iterator i = this->Names.begin();
@@ -459,8 +467,7 @@ std::string cmFindLibraryCommand::FindNormalLibraryDirsPerName()
ni != this->Names.end() ; ++ni)
{
// Switch to searching for this name.
- std::string const& name = *ni;
- helper.AddName(name);
+ helper.SetName(*ni);
// Search every directory.
for(std::vector<std::string>::const_iterator