[Cmake-commits] CMake branch, next, updated. v3.0.1-5133-g540e371

Chuck Atkins chuck.atkins at kitware.com
Wed Sep 3 23:08:22 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  540e371df1bd981adcb571947dcec25dc103874a (commit)
       via  e40ba09125d078dc104626ee126a3e6fe08f5dd2 (commit)
       via  881f4e6c2a355b33c79cd7c62ccae1589f4f11a8 (commit)
      from  fd18694013aae0af45834cdf9d1317d59f0163c4 (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=540e371df1bd981adcb571947dcec25dc103874a
commit 540e371df1bd981adcb571947dcec25dc103874a
Merge: fd18694 e40ba09
Author:     Chuck Atkins <chuck.atkins at kitware.com>
AuthorDate: Wed Sep 3 23:08:21 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Sep 3 23:08:21 2014 -0400

    Merge topic 'add-find-root-system_only-mode' into next
    
    e40ba091 Add a new SYSTEM_ONLY mode for CMAKE_FIND_ROOT_PATH.
    881f4e6c Keep a list of which search paths are re-rootable.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e40ba09125d078dc104626ee126a3e6fe08f5dd2
commit e40ba09125d078dc104626ee126a3e6fe08f5dd2
Author:     Chuck Atkins <chuck.atkins at kitware.com>
AuthorDate: Wed Sep 3 23:00:52 2014 -0400
Commit:     Chuck Atkins <chuck.atkins at kitware.com>
CommitDate: Wed Sep 3 23:00:52 2014 -0400

    Add a new SYSTEM_ONLY mode for CMAKE_FIND_ROOT_PATH.
    
    This new SYSTEM_ONLY mode allows for the intrinsic system paths
    used for find_* commands to get re-rooted from the CMAKE_FIND_ROOT_PATH
    variable while maintaining original user-specified paths.  The intent is
    for this to be the preferred mode for cross compiling.  It allows for a
    a restricted default search within a desired system root but also
    lets the user specify explicit search paths anythere on the host system.

diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt
index 5889e90..2d97e80 100644
--- a/Help/command/FIND_XXX.txt
+++ b/Help/command/FIND_XXX.txt
@@ -21,6 +21,7 @@ The general signature is:
              [NO_SYSTEM_ENVIRONMENT_PATH]
              [NO_CMAKE_SYSTEM_PATH]
              [CMAKE_FIND_ROOT_PATH_BOTH |
+              CMAKE_FIND_ROOT_PATH_SYSTEM_ONLY |
               ONLY_CMAKE_FIND_ROOT_PATH |
               NO_CMAKE_FIND_ROOT_PATH]
             )
diff --git a/Help/command/FIND_XXX_ROOT.txt b/Help/command/FIND_XXX_ROOT.txt
index b5cab68..a4a9a32 100644
--- a/Help/command/FIND_XXX_ROOT.txt
+++ b/Help/command/FIND_XXX_ROOT.txt
@@ -21,3 +21,5 @@ the search order will be as described above.  If
 NO_CMAKE_FIND_ROOT_PATH is used then :variable:`CMAKE_FIND_ROOT_PATH` will not be
 used.  If ONLY_CMAKE_FIND_ROOT_PATH is used then only the re-rooted
 directories and directories below :variable:`CMAKE_STAGING_PREFIX` will be searched.
+If CMAKE_FIND_ROOT_PATH_SYSTEM_ONLY is used then the paths described above
+wll be re-rooted and searched followed by the original user-spefied paths.
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index 190d05c..3a1e17f 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -72,6 +72,7 @@ The complete Config mode command signature is::
                [NO_CMAKE_SYSTEM_PATH]
                [NO_CMAKE_SYSTEM_PACKAGE_REGISTRY]
                [CMAKE_FIND_ROOT_PATH_BOTH |
+                CMAKE_FIND_ROOT_PATH_SYSTEM_ONLY |
                 ONLY_CMAKE_FIND_ROOT_PATH |
                 NO_CMAKE_FIND_ROOT_PATH])
 
diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst
index f36a43c..3be5e86 100644
--- a/Help/manual/cmake-toolchains.7.rst
+++ b/Help/manual/cmake-toolchains.7.rst
@@ -111,9 +111,9 @@ as:
   set(CMAKE_CXX_COMPILER /home/devel/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++)
 
   set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY SYSTEM_ONLY)
+  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE SYSTEM_ONLY)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE SYSTEM_ONLY)
 
 The :variable:`CMAKE_SYSTEM_NAME` is the CMake-identifier of the target platform
 to build for.
diff --git a/Help/variable/CMAKE_FIND_ROOT_PATH_MODE_XXX.txt b/Help/variable/CMAKE_FIND_ROOT_PATH_MODE_XXX.txt
index ab65e09..e2eb84e 100644
--- a/Help/variable/CMAKE_FIND_ROOT_PATH_MODE_XXX.txt
+++ b/Help/variable/CMAKE_FIND_ROOT_PATH_MODE_XXX.txt
@@ -4,5 +4,7 @@ This variable controls whether the :variable:`CMAKE_FIND_ROOT_PATH` and
 If set to ``ONLY``, then only the roots in :variable:`CMAKE_FIND_ROOT_PATH`
 will be searched. If set to ``NEVER``, then the roots in
 :variable:`CMAKE_FIND_ROOT_PATH` will be ignored and only the host system
