[Cmake-commits] CMake branch, next, updated. v3.0.1-5069-gdf07858

Chuck Atkins chuck.atkins at kitware.com
Thu Aug 28 21:40:59 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  df0785816ad5d13c2bd3ddc7c733daaf3b01f2be (commit)
       via  a98f2d9af4eae73690794266d2e486c38c8755c1 (commit)
      from  3c0cb1c4315debb4092763b521af7dd479b9601e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df0785816ad5d13c2bd3ddc7c733daaf3b01f2be
commit df0785816ad5d13c2bd3ddc7c733daaf3b01f2be
Merge: 3c0cb1c a98f2d9
Author:     Chuck Atkins <chuck.atkins at kitware.com>
AuthorDate: Thu Aug 28 21:40:57 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Aug 28 21:40:57 2014 -0400

    Merge topic 'add-find-root-system_only-mode' into next
    
    a98f2d9a Ensure that SearchPaths is kept in sync with SearchPathsRerootable


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a98f2d9af4eae73690794266d2e486c38c8755c1
commit a98f2d9af4eae73690794266d2e486c38c8755c1
Author:     Chuck Atkins <chuck.atkins at kitware.com>
AuthorDate: Thu Aug 28 21:36:04 2014 -0400
Commit:     Chuck Atkins <chuck.atkins at kitware.com>
CommitDate: Thu Aug 28 21:36:04 2014 -0400

    Ensure that SearchPaths is kept in sync with SearchPathsRerootable

diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index caf9b10..e03cebf 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -194,7 +194,7 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
   // Filter out ignored paths from the prefix list
   std::set<std::string> ignored;
   this->GetIgnoredPaths(ignored);
-  this->FilterPaths(this->SearchPaths, ignored);
+  this->FilterPaths(ignored);
 
   this->ComputeFinalPaths();
 
