[Cmake-commits] [cmake-commits] king committed cmOrderDirectories.cxx 1.7 1.8

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Dec 26 13:28:22 EST 2008


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

Modified Files:
	cmOrderDirectories.cxx 
Log Message:
BUG: Fix same-file check for directory ordering

When computing runtime search path ordering a constraint exists when a
file that may be found by the runtime search exists in a directory other
than that containing the desired file.  We test whether a potential
conflict is really the same due to a symlink.  Recently the change to
cmFindLibraryCommand to load directory content created a case in which
the same-file check would be incorrectly skipped.  This avoids skipping
the check.


Index: cmOrderDirectories.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmOrderDirectories.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -C 2 -d -r1.7 -r1.8
*** cmOrderDirectories.cxx	29 Jul 2008 18:57:00 -0000	1.7
--- cmOrderDirectories.cxx	26 Dec 2008 18:28:20 -0000	1.8
***************
*** 114,136 ****
                                                     std::string const& name)
  {
!   // Check if the file will be built by cmake.
!   std::set<cmStdString> const& files =
!     (this->GlobalGenerator->GetDirectoryContent(dir, false));
!   if(std::set<cmStdString>::const_iterator(files.find(name)) != files.end())
!     {
!     return true;
!     }
! 
!   // Check if the file exists on disk and is not a symlink back to the
!   // original file.
    std::string file = dir;
    file += "/";
    file += name;
!   if(cmSystemTools::FileExists(file.c_str(), true) &&
!      !cmSystemTools::SameFile(this->FullPath.c_str(), file.c_str()))
      {
!     return true;
      }
!   return false;
  }
  
--- 114,133 ----
                                                     std::string const& name)
  {
!   // Check if the file exists on disk.
    std::string file = dir;
    file += "/";
    file += name;
!   if(cmSystemTools::FileExists(file.c_str(), true))
      {
!     // The file conflicts only if it is not the same as the original
!     // file due to a symlink or hardlink.
!     return !cmSystemTools::SameFile(this->FullPath.c_str(), file.c_str());
      }
! 
!   // Check if the file will be built by cmake.
!   std::set<cmStdString> const& files =
!     (this->GlobalGenerator->GetDirectoryContent(dir, false));
!   std::set<cmStdString>::const_iterator fi = files.find(name);
!   return fi != files.end();
  }
  



More information about the Cmake-commits mailing list