[Cmake-commits] [cmake-commits] david.cole committed Glob.cxx 1.14 1.15 Glob.hxx.in 1.8 1.9

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Sep 11 14:34:06 EDT 2008


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

Modified Files:
	Glob.cxx Glob.hxx.in 
Log Message:
ENH: Improve FILE GLOB_RECURSE handling of symlinks with a new CMake policy. CMP0009 establishes NEW default behavior of not recursing through symlinks. OLD default behavior or explicit FOLLOW_SYMLINKS argument to FILE GLOB_RECURSE will still recurse through symlinks.


Index: Glob.hxx.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/Glob.hxx.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -C 2 -d -r1.8 -r1.9
*** Glob.hxx.in	20 Aug 2008 17:24:16 -0000	1.8
--- Glob.hxx.in	11 Sep 2008 18:34:04 -0000	1.9
***************
*** 65,68 ****
--- 65,71 ----
    bool GetRecurseThroughSymlinks() { return this->RecurseThroughSymlinks; }
  
+   //! Get the number of symlinks followed through recursion
+   unsigned int GetFollowedSymlinkCount() { return this->FollowedSymlinkCount; }
+ 
    //! Set relative to true to only show relative path to files.
    void SetRelative(const char* dir);
***************
*** 99,102 ****
--- 102,106 ----
    kwsys_stl::string Relative;
    bool RecurseThroughSymlinks;
+   unsigned int FollowedSymlinkCount;
  
  private:

Index: Glob.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/Glob.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -C 2 -d -r1.14 -r1.15
*** Glob.cxx	20 Aug 2008 17:24:16 -0000	1.14
--- Glob.cxx	11 Sep 2008 18:34:04 -0000	1.15
***************
*** 68,71 ****
--- 68,72 ----
      // RecurseThroughSymlinks is true by default for backwards compatibility,
      // not because it's a good idea...
+   this->FollowedSymlinkCount = 0;
  }
  
***************
*** 267,273 ****
      if ( kwsys::SystemTools::FileIsDirectory(realname.c_str()) )
        {
!       if (!kwsys::SystemTools::FileIsSymlink(realname.c_str()) ||
!         this->RecurseThroughSymlinks)
          {
          this->RecurseDirectory(start+1, realname, dir_only);
          }
--- 268,278 ----
      if ( kwsys::SystemTools::FileIsDirectory(realname.c_str()) )
        {
!       bool isSymLink = kwsys::SystemTools::FileIsSymlink(realname.c_str());
!       if (!isSymLink || this->RecurseThroughSymlinks)
          {
+         if (isSymLink)
+           {
+           ++this->FollowedSymlinkCount;
+           }
          this->RecurseDirectory(start+1, realname, dir_only);
          }



More information about the Cmake-commits mailing list