@@ -390,39 +390,39 @@ void cmFindBase::AddUserGuessPath()
 //----------------------------------------------------------------------------
 void cmFindBase::AddPathSuffixes()
 {
-  std::vector<std::string>& paths = this->SearchPaths;
-  std::vector<std::string> finalPath = paths;
-  std::vector<std::string>::iterator i;
-  // clear the path
-  paths.clear();
-  // convert all paths to unix slashes and add search path suffixes
-  // if there are any
-  for(i = finalPath.begin();
-      i != finalPath.end(); ++i)
+  std::vector<std::string> adjustedPaths;
+  std::vector<bool> adjustedPathsRerootable;
+
+  std::vector<std::string>::iterator pi = this->SearchPaths.begin();
+  std::vector<bool>::const_iterator pri = this->SearchPathsRerootable.begin();
+  for(; pi != this->SearchPaths.end(); ++pi, ++pri)
     {
-    cmSystemTools::ConvertToUnixSlashes(*i);
-    // copy each finalPath combined with SearchPathSuffixes
-    // to the SearchPaths ivar
-    for(std::vector<std::string>::iterator j =
-          this->SearchPathSuffixes.begin();
-        j != this->SearchPathSuffixes.end(); ++j)
-      {
-      // if *i is only / then do not add a //
-      // this will get incorrectly considered a network
-      // path on windows and cause huge delays.
-      std::string p = *i;
-      if(p.size() && p[p.size()-1] != '/')
-        {
-        p += std::string("/");
-        }
-      p +=  *j;
-      // add to all paths because the search path may be modified
-      // later with lib being replaced for lib64 which may exist
-      paths.push_back(p);
+    // Convert all paths to unix slashes
+    cmSystemTools::ConvertToUnixSlashes(*pi);
+
+    // Add trailing slash if appropriate
+    if(!pi->empty() && *pi->rbegin() != '/')
+      {
+      *pi += std::string("/");
       }
-    // now put the path without the path suffixes in the SearchPaths
-    paths.push_back(*i);
+
+    // Add suffix to all paths because the search path may be modified
+    // later with lib being replaced for lib64 which may exist
+    std::vector<std::string>::iterator si;
+    for(si = this->SearchPathSuffixes.begin();
+        si != this->SearchPathSuffixes.end(); ++si)
+      {
+      adjustedPaths.push_back(*pi+*si);
+      adjustedPathsRerootable.push_back(*pri);
+      }
+
+    // And lastly, keep the originals
+    adjustedPaths.push_back(*pi);
+    adjustedPathsRerootable.push_back(*pri);
     }
+
+  this->SearchPaths = adjustedPaths;
+  this->SearchPathsRerootable = adjustedPathsRerootable;
 }
 
 void cmFindBase::PrintFindStuff()
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 0ef2904..8258e11 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -135,7 +135,7 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
 
 //----------------------------------------------------------------------------
 void cmFindCommon::RerootPaths(std::vector<std::string>& paths,
-                               const std::vector<bool> &pathsRerootable)
+                               std::vector<bool> &pathsRerootable)
 {
 #if 0
   for(std::vector<std::string>::const_iterator i = paths.begin();
@@ -181,40 +181,43 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths,
       this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX");
 
   // Copy the original set of unrooted paths.
-  std::vector<std::string> unrootedPaths = paths;
-  paths.clear();
-
-  for(std::vector<std::string>::const_iterator ri = roots.begin();
-      ri != roots.end(); ++ri)
-    {
-    std::vector<std::string>::const_iterator ui;
-    std::vector<bool>::const_iterator rri;
-    for(ui = unrootedPaths.begin(), rri = pathsRerootable.begin();
-        ui != unrootedPaths.end(); ++ui, ++rri)
+  std::vector<std::string> unrootedPaths;
+  std::vector<bool> unrootedPathsRerootable;
+  unrootedPaths.swap(paths);
+  unrootedPathsRerootable.swap(pathsRerootable);
+
+  std::vector<std::string>::const_iterator ri;
+  for(ri = roots.begin(); ri != roots.end(); ++ri)
+    {
+    std::vector<std::string>::const_iterator upi;
+    std::vector<bool>::const_iterator upri;
+    for(upi = unrootedPaths.begin(), upri = unrootedPathsRerootable.begin();
+        upi != unrootedPaths.end(); ++upi, ++upri)
       {
       // Place the unrooted path under the current root if it is not
       // already inside.  Skip the unrooted path if it is relative to
       // a user home directory or is empty.
       std::string rootedDir;
-      if(!*rri
-         || cmSystemTools::IsSubDirectory(ui->c_str(), ri->c_str())
+      if(!*upri
+         || cmSystemTools::IsSubDirectory(upi->c_str(), ri->c_str())
          || (stagePrefix
-             && cmSystemTools::IsSubDirectory(ui->c_str(), stagePrefix)))
+             && cmSystemTools::IsSubDirectory(upi->c_str(), stagePrefix)))
         {
-        rootedDir = *ui;
+        rootedDir = *upi;
         }
-      else if(!ui->empty() && (*ui)[0] != '~')
+      else if(!upi->empty() && *upi->begin() != '~')
         {
         // Start with the new root.
         rootedDir = *ri;
         rootedDir += "/";
 
         // Append the original path with its old root removed.
-        rootedDir += cmSystemTools::SplitPathRootComponent(ui->c_str());
+        rootedDir += cmSystemTools::SplitPathRootComponent(upi->c_str());
         }
 
       // Store the new path.
       paths.push_back(rootedDir);
+      pathsRerootable.push_back(*upri);
       }
     }
 
@@ -223,25 +226,30 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths,
   if(this->FindRootPathMode == RootPathModeBoth)
     {
     paths.insert(paths.end(), unrootedPaths.begin(), unrootedPaths.end());
+    pathsRerootable.insert(pathsRerootable.end(),
+      unrootedPathsRerootable.begin(), unrootedPathsRerootable.end());
     }
 }
 
 //----------------------------------------------------------------------------
-void cmFindCommon::FilterPaths(std::vector<std::string>& paths,
-                               const std::set<std::string>& ignore)
+void cmFindCommon::FilterPaths(const std::set<std::string>& ignore)
 {
-  // Now filter out anything that's in the ignore set.
-  std::vector<std::string> unfiltered;
-  unfiltered.swap(paths);
+  std::vector<std::string> filtered;
+  std::vector<bool> filteredRerootable;
 
-  for(std::vector<std::string>::iterator pi = unfiltered.begin();
-      pi != unfiltered.end(); ++pi)
+  std::vector<std::string>::const_iterator pi = this->SearchPaths.begin();
+  std::vector<bool>::const_iterator pri = this->SearchPathsRerootable.begin();
+  for(; pi != this->SearchPaths.end(); ++pi, ++pri)
     {
+    // Now filter out anything that's in the ignore set.
     if (ignore.count(*pi) == 0)
       {
-      paths.push_back(*pi);
+      filtered.push_back(*pi);
+      filteredRerootable.push_back(*pri);
       }
     }
+  this->SearchPaths = filtered;
+  this->SearchPathsRerootable = filteredRerootable;
 }
 
 
@@ -464,13 +472,12 @@ void cmFindCommon::ComputeFinalPaths()
   this->RerootPaths(this->SearchPaths, this->SearchPathsRerootable);
 
   // 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)
+  for(std::vector<std::string>::iterator pi = this->SearchPaths.begin();
+      pi != this->SearchPaths.end(); ++pi)
     {
-    std::string& p = *i;
-    if(!p.empty() && p[p.size()-1] != '/')
+    if(!pi->empty() && *pi->rbegin() != '/')
       {
-      p += "/";
+      *pi += "/";
       }
     }
 }
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index 9ae0e6a..07cc20c 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -40,15 +40,14 @@ protected:
   /** Place a set of search paths under the search roots.  */
   void RerootPaths(std::vector<std::string>& paths);
   void RerootPaths(std::vector<std::string>& paths,
-                   const std::vector<bool> &pathsRerootable);
+                   std::vector<bool> &pathsRerootable);
 
   /** Get ignored paths from CMAKE_[SYSTEM_]IGNORE_path variables.  */
   void GetIgnoredPaths(std::vector<std::string>& ignore);
   void GetIgnoredPaths(std::set<std::string>& ignore);
 
   /** Remove paths in the ignore set from the supplied vector.  */