-root will be used. If set to ``BOTH``, then the host system paths and the
+root will be used. If set to ``SYSTEM_ONLY``, then the host system paths
+will be re-rooted and searched followed by the original user specified
+paths. If set to ``BOTH``, then the host system paths and the
 paths in :variable:`CMAKE_FIND_ROOT_PATH` will be searched.
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 132c7b1..e03cebf 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -376,13 +376,15 @@ void cmFindBase::AddCMakeSystemVariablePath()
 //----------------------------------------------------------------------------
 void cmFindBase::AddUserHintsPath()
 {
-  this->AddPathsInternal(this->UserHints, CMakePath, true);
+  this->AddPathsInternal(this->UserHints, CMakePath,
+                         this->FindRootPathMode != RootPathModeSystemOnly);
 }
 
 //----------------------------------------------------------------------------
 void cmFindBase::AddUserGuessPath()
 {
-  this->AddPathsInternal(this->UserPaths, CMakePath, true);
+  this->AddPathsInternal(this->UserPaths, CMakePath,
+                         this->FindRootPathMode != RootPathModeSystemOnly);
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 412a7a7..8258e11 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -64,6 +64,10 @@ void cmFindCommon::SelectDefaultRootPathMode()
     {
     this->FindRootPathMode = RootPathModeBoth;
     }
+  else if (rootPathMode=="SYSTEM_ONLY")
+    {
+    this->FindRootPathMode = RootPathModeSystemOnly;
+    }
 }
 
 //----------------------------------------------------------------------------
@@ -322,6 +326,10 @@ bool cmFindCommon::CheckCommonArgument(std::string const& arg)
     {
     this->FindRootPathMode = RootPathModeBoth;
     }
+  else if(arg == "CMAKE_FIND_ROOT_PATH_SYSTEM_ONLY")
+    {
+    this->FindRootPathMode = RootPathModeSystemOnly;
+    }
   else
     {
     // The argument is not one of the above.
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index d48a529..07cc20c 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -32,7 +32,8 @@ protected:
 
   enum RootPathMode { RootPathModeBoth,
                       RootPathModeOnlyRootPath,
-                      RootPathModeNoRootPath };
+                      RootPathModeNoRootPath,
+                      RootPathModeSystemOnly };
 
   enum PathType { FullPath, CMakePath, EnvPath };
 
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 8bcd433..1a578a0 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1442,14 +1442,16 @@ void cmFindPackageCommand::AddPrefixesCMakeSystemVariable()
 void cmFindPackageCommand::AddPrefixesUserGuess()
 {
   // Add guesses specified by the caller.
-  this->AddPathsInternal(this->UserPaths, CMakePath, true);
+  this->AddPathsInternal(this->UserPaths, CMakePath,
+                         this->FindRootPathMode != RootPathModeSystemOnly);
 }
 
 //----------------------------------------------------------------------------
 void cmFindPackageCommand::AddPrefixesUserHints()
 {
   // Add hints specified by the caller.
-  this->AddPathsInternal(this->UserHints, CMakePath, true);
+  this->AddPathsInternal(this->UserHints, CMakePath,
+                         this->FindRootPathMode != RootPathModeSystemOnly);
 }
 
 //----------------------------------------------------------------------------

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=881f4e6c2a355b33c79cd7c62ccae1589f4f11a8
commit 881f4e6c2a355b33c79cd7c62ccae1589f4f11a8
Author:     Chuck Atkins <chuck.atkins at kitware.com>
AuthorDate: Wed Sep 3 22:48:30 2014 -0400
Commit:     Chuck Atkins <chuck.atkins at kitware.com>
CommitDate: Wed Sep 3 22:59:07 2014 -0400

    Keep a list of which search paths are re-rootable.
    
    In preperation for the new RootPathSystemOnly mode, keep an
    auxiliary list of which paths can be re-rooted and which can't.
    This involves maintaining a boolean vector that is always modified
    in sync with the search paths. Without the system-only mode, all
    paths are re-rootable.

diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index e4e819a..132c7b1 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();
 
