diff options
author | Brad King <brad.king@kitware.com> | 2012-07-20 17:30:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-07-20 18:19:10 (GMT) |
commit | 54add62f1b36ffc25f333762901e14b2def21db2 (patch) | |
tree | 725f9e894fde03357c07e6e4996666d23ea06f57 /Source/cmFindLibraryCommand.cxx | |
parent | 6ca2f82d0d8dbb1f0f79c5fe1a4e21de78a57c84 (diff) | |
download | CMake-54add62f1b36ffc25f333762901e14b2def21db2.zip CMake-54add62f1b36ffc25f333762901e14b2def21db2.tar.gz CMake-54add62f1b36ffc25f333762901e14b2def21db2.tar.bz2 |
find_library: Simplify lib->lib<arch> expansion
Simplify cmFindLibraryCommand::AddArchitecturePaths logic to avoid
recording a separate 'found' status and populating an entire
vector<string> just to throw it away.
Diffstat (limited to 'Source/cmFindLibraryCommand.cxx')
-rw-r--r-- | Source/cmFindLibraryCommand.cxx | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 688d8a7..06216cd 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -132,44 +132,36 @@ bool cmFindLibraryCommand //---------------------------------------------------------------------------- void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix) { - std::vector<std::string> newPaths; - bool found = false; + std::vector<std::string> original; + original.swap(this->SearchPaths); std::string subpath = "lib"; subpath += suffix; subpath += "/"; - for(std::vector<std::string>::iterator i = this->SearchPaths.begin(); - i != this->SearchPaths.end(); ++i) + for(std::vector<std::string>::iterator i = original.begin(); + i != original.end(); ++i) { // Try replacing lib/ with lib<suffix>/ std::string s = *i; cmSystemTools::ReplaceString(s, "lib/", subpath.c_str()); if((s != *i) && cmSystemTools::FileIsDirectory(s.c_str())) { - found = true; - newPaths.push_back(s); + this->SearchPaths.push_back(s); } - // Now look for lib<suffix> + // Now look for <original><suffix>/ s = *i; s += suffix; s += "/"; if(cmSystemTools::FileIsDirectory(s.c_str())) { - found = true; - newPaths.push_back(s); + this->SearchPaths.push_back(s); } - // now add the original unchanged path + // Now add the original unchanged path if(cmSystemTools::FileIsDirectory(i->c_str())) { - newPaths.push_back(*i); + this->SearchPaths.push_back(*i); } } - - // If any new paths were found replace the original set. - if(found) - { - this->SearchPaths = newPaths; - } } //---------------------------------------------------------------------------- |