-  void FilterPaths(std::vector<std::string>& paths,
-                   const std::set<std::string>& ignore);
+  void FilterPaths(const std::set<std::string>& ignore);
 
   /** Compute final search path list (reroot + trailing slash).  */
   void ComputeFinalPaths();
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index fe5e45f..1d73575 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -86,18 +86,24 @@ bool cmFindLibraryCommand
 //----------------------------------------------------------------------------
 void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix)
 {
-  std::vector<std::string> original;
-  original.swap(this->SearchPaths);
-  for(std::vector<std::string>::iterator i = original.begin();
-      i != original.end(); ++i)
+  std::vector<std::string> originalPaths;
+  std::vector<bool> originalPathsRerootable;
+  originalPaths.swap(this->SearchPaths);
+  originalPathsRerootable.swap(this->SearchPathsRerootable);
+
+  std::vector<std::string>::const_iterator opi;
+  std::vector<bool>::const_iterator opri;
+  for(opi = originalPaths.begin(), opri = originalPathsRerootable.begin();
+      opi != originalPaths.end(); ++opi, ++opri)
     {
-    this->AddArchitecturePath(*i, 0, suffix);
+    this->AddArchitecturePath(*opi, *opri, 0, suffix);
     }
 }
 
 //----------------------------------------------------------------------------
 void cmFindLibraryCommand::AddArchitecturePath(
-  std::string const& dir, std::string::size_type start_pos,
+  std::string const& dir, bool rerootable,
+  std::string::size_type start_pos,
   const char* suffix, bool fresh)
 {
   std::string::size_type pos = dir.find("lib/", start_pos);
@@ -111,13 +117,13 @@ void cmFindLibraryCommand::AddArchitecturePath(
       {
       next_dir += dir.substr(pos+3);
       std::string::size_type next_pos = pos+3+strlen(suffix)+1;
-      this->AddArchitecturePath(next_dir, next_pos, suffix);
+      this->AddArchitecturePath(next_dir, rerootable, next_pos, suffix);
       }
 
     // Follow "lib".
     if(cmSystemTools::FileIsDirectory(cur_dir.c_str()))
       {
-      this->AddArchitecturePath(dir, pos+3+1, suffix, false);
+      this->AddArchitecturePath(dir, rerootable, pos+3+1, suffix, false);
       }
     }
   if(fresh)
@@ -127,12 +133,14 @@ void cmFindLibraryCommand::AddArchitecturePath(
     if(cmSystemTools::FileIsDirectory(cur_dir.c_str()))
       {
       this->SearchPaths.push_back(cur_dir);
+      this->SearchPathsRerootable.push_back(rerootable);
       }
 
     // Now add the original unchanged path
     if(cmSystemTools::FileIsDirectory(dir.c_str()))
       {
       this->SearchPaths.push_back(dir);
+      this->SearchPathsRerootable.push_back(rerootable);
       }
     }
 }
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index e257174..edc378c 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -55,10 +55,9 @@ public:
 
 protected:
   void AddArchitecturePaths(const char* suffix);
