[Cmake-commits] [cmake-commits] king committed cmFindBase.cxx 1.44 1.45 cmFindCommon.cxx 1.2 1.3 cmFindCommon.h 1.2 1.3 cmFindLibraryCommand.cxx 1.58 1.59 cmFindPackageCommand.cxx 1.37 1.38 cmFindPathCommand.cxx 1.41 1.42

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Jun 9 11:57:58 EDT 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv1246/Source

Modified Files:
	cmFindBase.cxx cmFindCommon.cxx cmFindCommon.h 
	cmFindLibraryCommand.cxx cmFindPackageCommand.cxx 
	cmFindPathCommand.cxx 
Log Message:
ENH: In find_* implementation centralize addition of trailing slashes

  - Create cmFindCommon::AddTrailingSlashes
  - Use it in cmFindBase and cmFindPackageCommand
  - Remove duplication from other find commands


Index: cmFindBase.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindBase.cxx,v
retrieving revision 1.44
retrieving revision 1.45
diff -C 2 -d -r1.44 -r1.45
*** cmFindBase.cxx	8 Jun 2008 15:41:08 -0000	1.44
--- cmFindBase.cxx	9 Jun 2008 15:57:54 -0000	1.45
***************
*** 274,277 ****
--- 274,281 ----
    // Handle search root stuff.
    this->RerootPaths(this->SearchPaths);
+ 
+   // Add a trailing slash to all prefixes to aid the search process.
+   this->AddTrailingSlashes(this->SearchPaths);
+ 
    return true;
  }

Index: cmFindCommon.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindCommon.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** cmFindCommon.cxx	5 Jun 2008 22:20:16 -0000	1.2
--- cmFindCommon.cxx	9 Jun 2008 15:57:54 -0000	1.3
***************
*** 418,419 ****
--- 418,434 ----
      }
  }
+ 
+ //----------------------------------------------------------------------------
+ void cmFindCommon::AddTrailingSlashes(std::vector<std::string>& paths)
+ {
+   // Add a trailing slash to all paths to aid the search process.
+   for(std::vector<std::string>::iterator i = paths.begin();
+       i != paths.end(); ++i)
+     {
+     std::string& p = *i;
+     if(!p.empty() && p[p.size()-1] != '/')
+       {
+       p += "/";
+       }
+     }
+ }

Index: cmFindLibraryCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindLibraryCommand.cxx,v
retrieving revision 1.58
retrieving revision 1.59
diff -C 2 -d -r1.58 -r1.59
*** cmFindLibraryCommand.cxx	11 Feb 2008 22:00:45 -0000	1.58
--- cmFindLibraryCommand.cxx	9 Jun 2008 15:57:55 -0000	1.59
***************
*** 253,266 ****
    }
  
-   // 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)
-     {
-     std::string& p = *i;
-     if(p.empty() || p[p.size()-1] != '/')
-       {
-       p += "/";
-       }
-     }
    std::string tryPath;
    for(std::vector<std::string>::const_iterator p = this->SearchPaths.begin();
--- 253,256 ----

Index: cmFindCommon.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindCommon.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** cmFindCommon.h	5 Jun 2008 22:20:16 -0000	1.2
--- cmFindCommon.h	9 Jun 2008 15:57:55 -0000	1.3
***************
*** 45,48 ****
--- 45,51 ----
    void RerootPaths(std::vector<std::string>& paths);
  
+   /** Add trailing slashes to all search paths.  */
+   void AddTrailingSlashes(std::vector<std::string>& paths);
+ 
    /** Compute the current default root path mode.  */
    void SelectDefaultRootPathMode();

Index: cmFindPackageCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindPackageCommand.cxx,v
retrieving revision 1.37
retrieving revision 1.38
diff -C 2 -d -r1.37 -r1.38
*** cmFindPackageCommand.cxx	5 Jun 2008 22:20:16 -0000	1.37
--- cmFindPackageCommand.cxx	9 Jun 2008 15:57:56 -0000	1.38
***************
*** 1068,1080 ****
  
    // Add a trailing slash to all prefixes to aid the search process.
!   for(std::vector<std::string>::iterator i = prefixes.begin();
!       i != prefixes.end(); ++i)
!     {
!     std::string& prefix = *i;
!     if(prefix[prefix.size()-1] != '/')
!       {
!       prefix += "/";
!       }
!     }
  }
  
--- 1068,1072 ----
  
    // Add a trailing slash to all prefixes to aid the search process.
!   this->AddTrailingSlashes(prefixes);
  }
  

Index: cmFindPathCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindPathCommand.cxx,v
retrieving revision 1.41
retrieving revision 1.42
diff -C 2 -d -r1.41 -r1.42
*** cmFindPathCommand.cxx	23 Jan 2008 15:27:59 -0000	1.41
--- cmFindPathCommand.cxx	9 Jun 2008 15:57:56 -0000	1.42
***************
*** 103,116 ****
      }
    std::string framework;
-   // 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)
-     {
-     std::string& p = *i;
-     if(p.empty() || p[p.size()-1] != '/')
-       {
-       p += "/";
-       }
-     }
    // Use the search path to find the file.
    unsigned int k;
--- 103,106 ----



More information about the Cmake-commits mailing list