Index: Source/cmFindLibraryCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindLibraryCommand.cxx,v
retrieving revision 1.64
diff -u -r1.64 cmFindLibraryCommand.cxx
--- Source/cmFindLibraryCommand.cxx	28 Sep 2009 15:42:40 -0000	1.64
+++ Source/cmFindLibraryCommand.cxx	10 Oct 2009 10:17:26 -0000
@@ -461,18 +461,18 @@
 {
   // Search the entire path for each name.
   cmFindLibraryHelper helper(this->Makefile);
-  for(std::vector<std::string>::const_iterator ni = this->Names.begin();
-      ni != this->Names.end() ; ++ni)
+  // Search every directory.
+  for(std::vector<std::string>::const_iterator
+        p = this->SearchPaths.begin();
+      p != this->SearchPaths.end(); ++p)
     {
-    // Switch to searching for this name.
-    std::string const& name = *ni;
-    helper.SetName(name);
-
-    // Search every directory.
-    for(std::vector<std::string>::const_iterator
-          p = this->SearchPaths.begin();
-        p != this->SearchPaths.end(); ++p)
+    for(std::vector<std::string>::const_iterator ni = this->Names.begin();
+        ni != this->Names.end() ; ++ni)
       {
+      // Switch to searching for this name.
+      std::string const& name = *ni;
+      helper.SetName(name);
+
       if(helper.CheckDirectory(*p))
         {
         return helper.BestPath;