-  void AddArchitecturePath(std::string const& dir,
+  void AddArchitecturePath(std::string const& dir, bool rerootable,
                            std::string::size_type start_pos,
-                           const char* suffix,
-                           bool fresh = true);
+                           const char* suffix, bool fresh = true);
   std::string FindLibrary();
 private:
   std::string FindNormalLibrary();
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index e07927d..1a578a0 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -927,7 +927,7 @@ bool cmFindPackageCommand::FindConfig()
 //----------------------------------------------------------------------------
 bool cmFindPackageCommand::FindPrefixedConfig()
 {
-  std::vector<std::string>& prefixes = this->SearchPaths;
+  const std::vector<std::string>& prefixes = this->SearchPaths;
   for(std::vector<std::string>::const_iterator pi = prefixes.begin();
       pi != prefixes.end(); ++pi)
     {
@@ -942,7 +942,7 @@ bool cmFindPackageCommand::FindPrefixedConfig()
 //----------------------------------------------------------------------------
 bool cmFindPackageCommand::FindFrameworkConfig()
 {
-  std::vector<std::string>& prefixes = this->SearchPaths;
+  const std::vector<std::string>& prefixes = this->SearchPaths;
   for(std::vector<std::string>::const_iterator i = prefixes.begin();
       i != prefixes.end(); ++i)
     {
@@ -957,7 +957,7 @@ bool cmFindPackageCommand::FindFrameworkConfig()
 //----------------------------------------------------------------------------
 bool cmFindPackageCommand::FindAppBundleConfig()
 {
-  std::vector<std::string>& prefixes = this->SearchPaths;
+  const std::vector<std::string>& prefixes = this->SearchPaths;
   for(std::vector<std::string>::const_iterator i = prefixes.begin();
       i != prefixes.end(); ++i)
     {

-----------------------------------------------------------------------

Summary of changes:
 Source/cmFindBase.cxx           |   62 ++++++++++++++++++------------------
 Source/cmFindCommon.cxx         |   67 +++++++++++++++++++++------------------
 Source/cmFindCommon.h           |    5 ++-
 Source/cmFindLibraryCommand.cxx |   24 +++++++++-----
 Source/cmFindLibraryCommand.h   |    5 ++-
 Source/cmFindPackageCommand.cxx |    6 ++--
 6 files changed, 91 insertions(+), 78 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list