@@ -376,51 +376,51 @@ void cmFindBase::AddCMakeSystemVariablePath()
 //----------------------------------------------------------------------------
 void cmFindBase::AddUserHintsPath()
 {
-  this->AddPathsInternal(this->UserHints, CMakePath);
+  this->AddPathsInternal(this->UserHints, CMakePath, true);
 }
 
 //----------------------------------------------------------------------------
 void cmFindBase::AddUserGuessPath()
 {
-  this->AddPathsInternal(this->UserPaths, CMakePath);
+  this->AddPathsInternal(this->UserPaths, CMakePath, true);
 }
 
 //----------------------------------------------------------------------------
 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 10241f2..412a7a7 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -125,6 +125,14 @@ void cmFindCommon::SelectDefaultMacMode()
 //----------------------------------------------------------------------------
 void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
 {
+  std::vector<bool> pathsRerootable(paths.size(), true);
+  this->RerootPaths(paths, pathsRerootable);
+}
+
+//----------------------------------------------------------------------------
+void cmFindCommon::RerootPaths(std::vector<std::string>& paths,
+                               std::vector<bool> &pathsRerootable)
+{
 #if 0
   for(std::vector<std::string>::const_iterator i = paths.begin();
       i != paths.end(); ++i)
@@ -138,12 +146,12 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
     {
     return;
     }
-  const char* sysroot =
-    this->Makefile->GetDefinition("CMAKE_SYSROOT");
   const char* rootPath =
     this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH");
-  const bool noSysroot = !sysroot || !*sysroot;
+  const char* sysroot =
+    this->Makefile->GetDefinition("CMAKE_SYSROOT");
   const bool noRootPath = !rootPath || !*rootPath;
+  const bool noSysroot = !sysroot || !*sysroot;
   if(noSysroot && noRootPath)
     {
     return;
@@ -169,37 +177,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)
-    {
-    for(std::vector<std::string>::const_iterator ui = unrootedPaths.begin();
-        ui != unrootedPaths.end(); ++ui)
+  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(cmSystemTools::IsSubDirectory(ui->c_str(), ri->c_str())
-          || (stagePrefix
-            && cmSystemTools::IsSubDirectory(ui->c_str(), stagePrefix)))
+      if(!*upri
+         || cmSystemTools::IsSubDirectory(upi->c_str(), ri->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);
       }
     }
 
@@ -208,25 +222,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;
 }
 
 
@@ -401,18 +420,18 @@ void cmFindCommon::AddEnvPath(const char* variable)
 
 //----------------------------------------------------------------------------
 void cmFindCommon::AddPathsInternal(std::vector<std::string> const& in_paths,
-                                    PathType pathType)
+                                    PathType pathType, bool reRootable)
 {
   for(std::vector<std::string>::const_iterator i = in_paths.begin();
       i != in_paths.end(); ++i)
     {
-    this->AddPathInternal(*i, pathType);
+    this->AddPathInternal(*i, pathType, reRootable);
     }
 }
 
 //----------------------------------------------------------------------------
 void cmFindCommon::AddPathInternal(std::string const& in_path,
-                                   PathType pathType)
+                                   PathType pathType, bool reRootable)
 {
   if(in_path.empty())
     {
@@ -434,25 +453,23 @@ void cmFindCommon::AddPathInternal(std::string const& in_path,
   if(this->SearchPathsEmitted.insert(fullPath).second)
     {
     this->SearchPaths.push_back(fullPath);
+    this->SearchPathsRerootable.push_back(reRootable);
     }
 }
 
 //----------------------------------------------------------------------------
 void cmFindCommon::ComputeFinalPaths()
 {
-  std::vector<std::string>& paths = this->SearchPaths;
-
   // Expand list of paths inside all search roots.
-  this->RerootPaths(paths);
+  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 = paths.begin();
-      i != paths.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 5a905cd..d48a529 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -38,14 +38,15 @@ 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,
+                   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();
@@ -66,8 +67,9 @@ protected:
   void AddCMakePath(const std::string& variable);
   void AddEnvPath(const char* variable);
   void AddPathsInternal(std::vector<std::string> const& in_paths,
-                        PathType pathType);
-  void AddPathInternal(std::string const& in_path, PathType pathType);
+                        PathType pathType, bool reRootable = true);
+  void AddPathInternal(std::string const& in_path, PathType pathType,
+                       bool reRootable = true);
 
   void SetMakefile(cmMakefile* makefile);
 
@@ -81,6 +83,7 @@ protected:
   std::vector<std::string> UserPaths;
   std::vector<std::string> UserHints;
   std::vector<std::string> SearchPaths;
+  std::vector<bool> SearchPathsRerootable;
   std::set<std::string> SearchPathsEmitted;
 
   bool SearchFrameworkFirst;
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 55a61f5..8bcd433 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)
     {
@@ -1442,14 +1442,14 @@ void cmFindPackageCommand::AddPrefixesCMakeSystemVariable()
 void cmFindPackageCommand::AddPrefixesUserGuess()
 {
   // Add guesses specified by the caller.
-  this->AddPathsInternal(this->UserPaths, CMakePath);
+  this->AddPathsInternal(this->UserPaths, CMakePath, true);
 }
 
 //----------------------------------------------------------------------------
 void cmFindPackageCommand::AddPrefixesUserHints()
 {
   // Add hints specified by the caller.
-  this->AddPathsInternal(this->UserHints, CMakePath);
+  this->AddPathsInternal(this->UserHints, CMakePath, true);
 }
 
 //----------------------------------------------------------------------------

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list