[cmake-commits] king committed cmFindLibraryCommand.cxx 1.56 1.57
cmake-commits at cmake.org
cmake-commits at cmake.org
Sun Feb 10 11:37:08 EST 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv11177/Source
Modified Files:
cmFindLibraryCommand.cxx
Log Message:
BUG: Fix recent find_library change to look for user-specified name first to do so only if the name matches a valid library extension.
Index: cmFindLibraryCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindLibraryCommand.cxx,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- cmFindLibraryCommand.cxx 6 Feb 2008 20:26:22 -0000 1.56
+++ cmFindLibraryCommand.cxx 10 Feb 2008 16:37:06 -0000 1.57
@@ -234,6 +234,24 @@
std::vector<std::string> suffixes;
cmSystemTools::ExpandListArgument(prefixes_list, prefixes, true);
cmSystemTools::ExpandListArgument(suffixes_list, suffixes, true);
+
+ // If the original library name provided by the user matches one of
+ // the suffixes, try it first.
+ bool tryOrig = false;
+ {
+ std::string nm = name;
+ for(std::vector<std::string>::const_iterator si = suffixes.begin();
+ !tryOrig && si != suffixes.end(); ++si)
+ {
+ std::string const& suffix = *si;
+ if(nm.length() > suffix.length() &&
+ nm.substr(nm.size()-suffix.length()) == suffix)
+ {
+ tryOrig = true;
+ }
+ }
+ }
+
// Add a trailing slash to all paths to aid the search process.
for(std::vector<std::string>::iterator i = this->SearchPaths.begin();
i != this->SearchPaths.end(); ++i)
@@ -264,13 +282,16 @@
if(!onlyFrameworks)
{
// Try the original library name as specified by the user.
- tryPath = *p;
- tryPath += name;
- if(cmSystemTools::FileExists(tryPath.c_str(), true))
+ if(tryOrig)
{
- tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
- cmSystemTools::ConvertToUnixSlashes(tryPath);
- return tryPath;
+ tryPath = *p;
+ tryPath += name;
+ if(cmSystemTools::FileExists(tryPath.c_str(), true))
+ {
+ tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
+ cmSystemTools::ConvertToUnixSlashes(tryPath);
+ return tryPath;
+ }
}
// Try various library naming conventions.
More information about the Cmake-commits
mailing list