[Cmake-commits] CMake branch, next, updated. v3.2.2-2535-g057f51a

Stephen Kelly steveire at gmail.com
Tue May 5 15:51:18 EDT 2015


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  057f51af9a2dbdd015f6c69bbfe72c7a1353730a (commit)
       via  364469ce9338c1720475425f64d8328e94607880 (commit)
       via  091bf33f737f7fc8115eb4c3f066df41dbcebb44 (commit)
       via  0626c4790d8cf7ad9dc6734c7969cf843f35c458 (commit)
       via  377f6fe90606d8e62f5d9a004a2b3f9cad2f2cf2 (commit)
       via  062e4b756a2c5eec51b24b1e64ee09f1085f3420 (commit)
       via  5df60ddaa5828dd92a07174ba95df3fcee4d30f6 (commit)
       via  8db3073b3c8b7060b7496f17c2a07ec9cd76e28e (commit)
       via  ec833cedc31f2693e6f48ac71e5fda36c5cb890e (commit)
       via  d4bbbbcffc7592c990fe2c64c13eed4550fe48fa (commit)
       via  0c801c6963f051c32e0586266539f155a70bd5e3 (commit)
       via  5acbe27cf51ba34d34322bd19ac0f32b7ef193d6 (commit)
       via  ee05c3c80b3cd59f7aeb64aad492587a631d6447 (commit)
       via  f9d2545cf0853fe05e2351d80c3b580cf8b3df77 (commit)
      from  c531a8465108aa25d5f5f991c610aad0a844dad6 (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=057f51af9a2dbdd015f6c69bbfe72c7a1353730a
commit 057f51af9a2dbdd015f6c69bbfe72c7a1353730a
Merge: c531a84 364469c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue May 5 15:51:16 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue May 5 15:51:16 2015 -0400

    Merge topic 'refactor-cmLocalGenerator' into next
    
    364469ce cmState: Store computed relative paths to to current directories.
    091bf33f cmState::Snapshot: Store components for current directories.
    0626c479 cmState: Compute and store directory components.
    377f6fe9 cmGlobalGenerator: Move some flags from cmLocalGenerator.
    062e4b75 cmLocalGenerator: Port loops to cmState::Snapshot.
    5df60dda cmState: Add an accessor for Parent snapshot and a validity check.
    8db3073b cmLocalGenerator: Convert two recursive methods to loops.
    ec833ced cmLocalGenerator: Get project directories from the cmState.
    d4bbbbcf cmLocalGenerator: Initialize state before creating cmMakefile.
    0c801c69 cmLocalGenerator: Require a global generator in the constructor.
    5acbe27c Don't use a cmLocalGenerator instance to call static methods.
    ee05c3c8 cmLocalGenerator: Remove EscapeForShellOldStyle to only caller.
    f9d2545c cmLocalGenerator: Remove unused members.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=364469ce9338c1720475425f64d8328e94607880
commit 364469ce9338c1720475425f64d8328e94607880
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 4 23:30:29 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 5 21:50:43 2015 +0200

    cmState: Store computed relative paths to to current directories.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index f64cb2d..a5f603f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -66,7 +66,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
   this->UseRelativePaths = false;
   this->Configured = false;
   this->EmitUniversalBinaryFlags = true;
-  this->RelativePathsConfigured = false;
   this->BackwardsCompatibility = 0;
   this->BackwardsCompatibilityFinal = false;
 }
@@ -2812,97 +2811,6 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote,
 }
 
 //----------------------------------------------------------------------------
-std::string cmLocalGenerator::FindRelativePathTopSource()
-{
-  cmState::Snapshot snapshot = this->StateSnapshot;
-  std::vector<cmState::Snapshot> snapshots;
-  snapshots.push_back(snapshot);
-  while (true)
-    {
-    snapshot = snapshot.GetParent();
-    if (snapshot.IsValid())
-      {
-      snapshots.push_back(snapshot);
-      }
-    else
-      {
-      break;
-      }
-    }
-
-  std::string result = snapshots.front().GetCurrentSourceDirectory();
-
-  for (std::vector<cmState::Snapshot>::const_iterator it =
-       snapshots.begin() + 1; it != snapshots.end(); ++it)
-  {
-    std::string currentSource = it->GetCurrentSourceDirectory();
-    if(cmSystemTools::IsSubDirectory(result, currentSource))
-      {
-      result = currentSource;
-      }
-    }
-
-  return result;
-}
-
-//----------------------------------------------------------------------------
-std::string cmLocalGenerator::FindRelativePathTopBinary()
-{
-  cmState::Snapshot snapshot = this->StateSnapshot;
-  std::vector<cmState::Snapshot> snapshots;
-  snapshots.push_back(snapshot);
-  while (true)
-    {
-    snapshot = snapshot.GetParent();
-    if (snapshot.IsValid())
-      {
-      snapshots.push_back(snapshot);
-      }
-    else
-      {
-      break;
-      }
-    }
-
-  std::string result = snapshots.front().GetCurrentBinaryDirectory();
-
-  for (std::vector<cmState::Snapshot>::const_iterator it =
-       snapshots.begin() + 1; it != snapshots.end(); ++it)
-  {
-    std::string currentBinary = it->GetCurrentBinaryDirectory();
-    if(cmSystemTools::IsSubDirectory(result, currentBinary))
-      {
-      result = currentBinary;
-      }
-    }
-
-  return result;
-}
-
-//----------------------------------------------------------------------------
-void cmLocalGenerator::ConfigureRelativePaths()
-{
-  // Relative path conversion inside the source tree is not used to
-  // construct relative paths passed to build tools so it is safe to
-  // even when the source is a network path.
-  std::string source = this->FindRelativePathTopSource();
-  this->RelativePathTopSource = source;
-
-  // The current working directory on Windows cannot be a network
-  // path.  Therefore relative paths cannot work when the binary tree
-  // is a network path.
-  std::string binary = this->FindRelativePathTopBinary();
-  if(binary.size() < 2 || binary.substr(0, 2) != "//")
-    {
-    this->RelativePathTopBinary = binary;
-    }
-  else
-    {
-    this->RelativePathTopBinary = "";
-    }
-}
-
-//----------------------------------------------------------------------------
 static bool cmLocalGeneratorNotAbove(const char* a, const char* b)
 {
   return (cmSystemTools::ComparePath(a, b) ||
@@ -2927,26 +2835,19 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
     return in_remote;
     }
 
-  // Make sure relative path conversion is configured.
-  if(!this->RelativePathsConfigured)
-    {
-    this->ConfigureRelativePaths();
-    this->RelativePathsConfigured = true;
-    }
-
   if(!force)
     {
     // Skip conversion if the path and local are not both in the source
     // or both in the binary tree.
     std::string local_path = cmSystemTools::JoinPath(local);
     if(!((cmLocalGeneratorNotAbove(local_path.c_str(),
-                                   this->RelativePathTopBinary.c_str()) &&
+              this->StateSnapshot.GetRelativePathTopBinary()) &&
           cmLocalGeneratorNotAbove(in_remote.c_str(),
-                                   this->RelativePathTopBinary.c_str())) ||
+              this->StateSnapshot.GetRelativePathTopBinary())) ||
          (cmLocalGeneratorNotAbove(local_path.c_str(),
-                                   this->RelativePathTopSource.c_str()) &&
+              this->StateSnapshot.GetRelativePathTopSource()) &&
           cmLocalGeneratorNotAbove(in_remote.c_str(),
-                                   this->RelativePathTopSource.c_str()))))
+              this->StateSnapshot.GetRelativePathTopSource()))))
       {
       return in_remote;
       }
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index bf447e5..c0da4f6 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -435,10 +435,6 @@ protected:
                                               std::string const& dir_max);
   void ComputeObjectMaxPath();
 
-  void ConfigureRelativePaths();
-  std::string FindRelativePathTopSource();
-  std::string FindRelativePathTopBinary();
-
   virtual std::string ConvertToLinkReference(std::string const& lib,
                                              OutputFormat format = SHELL);
 
@@ -468,15 +464,6 @@ protected:
   // committed.
   std::string TargetImplib;
 
-  // The top-most directories for relative path conversion.  Both the
-  // source and destination location of a relative path conversion
-  // must be underneath one of these directories (both under source or
-  // both under binary) in order for the relative path to be evaluated
-  // safely by the build tools.
-  std::string RelativePathTopSource;
-  std::string RelativePathTopBinary;
-  bool RelativePathsConfigured;
-
   cmIML_INT_uint64_t BackwardsCompatibility;
   bool BackwardsCompatibilityFinal;
 private:
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index f11c79e..54bff7f 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -545,9 +545,11 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
   // Setup relative path conversion tops.
   infoFileStream
     << "# Relative path conversion top directories.\n"
-    << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource
+    << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \""
+    << this->StateSnapshot.GetRelativePathTopSource()
     << "\")\n"
-    << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary
+    << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \""
+    << this->StateSnapshot.GetRelativePathTopBinary()
     << "\")\n"
     << "\n";
 
@@ -1613,16 +1615,15 @@ cmLocalUnixMakefileGenerator3
       }
 
     // Setup relative path top directories.
-    this->RelativePathsConfigured = true;
     if(const char* relativePathTopSource =
        mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE"))
       {
-      this->RelativePathTopSource = relativePathTopSource;
+      this->StateSnapshot.SetRelativePathTopSource(relativePathTopSource);
       }
     if(const char* relativePathTopBinary =
        mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY"))
       {
-      this->RelativePathTopBinary = relativePathTopBinary;
+      this->StateSnapshot.SetRelativePathTopBinary(relativePathTopBinary);
       }
     }
   else
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index dacf799..04a59fc 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -494,6 +494,86 @@ std::vector<std::string> const& cmState::GetBinaryDirectoryComponents() const
   return this->BinaryDirectoryComponents;
 }
 
+void cmState::Snapshot::ComputeRelativePathTopSource()
+{
+  // Relative path conversion inside the source tree is not used to
+  // construct relative paths passed to build tools so it is safe to use
+  // even when the source is a network path.
+
+  cmState::Snapshot snapshot = *this;
+  std::vector<cmState::Snapshot> snapshots;
+  snapshots.push_back(snapshot);
+  while (true)
+    {
+    snapshot = snapshot.GetParent();
+    if (snapshot.IsValid())
+      {
+      snapshots.push_back(snapshot);
+      }
+    else
+      {
+      break;
+      }
+    }
+
+  std::string result = snapshots.front().GetCurrentSourceDirectory();
+
+  for (std::vector<cmState::Snapshot>::const_iterator it =
+       snapshots.begin() + 1; it != snapshots.end(); ++it)
+    {
+    std::string currentSource = it->GetCurrentSourceDirectory();
+    if(cmSystemTools::IsSubDirectory(result, currentSource))
+      {
+      result = currentSource;
+      }
+    }
+  this->State->RelativePathTopSource[this->Position] = result;
+}
+
+void cmState::Snapshot::ComputeRelativePathTopBinary()
+{
+  cmState::Snapshot snapshot = *this;
+  std::vector<cmState::Snapshot> snapshots;
+  snapshots.push_back(snapshot);
+  while (true)
+    {
+    snapshot = snapshot.GetParent();
+    if (snapshot.IsValid())
+      {
+      snapshots.push_back(snapshot);
+      }
+    else
+      {
+      break;
+      }
+    }
+
+  std::string result =
+      snapshots.front().GetCurrentBinaryDirectory();
+
+  for (std::vector<cmState::Snapshot>::const_iterator it =
+       snapshots.begin() + 1; it != snapshots.end(); ++it)
+    {
+    std::string currentBinary = it->GetCurrentBinaryDirectory();
+    if(cmSystemTools::IsSubDirectory(result, currentBinary))
+      {
+      result = currentBinary;
+      }
+    }
+
+  // The current working directory on Windows cannot be a network
+  // path.  Therefore relative paths cannot work when the binary tree
+  // is a network path.
+  if(result.size() < 2 || result.substr(0, 2) != "//")
+    {
+    this->State->RelativePathTopBinary[this->Position] = result;
+    }
+  else
+    {
+    this->State->RelativePathTopBinary[this->Position] = "";
+    }
+}
+
 cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot)
 {
   PositionType pos = this->ParentPositions.size();
@@ -504,6 +584,8 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot)
       this->CurrentSourceDirectoryComponents.size() + 1);
   this->CurrentBinaryDirectoryComponents.resize(
       this->CurrentBinaryDirectoryComponents.size() + 1);
+  this->RelativePathTopSource.resize(this->RelativePathTopSource.size() + 1);
+  this->RelativePathTopBinary.resize(this->RelativePathTopBinary.size() + 1);
   return cmState::Snapshot(this, pos);
 }
 
@@ -531,6 +613,7 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir)
   cmSystemTools::SplitPath(
       this->State->Locations[this->Position],
       this->State->CurrentSourceDirectoryComponents[this->Position]);
+  this->ComputeRelativePathTopSource();
 }
 
 const char* cmState::Snapshot::GetCurrentBinaryDirectory() const
@@ -551,6 +634,7 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir)
   cmSystemTools::SplitPath(
       this->State->OutputLocations[this->Position],
       this->State->CurrentBinaryDirectoryComponents[this->Position]);
+  this->ComputeRelativePathTopBinary();
 }
 
 std::vector<std::string> const&
@@ -565,6 +649,26 @@ cmState::Snapshot::GetCurrentBinaryDirectoryComponents()
   return this->State->CurrentBinaryDirectoryComponents[this->Position];
 }
 
+const char* cmState::Snapshot::GetRelativePathTopSource() const
+{
+  return this->State->RelativePathTopSource[this->Position].c_str();
+}
+
+const char* cmState::Snapshot::GetRelativePathTopBinary() const
+{
+  return this->State->RelativePathTopBinary[this->Position].c_str();
+}
+
+void cmState::Snapshot::SetRelativePathTopSource(const char* dir)
+{
+  this->State->RelativePathTopSource[this->Position] = dir;
+}
+
+void cmState::Snapshot::SetRelativePathTopBinary(const char* dir)
+{
+  this->State->RelativePathTopBinary[this->Position] = dir;
+}
+
 bool cmState::Snapshot::IsValid() const
 {
   return this->State;
diff --git a/Source/cmState.h b/Source/cmState.h
index 81f2d48..23d3f0d 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -39,10 +39,19 @@ public:
     std::vector<std::string> const& GetCurrentSourceDirectoryComponents();
     std::vector<std::string> const& GetCurrentBinaryDirectoryComponents();
 
+    const char* GetRelativePathTopSource() const;
+    const char* GetRelativePathTopBinary() const;
+    void SetRelativePathTopSource(const char* dir);
+    void SetRelativePathTopBinary(const char* dir);
+
     bool IsValid() const;
     Snapshot GetParent() const;
 
   private:
+    void ComputeRelativePathTopSource();
+    void ComputeRelativePathTopBinary();
+
+  private:
     friend class cmState;
     cmState* State;
     cmState::PositionType Position;
@@ -139,11 +148,18 @@ private:
   std::vector<std::string> OutputLocations;
   std::vector<PositionType> ParentPositions;
 
-  std::vector<std::string> SourceDirectoryComponents;
-  std::vector<std::string> BinaryDirectoryComponents;
   std::vector<std::vector<std::string> > CurrentSourceDirectoryComponents;
   std::vector<std::vector<std::string> > CurrentBinaryDirectoryComponents;
+  // The top-most directories for relative path conversion.  Both the
+  // source and destination location of a relative path conversion
+  // must be underneath one of these directories (both under source or
+  // both under binary) in order for the relative path to be evaluated
+  // safely by the build tools.
+  std::vector<std::string> RelativePathTopSource;
+  std::vector<std::string> RelativePathTopBinary;
 
+  std::vector<std::string> SourceDirectoryComponents;
+  std::vector<std::string> BinaryDirectoryComponents;
   std::string SourceDirectory;
   std::string BinaryDirectory;
   bool IsInTryCompile;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=091bf33f737f7fc8115eb4c3f066df41dbcebb44
commit 091bf33f737f7fc8115eb4c3f066df41dbcebb44
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 4 23:08:19 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 5 21:50:43 2015 +0200

    cmState::Snapshot: Store components for current directories.
    
    Remove this responsibility from cmLocalGenerator.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 0a955bb..f64cb2d 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -67,7 +67,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
   this->Configured = false;
   this->EmitUniversalBinaryFlags = true;
   this->RelativePathsConfigured = false;
-  this->PathConversionsSetup = false;
   this->BackwardsCompatibility = 0;
   this->BackwardsCompatibilityFinal = false;
 }
@@ -229,22 +228,6 @@ void cmLocalGenerator::ReadInputFile()
     }
 }
 
-void cmLocalGenerator::SetupPathConversions()
-{
-  // Setup the current output directory components for use by
-  // Convert
-  std::string outdir;
-
-  outdir = cmSystemTools::CollapseFullPath(
-      this->StateSnapshot.GetCurrentSourceDirectory());
-  cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents);
-
-  outdir = cmSystemTools::CollapseFullPath
-    (this->StateSnapshot.GetCurrentBinaryDirectory());
-  cmSystemTools::SplitPath(outdir,
-                           this->StartOutputDirectoryComponents);
-}
-
 void cmLocalGenerator::ConfigureFinalPass()
 {
   this->Makefile->ConfigureFinalPass();
@@ -2731,13 +2714,6 @@ std::string cmLocalGenerator::Convert(const std::string& source,
                                       OutputFormat output,
                                       bool optional)
 {
-  // Make sure the relative path conversion components are set.
-  if(!this->PathConversionsSetup)
-    {
-    this->SetupPathConversions();
-    this->PathConversionsSetup = true;
-    }
-
   // Convert the path to a relative path.
   std::string result = source;
 
@@ -2752,20 +2728,18 @@ std::string cmLocalGenerator::Convert(const std::string& source,
         break;
       case START:
         //result = cmSystemTools::CollapseFullPath(result.c_str());
-        result = this->ConvertToRelativePath(this->StartDirectoryComponents,
-                                             result);
+        result = this->ConvertToRelativePath(
+            this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result);
         break;
       case HOME_OUTPUT:
         //result = cmSystemTools::CollapseFullPath(result.c_str());
-        result =
-          this->ConvertToRelativePath(
-              this->GetState()->GetBinaryDirectoryComponents(), result);
+        result = this->ConvertToRelativePath(
+            this->GetState()->GetBinaryDirectoryComponents(), result);
         break;
       case START_OUTPUT:
         //result = cmSystemTools::CollapseFullPath(result.c_str());
-        result =
-          this->ConvertToRelativePath(this->StartOutputDirectoryComponents,
-                                      result);
+        result = this->ConvertToRelativePath(
+            this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result);
         break;
       case FULL:
         result = cmSystemTools::CollapseFullPath(result);
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 5cdf161..bf447e5 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -438,7 +438,6 @@ protected:
   void ConfigureRelativePaths();
   std::string FindRelativePathTopSource();
   std::string FindRelativePathTopBinary();
-  void SetupPathConversions();
 
   virtual std::string ConvertToLinkReference(std::string const& lib,
                                              OutputFormat format = SHELL);
@@ -453,8 +452,6 @@ protected:
   cmMakefile *Makefile;
   cmState::Snapshot StateSnapshot;
   cmGlobalGenerator *GlobalGenerator;
-  std::vector<std::string> StartDirectoryComponents;
-  std::vector<std::string> StartOutputDirectoryComponents;
   cmLocalGenerator* Parent;
   std::vector<cmLocalGenerator*> Children;
   std::map<std::string, std::string> UniqueObjectNamesMap;
@@ -479,7 +476,6 @@ protected:
   std::string RelativePathTopSource;
   std::string RelativePathTopBinary;
   bool RelativePathsConfigured;
-  bool PathConversionsSetup;
 
   cmIML_INT_uint64_t BackwardsCompatibility;
   bool BackwardsCompatibilityFinal;
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index c5b12d9..dacf799 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -500,6 +500,10 @@ cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot)
   this->ParentPositions.push_back(originSnapshot.Position);
   this->Locations.resize(this->Locations.size() + 1);
   this->OutputLocations.resize(this->OutputLocations.size() + 1);
+  this->CurrentSourceDirectoryComponents.resize(
+      this->CurrentSourceDirectoryComponents.size() + 1);
+  this->CurrentBinaryDirectoryComponents.resize(
+      this->CurrentBinaryDirectoryComponents.size() + 1);
   return cmState::Snapshot(this, pos);
 }
 
@@ -523,6 +527,10 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir)
       this->State->Locations[this->Position]);
   this->State->Locations[this->Position] =
     cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]);
+
+  cmSystemTools::SplitPath(
+      this->State->Locations[this->Position],
+      this->State->CurrentSourceDirectoryComponents[this->Position]);
 }
 
 const char* cmState::Snapshot::GetCurrentBinaryDirectory() const
@@ -539,6 +547,22 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir)
   this->State->OutputLocations[this->Position] =
     cmSystemTools::CollapseFullPath(
         this->State->OutputLocations[this->Position]);
+
+  cmSystemTools::SplitPath(
+      this->State->OutputLocations[this->Position],
+      this->State->CurrentBinaryDirectoryComponents[this->Position]);
+}
+
+std::vector<std::string> const&
+cmState::Snapshot::GetCurrentSourceDirectoryComponents()
+{
+  return this->State->CurrentSourceDirectoryComponents[this->Position];
+}
+
+std::vector<std::string> const&
+cmState::Snapshot::GetCurrentBinaryDirectoryComponents()
+{
+  return this->State->CurrentBinaryDirectoryComponents[this->Position];
 }
 
 bool cmState::Snapshot::IsValid() const
diff --git a/Source/cmState.h b/Source/cmState.h
index c58a461..81f2d48 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -36,6 +36,9 @@ public:
     const char* GetCurrentBinaryDirectory() const;
     void SetCurrentBinaryDirectory(std::string const& dir);
 
+    std::vector<std::string> const& GetCurrentSourceDirectoryComponents();
+    std::vector<std::string> const& GetCurrentBinaryDirectoryComponents();
+
     bool IsValid() const;
     Snapshot GetParent() const;
 
@@ -138,6 +141,8 @@ private:
 
   std::vector<std::string> SourceDirectoryComponents;
   std::vector<std::string> BinaryDirectoryComponents;
+  std::vector<std::vector<std::string> > CurrentSourceDirectoryComponents;
+  std::vector<std::vector<std::string> > CurrentBinaryDirectoryComponents;
 
   std::string SourceDirectory;
   std::string BinaryDirectory;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0626c4790d8cf7ad9dc6734c7969cf843f35c458
commit 0626c4790d8cf7ad9dc6734c7969cf843f35c458
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 4 23:01:29 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 5 21:50:43 2015 +0200

    cmState: Compute and store directory components.
    
    There is no need to duplicate these in all cmLocalGenerators.
    
    Rename the symbols according to current conventions.
    
    Add explicit calls to Set{Source,Binary}Directory with empty strings
    in order to trigger the population of the components containers with
    the current working directory in cmLocalGenerator.  Having
    directories set to empty is a special case in CMake, which is relied
    on for the `if(CMAKE_BINARY_DIR)` condition at the end of
    CMakeDetermineSystem.cmake.

diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 2207873..d08b5de 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -198,6 +198,8 @@ int main (int argc, char const* const* argv)
     "Read CPack config file: " << cpackConfigFile << std::endl);
 
   cmake cminst;
+  cminst.SetHomeDirectory("");
+  cminst.SetHomeOutputDirectory("");
   cminst.GetState()->RemoveUnscriptableCommands();
   cmGlobalGenerator cmgg;
   cmgg.SetCMakeInstance(&cminst);
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 0a34be8..322855a 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -336,6 +336,8 @@ void cmCTestScriptHandler::CreateCMake()
     delete this->LocalGenerator;
     }
   this->CMake = new cmake;
+  this->CMake->SetHomeDirectory("");
+  this->CMake->SetHomeOutputDirectory("");
   this->CMake->AddCMakePaths();
   this->GlobalGenerator = new cmGlobalGenerator;
   this->GlobalGenerator->SetCMakeInstance(this->CMake);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index bd6af8c..0a955bb 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -234,19 +234,12 @@ void cmLocalGenerator::SetupPathConversions()
   // Setup the current output directory components for use by
   // Convert
   std::string outdir;
-  outdir =
-    cmSystemTools::CollapseFullPath(this->GetState()->GetSourceDirectory());
-  cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents);
+
   outdir = cmSystemTools::CollapseFullPath(
       this->StateSnapshot.GetCurrentSourceDirectory());
   cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents);
 
   outdir = cmSystemTools::CollapseFullPath
-    (this->GetState()->GetBinaryDirectory());
-  cmSystemTools::SplitPath(outdir,
-                           this->HomeOutputDirectoryComponents);
-
-  outdir = cmSystemTools::CollapseFullPath
     (this->StateSnapshot.GetCurrentBinaryDirectory());
   cmSystemTools::SplitPath(outdir,
                            this->StartOutputDirectoryComponents);
@@ -2754,8 +2747,8 @@ std::string cmLocalGenerator::Convert(const std::string& source,
       {
       case HOME:
         //result = cmSystemTools::CollapseFullPath(result.c_str());
-        result = this->ConvertToRelativePath(this->HomeDirectoryComponents,
-                                             result);
+        result = this->ConvertToRelativePath(
+            this->GetState()->GetSourceDirectoryComponents(), result);
         break;
       case START:
         //result = cmSystemTools::CollapseFullPath(result.c_str());
@@ -2765,8 +2758,8 @@ std::string cmLocalGenerator::Convert(const std::string& source,
       case HOME_OUTPUT:
         //result = cmSystemTools::CollapseFullPath(result.c_str());
         result =
-          this->ConvertToRelativePath(this->HomeOutputDirectoryComponents,
-                                      result);
+          this->ConvertToRelativePath(
+              this->GetState()->GetBinaryDirectoryComponents(), result);
         break;
       case START_OUTPUT:
         //result = cmSystemTools::CollapseFullPath(result.c_str());
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 47c0877..5cdf161 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -453,9 +453,7 @@ protected:
   cmMakefile *Makefile;
   cmState::Snapshot StateSnapshot;
   cmGlobalGenerator *GlobalGenerator;
-  std::vector<std::string> HomeDirectoryComponents;
   std::vector<std::string> StartDirectoryComponents;
-  std::vector<std::string> HomeOutputDirectoryComponents;
   std::vector<std::string> StartOutputDirectoryComponents;
   cmLocalGenerator* Parent;
   std::vector<cmLocalGenerator*> Children;
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 3cca3a7..c5b12d9 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -458,6 +458,10 @@ void cmState::SetSourceDirectory(std::string const& sourceDirectory)
 {
   this->SourceDirectory = sourceDirectory;
   cmSystemTools::ConvertToUnixSlashes(this->SourceDirectory);
+
+  cmSystemTools::SplitPath(
+      cmSystemTools::CollapseFullPath(this->SourceDirectory),
+        this->SourceDirectoryComponents);
 }
 
 const char* cmState::GetSourceDirectory() const
@@ -465,10 +469,19 @@ const char* cmState::GetSourceDirectory() const
   return this->SourceDirectory.c_str();
 }
 
+std::vector<std::string> const& cmState::GetSourceDirectoryComponents() const
+{
+  return this->SourceDirectoryComponents;
+}
+
 void cmState::SetBinaryDirectory(std::string const& binaryDirectory)
 {
   this->BinaryDirectory = binaryDirectory;
   cmSystemTools::ConvertToUnixSlashes(this->BinaryDirectory);
+
+  cmSystemTools::SplitPath(
+      cmSystemTools::CollapseFullPath(this->BinaryDirectory),
+        this->BinaryDirectoryComponents);
 }
 
 const char* cmState::GetBinaryDirectory() const
@@ -476,6 +489,11 @@ const char* cmState::GetBinaryDirectory() const
   return this->BinaryDirectory.c_str();
 }
 
+std::vector<std::string> const& cmState::GetBinaryDirectoryComponents() const
+{
+  return this->BinaryDirectoryComponents;
+}
+
 cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot)
 {
   PositionType pos = this->ParentPositions.size();
diff --git a/Source/cmState.h b/Source/cmState.h
index ed58c64..c58a461 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -123,6 +123,9 @@ public:
   const char* GetBinaryDirectory() const;
   void SetBinaryDirectory(std::string const& binaryDirectory);
 
+  std::vector<std::string> const& GetSourceDirectoryComponents() const;
+  std::vector<std::string> const& GetBinaryDirectoryComponents() const;
+
 private:
   std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions;
   std::vector<std::string> EnabledLanguages;
@@ -132,6 +135,10 @@ private:
   std::vector<std::string> Locations;
   std::vector<std::string> OutputLocations;
   std::vector<PositionType> ParentPositions;
+
+  std::vector<std::string> SourceDirectoryComponents;
+  std::vector<std::string> BinaryDirectoryComponents;
+
   std::string SourceDirectory;
   std::string BinaryDirectory;
   bool IsInTryCompile;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 5c5c428..2f9789d 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2580,6 +2580,9 @@ int cmake::Build(const std::string& dir,
                  const std::vector<std::string>& nativeOptions,
                  bool clean)
 {
+
+  this->SetHomeDirectory("");
+  this->SetHomeOutputDirectory("");
   if(!cmSystemTools::FileIsDirectory(dir))
     {
     std::cerr << "Error: " << dir << " is not a directory\n";

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=377f6fe90606d8e62f5d9a004a2b3f9cad2f2cf2
commit 377f6fe90606d8e62f5d9a004a2b3f9cad2f2cf2
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 4 22:40:11 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 5 21:50:43 2015 +0200

    cmGlobalGenerator: Move some flags from cmLocalGenerator.
    
    These flags are global, and so they belong here instead of being
    set on each local generator.

diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 0220799..d191056 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -21,6 +21,7 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator()
   this->ForceUnixPaths = false;
   this->ToolSupportsColor = true;
   this->UseLinkScript = false;
+  this->WindowsShell = true;
 }
 
 
@@ -43,7 +44,6 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator(
   cmLocalUnixMakefileGenerator3* lg =
       new cmLocalUnixMakefileGenerator3(this, parent);
   lg->SetIncludeDirective("!include");
-  lg->SetWindowsShell(true);
   lg->SetDefineWindowsNULL(true);
   lg->SetMakefileVariableSize(32);
   lg->SetPassMakeflags(true);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 7117402..fe73e8c 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -71,6 +71,13 @@ cmGlobalGenerator::cmGlobalGenerator()
   this->ExtraGenerator = 0;
   this->CurrentLocalGenerator = 0;
   this->TryCompileOuterMakefile = 0;
+
+  this->WindowsShell = false;
+  this->WindowsVSIDE = false;
+  this->WatcomWMake = false;
+  this->MinGWMake = false;
+  this->NMake = false;
+  this->MSYSShell = false;
 }
 
 cmGlobalGenerator::~cmGlobalGenerator()
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 7107198..3b321f2 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -354,6 +354,13 @@ public:
   cmFileLockPool& GetFileLockPool() { return FileLockPool; }
 #endif
 
+  bool WindowsShell;
+  bool WindowsVSIDE;
+  bool WatcomWMake;
+  bool MinGWMake;
+  bool NMake;
+  bool MSYSShell;
+
 protected:
   virtual void Generate();
 
diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx
index 1caa730..f1f7984 100644
--- a/Source/cmGlobalJOMMakefileGenerator.cxx
+++ b/Source/cmGlobalJOMMakefileGenerator.cxx
@@ -19,6 +19,7 @@ cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator()
   this->ForceUnixPaths = false;
   this->ToolSupportsColor = true;
   this->UseLinkScript = false;
+  this->WindowsShell = true;
 }
 
 void cmGlobalJOMMakefileGenerator
@@ -51,7 +52,6 @@ cmGlobalJOMMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
   cmLocalUnixMakefileGenerator3* lg
       = new cmLocalUnixMakefileGenerator3(this, parent);
   lg->SetDefineWindowsNULL(true);
-  lg->SetWindowsShell(true);
   lg->SetMakeSilentFlag("/nologo");
   lg->SetIgnoreLibPrefix(true);
   lg->SetPassMakeflags(true);
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index 319eeaf..9f9e888 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -21,6 +21,7 @@ cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator()
   this->ForceUnixPaths = true;
   this->ToolSupportsColor = true;
   this->UseLinkScript = false;
+  this->SetMSYSShell = true;
 }
 
 std::string
@@ -98,8 +99,6 @@ cmGlobalMSYSMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg =
       new cmLocalUnixMakefileGenerator3(this, parent);
-  lg->SetWindowsShell(false);
-  lg->SetMSYSShell(true);
   lg->SetIgnoreLibPrefix(true);
   lg->SetPassMakeflags(false);
   lg->SetUnixCD(true);
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index c4511e5..ba0790d 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -19,6 +19,8 @@ cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator()
   this->ForceUnixPaths = true;
   this->ToolSupportsColor = true;
   this->UseLinkScript = true;
+  this->WindowsShell = true;
+  this->MinGWMake = true;
 }
 
 void cmGlobalMinGWMakefileGenerator
@@ -36,11 +38,9 @@ cmGlobalMinGWMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg =
       new cmLocalUnixMakefileGenerator3(this, parent);
-  lg->SetWindowsShell(true);
   lg->SetIgnoreLibPrefix(true);
   lg->SetPassMakeflags(false);
   lg->SetUnixCD(true);
-  lg->SetMinGWMake(true);
   return lg;
 }
 
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index 2732e22..98d7fb4 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -19,6 +19,8 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator()
   this->ForceUnixPaths = false;
   this->ToolSupportsColor = true;
   this->UseLinkScript = false;
+  this->WindowsShell = true;
+  this->NMake = true;
 }
 
 void cmGlobalNMakeMakefileGenerator
@@ -51,11 +53,9 @@ cmGlobalNMakeMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
   cmLocalUnixMakefileGenerator3* lg =
       new cmLocalUnixMakefileGenerator3(this, parent);
   lg->SetDefineWindowsNULL(true);
-  lg->SetWindowsShell(true);
   lg->SetMakeSilentFlag("/nologo");
   lg->SetIgnoreLibPrefix(true);
   lg->SetPassMakeflags(true);
-  lg->SetNMake(true);
   lg->SetUnixCD(false);
   return lg;
 }
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index dde9ca4..7a26cc0 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -487,6 +487,9 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
   , ComputingUnknownDependencies(false)
   , PolicyCMP0058(cmPolicies::WARN)
 {
+#ifdef _WIN32
+  this->WindowsShell = true;
+#endif
   // // Ninja is not ported to non-Unix OS yet.
   // this->ForceUnixPaths = true;
   this->FindMakeProgramFile = "CMakeNinjaFindMake.cmake";
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 60d545b..b74ba6f 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -23,6 +23,8 @@
 //----------------------------------------------------------------------------
 cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator()
 {
+  this->WindowsShell = true;
+  this->WindowsVSIDE = true;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 49c516f..181178f 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -22,6 +22,10 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator()
   this->ToolSupportsColor = true;
   this->NeedSymbolicMark = true;
   this->EmptyRuleHackCommand = "@cd .";
+#ifdef _WIN32
+  this->WindowsShell = true;
+#endif
+  this->WatcomWMake = true;
 }
 
 void cmGlobalWatcomWMakeGenerator
@@ -47,10 +51,6 @@ cmGlobalWatcomWMakeGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
   cmLocalUnixMakefileGenerator3* lg
       = new cmLocalUnixMakefileGenerator3(this, parent);
   lg->SetDefineWindowsNULL(true);
-#ifdef _WIN32
-  lg->SetWindowsShell(true);
-#endif
-  lg->SetWatcomWMake(true);
   lg->SetMakeSilentFlag("-h");
   lg->SetIgnoreLibPrefix(true);
   lg->SetPassMakeflags(false);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 5ef0a3b..bd6af8c 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -61,12 +61,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
     }
   this->Makefile = new cmMakefile(this);
 
-  this->WindowsShell = false;
-  this->WindowsVSIDE = false;
-  this->WatcomWMake = false;
-  this->MinGWMake = false;
-  this->NMake = false;
-  this->MSYSShell = false;
   this->LinkScriptShell = false;
   this->IgnoreLibPrefix = false;
   this->UseRelativePaths = false;
@@ -1254,7 +1248,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote,
   // If this is a windows shell, the result has a space, and the path
   // already exists, we can use a short-path to reference it without a
   // space.
-  if(this->WindowsShell && result.find(' ') != result.npos &&
+  if(this->GlobalGenerator->WindowsShell && result.find(' ') != result.npos &&
      cmSystemTools::FileExists(remote.c_str()))
     {
     std::string tmp;
@@ -2626,7 +2620,7 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
     {
     // Append the definition with proper escaping.
     std::string def = dflag;
-    if(this->WatcomWMake)
+    if(this->GlobalGenerator->WatcomWMake)
       {
       // The Watcom compiler does its own command line parsing instead
       // of using the windows shell rules.  Definitions are one of
@@ -2805,7 +2799,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
         // For the MSYS shell convert drive letters to posix paths, so
     // that c:/some/path becomes /c/some/path.  This is needed to
     // avoid problems with the shell path translation.
-    if(this->MSYSShell && !this->LinkScriptShell)
+    if(this->GlobalGenerator->MSYSShell && !this->LinkScriptShell)
       {
       if(result.size() > 2 && result[1] == ':')
         {
@@ -2813,7 +2807,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
         result[0] = '/';
         }
       }
-    if(this->WindowsShell)
+    if(this->GlobalGenerator->WindowsShell)
       {
       std::replace(result.begin(), result.end(), '/', '\\');
       }
@@ -3324,6 +3318,26 @@ void cmLocalGenerator::ComputeObjectFilenames(
 
 }
 
+bool cmLocalGenerator::IsWindowsShell() const
+{
+  return this->GlobalGenerator->WindowsShell;
+}
+
+bool cmLocalGenerator::IsWatcomWMake() const
+{
+  return this->GlobalGenerator->WatcomWMake;
+}
+
+bool cmLocalGenerator::IsMinGWMake() const
+{
+  return this->GlobalGenerator->MinGWMake;
+}
+
+bool cmLocalGenerator::IsNMake() const
+{
+  return this->GlobalGenerator->NMake;
+}
+
 //----------------------------------------------------------------------------
 std::string
 cmLocalGenerator
@@ -3467,7 +3481,7 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str,
 
   // Compute the flags for the target shell environment.
   int flags = 0;
-  if(this->WindowsVSIDE)
+  if(this->GlobalGenerator->WindowsVSIDE)
     {
     flags |= cmsysSystem_Shell_Flag_VSIDE;
     }
@@ -3487,27 +3501,27 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str,
     {
     flags |= cmsysSystem_Shell_Flag_WatcomQuote;
     }
-  if(this->WatcomWMake)
+  if(this->GlobalGenerator->WatcomWMake)
     {
     flags |= cmsysSystem_Shell_Flag_WatcomWMake;
     }
-  if(this->MinGWMake)
+  if(this->GlobalGenerator->MinGWMake)
     {
     flags |= cmsysSystem_Shell_Flag_MinGWMake;
     }
-  if(this->NMake)
+  if(this->GlobalGenerator->NMake)
     {
     flags |= cmsysSystem_Shell_Flag_NMake;
     }
 
   // Compute the buffer size needed.
-  int size = (this->WindowsShell ?
+  int size = (this->GlobalGenerator->WindowsShell ?
               cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) :
               cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags));
 
   // Compute the shell argument itself.
   std::vector<char> arg(size);
-  if(this->WindowsShell)
+  if(this->GlobalGenerator->WindowsShell)
     {
     cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags);
     }
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 100d27b..47c0877 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -383,6 +383,11 @@ public:
                         std::map<cmSourceFile const*, std::string>& mapping,
                         cmGeneratorTarget const* gt = 0);
 
+  bool IsWindowsShell() const;
+  bool IsWatcomWMake() const;
+  bool IsMinGWMake() const;
+  bool IsNMake() const;
+
 protected:
   ///! put all the libraries for a target on into the given stream
   virtual void OutputLinkLibraries(std::string& linkLibraries,
@@ -457,17 +462,13 @@ protected:
   std::map<std::string, std::string> UniqueObjectNamesMap;
   std::string::size_type ObjectPathMax;
   std::set<std::string> ObjectMaxPathViolations;
-  bool WindowsShell;
-  bool WindowsVSIDE;
-  bool WatcomWMake;
-  bool MinGWMake;
-  bool NMake;
-  bool MSYSShell;
+
   bool LinkScriptShell;
   bool UseRelativePaths;
   bool IgnoreLibPrefix;
   bool Configured;
   bool EmitUniversalBinaryFlags;
+
   // Hack for ExpandRuleVariable until object-oriented version is
   // committed.
   std::string TargetImplib;
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index ac10f09..ded4c25 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -28,9 +28,6 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
   , ConfigName("")
   , HomeRelativeOutputPath("")
 {
-#ifdef _WIN32
-  this->WindowsShell = true;
-#endif
   this->TargetImplib = "$TARGET_IMPLIB";
 }
 
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index a2a3725..f11c79e 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -83,7 +83,6 @@ cmLocalUnixMakefileGenerator3::
 cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent)
   : cmLocalGenerator(gg, parent)
 {
-  this->WindowsShell = false;
   this->IncludeDirective = "include";
   this->MakefileVariableSize = 0;
   this->IgnoreLibPrefix = false;
@@ -679,7 +678,7 @@ cmLocalUnixMakefileGenerator3
 
   // Write the list of commands.
   os << cmWrap("\t", commands, "", "\n") << "\n";
-  if(symbolic && !this->WatcomWMake)
+  if(symbolic && !this->IsWatcomWMake())
     {
     os << ".PHONY : " << cmMakeSafe(tgt) << "\n";
     }
@@ -696,7 +695,7 @@ std::string
 cmLocalUnixMakefileGenerator3
 ::ConvertShellCommand(std::string const& cmd, RelativeRoot root)
 {
-  if(this->WatcomWMake &&
+  if(this->IsWatcomWMake() &&
      cmSystemTools::FileIsFullPath(cmd.c_str()) &&
      cmd.find_first_of("( )") != cmd.npos)
     {
@@ -730,7 +729,7 @@ cmLocalUnixMakefileGenerator3
       << "NULL=nul\n"
       << "!ENDIF\n";
     }
-  if(this->WindowsShell)
+  if(this->IsWindowsShell())
     {
      makefileStream
        << "SHELL = cmd.exe\n"
@@ -798,7 +797,8 @@ cmLocalUnixMakefileGenerator3
     makefileStream, "Disable implicit rules so canonical targets will work.",
     ".SUFFIXES", no_depends, no_commands, false);
 
-  if(!this->NMake && !this->WatcomWMake && !this->BorlandMakeCurlyHack)
+  if(!this->IsNMake()
+      && !this->IsWatcomWMake() && !this->BorlandMakeCurlyHack)
     {
     // turn off RCS and SCCS automatic stuff from gmake
     makefileStream
@@ -810,7 +810,7 @@ cmLocalUnixMakefileGenerator3
   depends.push_back(".hpux_make_needs_suffix_list");
   this->WriteMakeRule(makefileStream, 0,
                       ".SUFFIXES", depends, no_commands, false);
-  if(this->WatcomWMake)
+  if(this->IsWatcomWMake())
     {
     // Switch on WMake feature, if an error or interrupt occurs during
     // makefile processing, the current target being made may be deleted
@@ -828,7 +828,7 @@ cmLocalUnixMakefileGenerator3
       << "VERBOSE = 1\n"
       << "\n";
     }
-  if(this->WatcomWMake)
+  if(this->IsWatcomWMake())
     {
     makefileStream <<
       "!ifndef VERBOSE\n"
@@ -962,7 +962,7 @@ cmLocalUnixMakefileGenerator3
 void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
                                                 const std::string& newFlags)
 {
-  if(this->WatcomWMake && !newFlags.empty())
+  if(this->IsWatcomWMake() && !newFlags.empty())
     {
     std::string newf = newFlags;
     if(newf.find("\\\"") != newf.npos)
@@ -1112,7 +1112,7 @@ cmLocalUnixMakefileGenerator3
       //
       bool useCall = false;
 
-      if (this->WindowsShell)
+      if (this->IsWindowsShell())
         {
         std::string suffix;
         if (cmd.size() > 4)
@@ -1179,7 +1179,7 @@ cmLocalUnixMakefileGenerator3
           {
           cmd = "call " + cmd;
           }
-        else if (this->NMake && cmd[0]=='"')
+        else if (this->IsNMake() && cmd[0]=='"')
           {
           cmd = "echo >nul && " + cmd;
           }
@@ -2344,7 +2344,7 @@ void cmLocalUnixMakefileGenerator3
   // used by NMake and Borland make does not support "cd /d" so this
   // feature simply cannot work with them (Borland make does not even
   // support changing the drive letter with just "d:").
-  const char* cd_cmd = this->MinGWMake? "cd /d " : "cd ";
+  const char* cd_cmd = this->IsMinGWMake() ? "cd /d " : "cd ";
 
   if(!this->UnixCD)
     {
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 4e48ad7..7b436a5 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -81,36 +81,6 @@ public:
   std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; }
 
   /**
-   * Set to true if the shell being used is the windows shell.
-   * This controls if statements in the makefile and the SHELL variable.
-   * The default is false.
-   */
-  void SetWindowsShell(bool v)  {this->WindowsShell = v;}
-
-  /**
-   * Set to true if the make tool being used is Watcom WMake.
-   */
-  void SetWatcomWMake(bool v)  {this->WatcomWMake = v;}
-
-  /**
-   * Set to true if the make tool being used is MinGW Make.
-   */
-  void SetMinGWMake(bool v)  {this->MinGWMake = v;}
-  bool IsMinGWMake() const { return this->MinGWMake; }
-
-  /**
-   * Set to true if the make tool being used is NMake.
-   */
-  void SetNMake(bool v)  {this->NMake = v;}
-
-  /**
-   * Set to true if the shell being used is the MSYS shell.
-   * This controls if statements in the makefile and the SHELL variable.
-   * The default is false.
-   */
-  void SetMSYSShell(bool v)  {this->MSYSShell = v;}
-
-  /**
    * If set to true, then NULL is set to nil for non Windows_NT.
    * This uses make syntax used by nmake and borland.
    * The default is false.
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index f95d09b..4a596d5 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -23,8 +23,6 @@ cmLocalVisualStudioGenerator
                                cmLocalGenerator* parent)
   : cmLocalGenerator(gg, parent)
 {
-  this->WindowsShell = true;
-  this->WindowsVSIDE = true;
   this->Version = v;
 }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=062e4b756a2c5eec51b24b1e64ee09f1085f3420
commit 062e4b756a2c5eec51b24b1e64ee09f1085f3420
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 4 22:40:07 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 5 21:50:43 2015 +0200

    cmLocalGenerator: Port loops to cmState::Snapshot.
    
    Make this code less dependent on being part of cmLocalGenerator,
    where it doesn't really belong.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 1099f0f..5ef0a3b 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2853,15 +2853,15 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote,
 //----------------------------------------------------------------------------
 std::string cmLocalGenerator::FindRelativePathTopSource()
 {
-  cmLocalGenerator* gen = this;
-  std::vector<cmLocalGenerator*> gens;
-  gens.push_back(gen);
+  cmState::Snapshot snapshot = this->StateSnapshot;
+  std::vector<cmState::Snapshot> snapshots;
+  snapshots.push_back(snapshot);
   while (true)
     {
-    gen = gen->GetParent();
-    if (gen)
+    snapshot = snapshot.GetParent();
+    if (snapshot.IsValid())
       {
-      gens.push_back(gen);
+      snapshots.push_back(snapshot);
       }
     else
       {
@@ -2869,13 +2869,12 @@ std::string cmLocalGenerator::FindRelativePathTopSource()
       }
     }
 
-  std::string result = gens.front()->StateSnapshot.GetCurrentSourceDirectory();
+  std::string result = snapshots.front().GetCurrentSourceDirectory();
 
-  for (std::vector<cmLocalGenerator*>::const_iterator it = gens.begin() + 1;
-       it != gens.end(); ++it)
+  for (std::vector<cmState::Snapshot>::const_iterator it =
+       snapshots.begin() + 1; it != snapshots.end(); ++it)
   {
-    std::string currentSource =
-        (*it)->StateSnapshot.GetCurrentSourceDirectory();
+    std::string currentSource = it->GetCurrentSourceDirectory();
     if(cmSystemTools::IsSubDirectory(result, currentSource))
       {
       result = currentSource;
@@ -2888,15 +2887,15 @@ std::string cmLocalGenerator::FindRelativePathTopSource()
 //----------------------------------------------------------------------------
 std::string cmLocalGenerator::FindRelativePathTopBinary()
 {
-  cmLocalGenerator* gen = this;
-  std::vector<cmLocalGenerator*> gens;
-  gens.push_back(gen);
+  cmState::Snapshot snapshot = this->StateSnapshot;
+  std::vector<cmState::Snapshot> snapshots;
+  snapshots.push_back(snapshot);
   while (true)
     {
-    gen = gen->GetParent();
-    if (gen)
+    snapshot = snapshot.GetParent();
+    if (snapshot.IsValid())
       {
-      gens.push_back(gen);
+      snapshots.push_back(snapshot);
       }
     else
       {
@@ -2904,13 +2903,12 @@ std::string cmLocalGenerator::FindRelativePathTopBinary()
       }
     }
 
-  std::string result = gens.front()->StateSnapshot.GetCurrentBinaryDirectory();
+  std::string result = snapshots.front().GetCurrentBinaryDirectory();
 
-  for (std::vector<cmLocalGenerator*>::const_iterator it = gens.begin() + 1;
-       it != gens.end(); ++it)
+  for (std::vector<cmState::Snapshot>::const_iterator it =
+       snapshots.begin() + 1; it != snapshots.end(); ++it)
   {
-    std::string currentBinary =
-        (*it)->StateSnapshot.GetCurrentBinaryDirectory();
+    std::string currentBinary = it->GetCurrentBinaryDirectory();
     if(cmSystemTools::IsSubDirectory(result, currentBinary))
       {
       result = currentBinary;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5df60ddaa5828dd92a07174ba95df3fcee4d30f6
commit 5df60ddaa5828dd92a07174ba95df3fcee4d30f6
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 4 22:38:37 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 5 21:50:42 2015 +0200

    cmState: Add an accessor for Parent snapshot and a validity check.

diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 67a2274..3cca3a7 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -522,3 +522,24 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir)
     cmSystemTools::CollapseFullPath(
         this->State->OutputLocations[this->Position]);
 }
+
+bool cmState::Snapshot::IsValid() const
+{
+  return this->State;
+}
+
+cmState::Snapshot cmState::Snapshot::GetParent() const
+{
+  Snapshot snapshot;
+  if (!this->State)
+    {
+    return snapshot;
+    }
+  PositionType parentPos = this->State->ParentPositions[this->Position];
+  if (parentPos > 0)
+    {
+    snapshot = Snapshot(this->State, parentPos);
+    }
+
+  return snapshot;
+}
diff --git a/Source/cmState.h b/Source/cmState.h
index d10fae3..ed58c64 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -36,6 +36,9 @@ public:
     const char* GetCurrentBinaryDirectory() const;
     void SetCurrentBinaryDirectory(std::string const& dir);
 
+    bool IsValid() const;
+    Snapshot GetParent() const;
+
   private:
     friend class cmState;
     cmState* State;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8db3073b3c8b7060b7496f17c2a07ec9cd76e28e
commit 8db3073b3c8b7060b7496f17c2a07ec9cd76e28e
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 4 22:38:52 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 5 21:50:42 2015 +0200

    cmLocalGenerator: Convert two recursive methods to loops.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index f3ad60a..1099f0f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2853,41 +2853,71 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote,
 //----------------------------------------------------------------------------
 std::string cmLocalGenerator::FindRelativePathTopSource()
 {
-  // Relative path conversion within a single tree managed by CMake is
-  // safe.  We can use our parent relative path top if and only if
-  // this is a subdirectory of that top.
-  if(cmLocalGenerator* parent = this->GetParent())
+  cmLocalGenerator* gen = this;
+  std::vector<cmLocalGenerator*> gens;
+  gens.push_back(gen);
+  while (true)
     {
-    std::string parentTop = parent->FindRelativePathTopSource();
-    if(cmSystemTools::IsSubDirectory(
-         this->StateSnapshot.GetCurrentSourceDirectory(), parentTop))
+    gen = gen->GetParent();
+    if (gen)
       {
-      return parentTop;
+      gens.push_back(gen);
+      }
+    else
+      {
+      break;
+      }
+    }
+
+  std::string result = gens.front()->StateSnapshot.GetCurrentSourceDirectory();
+
+  for (std::vector<cmLocalGenerator*>::const_iterator it = gens.begin() + 1;
+       it != gens.end(); ++it)
+  {
+    std::string currentSource =
+        (*it)->StateSnapshot.GetCurrentSourceDirectory();
+    if(cmSystemTools::IsSubDirectory(result, currentSource))
+      {
+      result = currentSource;
       }
     }
 
-  // Otherwise this directory itself is the new top.
-  return this->StateSnapshot.GetCurrentSourceDirectory();
+  return result;
 }
 
 //----------------------------------------------------------------------------
 std::string cmLocalGenerator::FindRelativePathTopBinary()
 {
-  // Relative path conversion within a single tree managed by CMake is
-  // safe.  We can use our parent relative path top if and only if
-  // this is a subdirectory of that top.
-  if(cmLocalGenerator* parent = this->GetParent())
+  cmLocalGenerator* gen = this;
+  std::vector<cmLocalGenerator*> gens;
+  gens.push_back(gen);
+  while (true)
     {
-    std::string parentTop = parent->FindRelativePathTopBinary();
-    if(cmSystemTools::IsSubDirectory(
-         this->StateSnapshot.GetCurrentBinaryDirectory(), parentTop))
+    gen = gen->GetParent();
+    if (gen)
       {
-      return parentTop;
+      gens.push_back(gen);
+      }
+    else
+      {
+      break;
+      }
+    }
+
+  std::string result = gens.front()->StateSnapshot.GetCurrentBinaryDirectory();
+
+  for (std::vector<cmLocalGenerator*>::const_iterator it = gens.begin() + 1;
+       it != gens.end(); ++it)
+  {
+    std::string currentBinary =
+        (*it)->StateSnapshot.GetCurrentBinaryDirectory();
+    if(cmSystemTools::IsSubDirectory(result, currentBinary))
+      {
+      result = currentBinary;
       }
     }
 
-  // Otherwise this directory itself is the new top.
-  return this->StateSnapshot.GetCurrentBinaryDirectory();
+  return result;
 }
 
 //----------------------------------------------------------------------------

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ec833cedc31f2693e6f48ac71e5fda36c5cb890e
commit ec833cedc31f2693e6f48ac71e5fda36c5cb890e
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 17:19:16 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 5 21:50:42 2015 +0200

    cmLocalGenerator: Get project directories from the cmState.
    
    Make this class and cmMakefile less interdependent.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c099a4d..f3ad60a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -115,7 +115,7 @@ void cmLocalGenerator::Configure()
   static_cast<void>(clg);
 
   // make sure the CMakeFiles dir is there
-  std::string filesDir = this->Makefile->GetCurrentBinaryDirectory();
+  std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory();
   filesDir += cmake::GetCMakeFilesDirectory();
   cmSystemTools::MakeDirectory(filesDir.c_str());
 
@@ -191,7 +191,7 @@ void cmLocalGenerator::ComputeObjectMaxPath()
 void cmLocalGenerator::ReadInputFile()
 {
   // Look for the CMakeLists.txt file.
-  std::string currentStart = this->Makefile->GetCurrentSourceDirectory();
+  std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory();
   currentStart += "/CMakeLists.txt";
   if(cmSystemTools::FileExists(currentStart.c_str(), true))
     {
@@ -208,7 +208,7 @@ void cmLocalGenerator::ReadInputFile()
   cmMakefile* mf = this->Parent->GetMakefile();
   std::ostringstream e;
   e << "The source directory\n"
-    << "  " << this->Makefile->GetCurrentSourceDirectory() << "\n"
+    << "  " << this->StateSnapshot.GetCurrentSourceDirectory() << "\n"
     << "does not contain a CMakeLists.txt file.";
   switch (mf->GetPolicyStatus(cmPolicies::CMP0014))
     {
@@ -241,20 +241,19 @@ void cmLocalGenerator::SetupPathConversions()
   // Convert
   std::string outdir;
   outdir =
-    cmSystemTools::CollapseFullPath(this->Makefile->GetHomeDirectory());
+    cmSystemTools::CollapseFullPath(this->GetState()->GetSourceDirectory());
   cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents);
-  outdir =
-    cmSystemTools::CollapseFullPath(
-                                this->Makefile->GetCurrentSourceDirectory());
+  outdir = cmSystemTools::CollapseFullPath(
+      this->StateSnapshot.GetCurrentSourceDirectory());
   cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents);
 
   outdir = cmSystemTools::CollapseFullPath
-    (this->Makefile->GetHomeOutputDirectory());
+    (this->GetState()->GetBinaryDirectory());
   cmSystemTools::SplitPath(outdir,
                            this->HomeOutputDirectoryComponents);
 
   outdir = cmSystemTools::CollapseFullPath
-    (this->Makefile->GetCurrentBinaryDirectory());
+    (this->StateSnapshot.GetCurrentBinaryDirectory());
   cmSystemTools::SplitPath(outdir,
                            this->StartOutputDirectoryComponents);
 }
@@ -303,7 +302,7 @@ void cmLocalGenerator::GenerateTestFiles()
   const std::string& config =
     this->Makefile->GetConfigurations(configurationTypes, false);
 
-  std::string file = this->Makefile->GetCurrentBinaryDirectory();
+  std::string file = this->StateSnapshot.GetCurrentBinaryDirectory();
   file += "/";
   file += "CTestTestfile.cmake";
 
@@ -312,9 +311,9 @@ void cmLocalGenerator::GenerateTestFiles()
 
   fout << "# CMake generated Testfile for " << std::endl
        << "# Source directory: "
-       << this->Makefile->GetCurrentSourceDirectory() << std::endl
+       << this->StateSnapshot.GetCurrentSourceDirectory() << std::endl
        << "# Build directory: "
-       << this->Makefile->GetCurrentBinaryDirectory() << std::endl
+       << this->StateSnapshot.GetCurrentBinaryDirectory() << std::endl
        << "# " << std::endl
        << "# This file includes the relevant testing commands "
        << "required for " << std::endl
@@ -428,9 +427,9 @@ void cmLocalGenerator::GenerateInstallRules()
     }
 
   // Create the install script file.
-  std::string file = this->Makefile->GetCurrentBinaryDirectory();
-  std::string homedir = this->Makefile->GetHomeOutputDirectory();
-  std::string currdir = this->Makefile->GetCurrentBinaryDirectory();
+  std::string file = this->StateSnapshot.GetCurrentBinaryDirectory();
+  std::string homedir = this->GetState()->GetBinaryDirectory();
+  std::string currdir = this->StateSnapshot.GetCurrentBinaryDirectory();
   cmSystemTools::ConvertToUnixSlashes(file);
   cmSystemTools::ConvertToUnixSlashes(homedir);
   cmSystemTools::ConvertToUnixSlashes(currdir);
@@ -445,7 +444,7 @@ void cmLocalGenerator::GenerateInstallRules()
 
   // Write the header.
   fout << "# Install script for directory: "
-       << this->Makefile->GetCurrentSourceDirectory()
+       << this->StateSnapshot.GetCurrentSourceDirectory()
        << std::endl << std::endl;
   fout << "# Set the install prefix" << std::endl
        << "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl
@@ -664,7 +663,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
     source.GetFullPath(),
     commandLines,
     comment.c_str(),
-    this->Makefile->GetCurrentBinaryDirectory()
+    this->StateSnapshot.GetCurrentBinaryDirectory()
     );
 }
 
@@ -686,12 +685,12 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
        !sf->GetPropertyAsBool("EXTERNAL_OBJECT"))
       {
       std::string dir_max;
-      dir_max += this->Makefile->GetCurrentBinaryDirectory();
+      dir_max += this->StateSnapshot.GetCurrentBinaryDirectory();
       dir_max += "/";
       std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_max);
       if(!obj.empty())
         {
-        std::string ofname = this->Makefile->GetCurrentBinaryDirectory();
+        std::string ofname = this->StateSnapshot.GetCurrentBinaryDirectory();
         ofname += "/";
         ofname += obj;
         objVector.push_back(ofname);
@@ -761,7 +760,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
     "",
     commandLines,
     comment.c_str(),
-    this->Makefile->GetCurrentBinaryDirectory()
+    this->StateSnapshot.GetCurrentBinaryDirectory()
     );
   this->Makefile->GetSource(targetFullPath);
   target.Target->AddSource(targetFullPath);
@@ -1565,19 +1564,19 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
   if(includeBinaryDir)
     {
     if(emitted.find(
-                this->Makefile->GetCurrentBinaryDirectory()) == emitted.end())
+        this->StateSnapshot.GetCurrentBinaryDirectory()) == emitted.end())
       {
-      dirs.push_back(this->Makefile->GetCurrentBinaryDirectory());
-      emitted.insert(this->Makefile->GetCurrentBinaryDirectory());
+      dirs.push_back(this->StateSnapshot.GetCurrentBinaryDirectory());
+      emitted.insert(this->StateSnapshot.GetCurrentBinaryDirectory());
       }
     }
   if(includeSourceDir)
     {
     if(emitted.find(
-                this->Makefile->GetCurrentSourceDirectory()) == emitted.end())
+        this->StateSnapshot.GetCurrentSourceDirectory()) == emitted.end())
       {
-      dirs.push_back(this->Makefile->GetCurrentSourceDirectory());
-      emitted.insert(this->Makefile->GetCurrentSourceDirectory());
+      dirs.push_back(this->StateSnapshot.GetCurrentSourceDirectory());
+      emitted.insert(this->StateSnapshot.GetCurrentSourceDirectory());
       }
     }
 
@@ -1619,8 +1618,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
   // it is requested by the project.
   if(this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE"))
     {
-    const char* topSourceDir = this->Makefile->GetHomeDirectory();
-    const char* topBinaryDir = this->Makefile->GetHomeOutputDirectory();
+    const char* topSourceDir = this->GetState()->GetSourceDirectory();
+    const char* topBinaryDir = this->GetState()->GetBinaryDirectory();
     for(std::vector<std::string>::const_iterator i = includes.begin();
         i != includes.end(); ++i)
       {
@@ -2178,7 +2177,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
 
   // Treat the name as relative to the source directory in which it
   // was given.
-  dep = this->Makefile->GetCurrentSourceDirectory();
+  dep = this->StateSnapshot.GetCurrentSourceDirectory();
   dep += "/";
   dep += inName;
   return true;
@@ -2730,10 +2729,10 @@ const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot)
 {
   switch (relroot)
     {
-    case HOME:         return this->Makefile->GetHomeDirectory();
-    case START:        return this->Makefile->GetCurrentSourceDirectory();
-    case HOME_OUTPUT:  return this->Makefile->GetHomeOutputDirectory();
-    case START_OUTPUT: return this->Makefile->GetCurrentBinaryDirectory();
+    case HOME:         return this->GetState()->GetSourceDirectory();
+    case START:        return this->StateSnapshot.GetCurrentSourceDirectory();
+    case HOME_OUTPUT:  return this->GetState()->GetBinaryDirectory();
+    case START_OUTPUT: return this->StateSnapshot.GetCurrentBinaryDirectory();
     default: break;
     }
   return 0;
@@ -2861,14 +2860,14 @@ std::string cmLocalGenerator::FindRelativePathTopSource()
     {
     std::string parentTop = parent->FindRelativePathTopSource();
     if(cmSystemTools::IsSubDirectory(
-         this->Makefile->GetCurrentSourceDirectory(), parentTop))
+         this->StateSnapshot.GetCurrentSourceDirectory(), parentTop))
       {
       return parentTop;
       }
     }
 
   // Otherwise this directory itself is the new top.
-  return this->Makefile->GetCurrentSourceDirectory();
+  return this->StateSnapshot.GetCurrentSourceDirectory();
 }
 
 //----------------------------------------------------------------------------
@@ -2881,14 +2880,14 @@ std::string cmLocalGenerator::FindRelativePathTopBinary()
     {
     std::string parentTop = parent->FindRelativePathTopBinary();
     if(cmSystemTools::IsSubDirectory(
-         this->Makefile->GetCurrentBinaryDirectory(), parentTop))
+         this->StateSnapshot.GetCurrentBinaryDirectory(), parentTop))
       {
       return parentTop;
       }
     }
 
   // Otherwise this directory itself is the new top.
-  return this->Makefile->GetCurrentBinaryDirectory();
+  return this->StateSnapshot.GetCurrentBinaryDirectory();
 }
 
 //----------------------------------------------------------------------------

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4bbbbcffc7592c990fe2c64c13eed4550fe48fa
commit d4bbbbcffc7592c990fe2c64c13eed4550fe48fa
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 16:51:51 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 5 21:50:42 2015 +0200

    cmLocalGenerator: Initialize state before creating cmMakefile.
    
    Access the state from the local generator in the cmMakefile.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2f2da20..c099a4d 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -51,6 +51,13 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
   if (parent)
     {
     parent->AddChild(this);
+    this->StateSnapshot =
+        this->GetState()->CreateSnapshot(parent->StateSnapshot);
+    }
+  else
+    {
+    this->StateSnapshot =
+        this->GetState()->CreateSnapshot(cmState::Snapshot(this->GetState()));
     }
   this->Makefile = new cmMakefile(this);
 
@@ -573,6 +580,16 @@ void cmLocalGenerator::GenerateTargetManifest()
     }
 }
 
+cmState* cmLocalGenerator::GetState() const
+{
+  return this->GlobalGenerator->GetCMakeInstance()->GetState();
+}
+
+cmState::Snapshot cmLocalGenerator::GetStateSnapshot() const
+{
+  return this->StateSnapshot;
+}
+
 void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
                                                     const std::string& lang,
                                                     cmSourceFile& source,
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 44a2d99..100d27b 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -13,6 +13,7 @@
 #define cmLocalGenerator_h
 
 #include "cmStandardIncludes.h"
+#include "cmState.h"
 
 class cmMakefile;
 class cmGlobalGenerator;
@@ -88,6 +89,9 @@ public:
   const cmGlobalGenerator *GetGlobalGenerator() const {
     return this->GlobalGenerator; }
 
+  cmState* GetState() const;
+  cmState::Snapshot GetStateSnapshot() const;
+
   /**
    * Convert something to something else. This is a centralized conversion
    * routine used by the generators to handle relative paths and the like.
@@ -442,6 +446,7 @@ protected:
   void ReadInputFile();
 
   cmMakefile *Makefile;
+  cmState::Snapshot StateSnapshot;
   cmGlobalGenerator *GlobalGenerator;
   std::vector<std::string> HomeDirectoryComponents;
   std::vector<std::string> StartDirectoryComponents;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 82add86..b448338 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -153,27 +153,13 @@ public:
 cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
   : Internal(new Internals),
     LocalGenerator(localGenerator),
-    StateSnapshot(localGenerator->GetGlobalGenerator()
-                                ->GetCMakeInstance()->GetState())
+    StateSnapshot(localGenerator->GetStateSnapshot())
 {
   this->Internal->PushDefinitions();
   this->Internal->VarInitStack.push(std::set<std::string>());
   this->Internal->VarUsageStack.push(std::set<std::string>());
   this->Internal->IsSourceFileTryCompile = false;
 
-  if (this->LocalGenerator->GetParent())
-    {
-    cmMakefile* parentMf = this->LocalGenerator->GetParent()->GetMakefile();
-    this->StateSnapshot =
-        this->GetState()->CreateSnapshot(parentMf->StateSnapshot);
-    }
-  else
-    {
-    this->StateSnapshot =
-        this->GetState()->CreateSnapshot(this->StateSnapshot);
-    }
-
-
   // Initialize these first since AddDefaultDefinitions calls AddDefinition
   this->WarnUnused = false;
   this->CheckSystemVars = false;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0c801c6963f051c32e0586266539f155a70bd5e3
commit 0c801c6963f051c32e0586266539f155a70bd5e3
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 16:50:34 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 5 21:50:41 2015 +0200

    cmLocalGenerator: Require a global generator in the constructor.
    
    Port generator factory methods to pass it.

diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 597e08e..0220799 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -41,13 +41,12 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator(
     cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg =
-      new cmLocalUnixMakefileGenerator3(parent);
+      new cmLocalUnixMakefileGenerator3(this, parent);
   lg->SetIncludeDirective("!include");
   lg->SetWindowsShell(true);
   lg->SetDefineWindowsNULL(true);
   lg->SetMakefileVariableSize(32);
   lg->SetPassMakeflags(true);
-  lg->SetGlobalGenerator(this);
   lg->SetUnixCD(false);
   lg->SetMakeCommandEscapeTargetTwice(true);
   lg->SetBorlandMakeCurlyHack(true);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 1c90537..7117402 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1877,9 +1877,7 @@ void cmGlobalGenerator::EnableInstallTarget()
 cmLocalGenerator *
 cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator *parent)
 {
-  cmLocalGenerator *lg = new cmLocalGenerator(parent);
-  lg->SetGlobalGenerator(this);
-  return lg;
+  return new cmLocalGenerator(this, parent);
 }
 
 void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 181a517..d6bf75c 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -35,8 +35,7 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
 cmLocalGenerator *
 cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  cmLocalGenerator *lg = new cmLocalGhsMultiGenerator(parent);
-  lg->SetGlobalGenerator(this);
+  cmLocalGenerator *lg = new cmLocalGhsMultiGenerator(this, parent);
   this->SetCurrentLocalGenerator(lg);
   return lg;
 }
diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx
index cfa5072..1caa730 100644
--- a/Source/cmGlobalJOMMakefileGenerator.cxx
+++ b/Source/cmGlobalJOMMakefileGenerator.cxx
@@ -49,11 +49,10 @@ cmLocalGenerator *
 cmGlobalJOMMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg
-      = new cmLocalUnixMakefileGenerator3(parent);
+      = new cmLocalUnixMakefileGenerator3(this, parent);
   lg->SetDefineWindowsNULL(true);
   lg->SetWindowsShell(true);
   lg->SetMakeSilentFlag("/nologo");
-  lg->SetGlobalGenerator(this);
   lg->SetIgnoreLibPrefix(true);
   lg->SetPassMakeflags(true);
   lg->SetNMake(true);
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index fa23491..319eeaf 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -97,10 +97,9 @@ cmLocalGenerator *
 cmGlobalMSYSMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg =
-      new cmLocalUnixMakefileGenerator3(parent);
+      new cmLocalUnixMakefileGenerator3(this, parent);
   lg->SetWindowsShell(false);
   lg->SetMSYSShell(true);
-  lg->SetGlobalGenerator(this);
   lg->SetIgnoreLibPrefix(true);
   lg->SetPassMakeflags(false);
   lg->SetUnixCD(true);
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index c9389aa..c4511e5 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -35,9 +35,8 @@ cmLocalGenerator *
 cmGlobalMinGWMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg =
-      new cmLocalUnixMakefileGenerator3(parent);
+      new cmLocalUnixMakefileGenerator3(this, parent);
   lg->SetWindowsShell(true);
-  lg->SetGlobalGenerator(this);
   lg->SetIgnoreLibPrefix(true);
   lg->SetPassMakeflags(false);
   lg->SetUnixCD(true);
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index a3b3dd7..2732e22 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -49,11 +49,10 @@ cmLocalGenerator *
 cmGlobalNMakeMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg =
-      new cmLocalUnixMakefileGenerator3(parent);
+      new cmLocalUnixMakefileGenerator3(this, parent);
   lg->SetDefineWindowsNULL(true);
   lg->SetWindowsShell(true);
   lg->SetMakeSilentFlag("/nologo");
-  lg->SetGlobalGenerator(this);
   lg->SetIgnoreLibPrefix(true);
   lg->SetPassMakeflags(true);
   lg->SetNMake(true);
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 678d60b..dde9ca4 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -499,9 +499,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
 cmLocalGenerator*
 cmGlobalNinjaGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  cmLocalGenerator* lg = new cmLocalNinjaGenerator(parent);
-  lg->SetGlobalGenerator(this);
-  return lg;
+  return new cmLocalNinjaGenerator(this, parent);
 }
 
 void cmGlobalNinjaGenerator
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 95998ae..f5731f4 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -56,9 +56,7 @@ void cmGlobalUnixMakefileGenerator3
 cmLocalGenerator *
 cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  cmLocalGenerator* lg = new cmLocalUnixMakefileGenerator3(parent);
-  lg->SetGlobalGenerator(this);
-  return lg;
+  return new cmLocalUnixMakefileGenerator3(this, parent);
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 6481ec2..04bb6ce 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -311,11 +311,8 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
 cmLocalGenerator *
 cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  cmLocalVisualStudio10Generator* lg =
-    new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10,
-                                       parent);
-  lg->SetGlobalGenerator(this);
-  return lg;
+  return new cmLocalVisualStudio10Generator(
+    cmLocalVisualStudioGenerator::VS10, this, parent);
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 45d6d95..36ae0a4 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -240,11 +240,8 @@ void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
 cmLocalGenerator *
 cmGlobalVisualStudio11Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  cmLocalVisualStudio10Generator* lg =
-    new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11,
-                                       parent);
-  lg->SetGlobalGenerator(this);
-  return lg;
+  return new cmLocalVisualStudio10Generator(
+    cmLocalVisualStudioGenerator::VS11, this, parent);
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index e298b06..17b2fc7 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -220,11 +220,8 @@ void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout)
 cmLocalGenerator *
 cmGlobalVisualStudio12Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  cmLocalVisualStudio10Generator* lg =
-    new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS12,
-                                       parent);
-  lg->SetGlobalGenerator(this);
-  return lg;
+  return new cmLocalVisualStudio10Generator(
+    cmLocalVisualStudioGenerator::VS12, this, parent);
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 6642d88..90fcc7e 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -131,9 +131,6 @@ void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout)
 cmLocalGenerator *
 cmGlobalVisualStudio14Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  cmLocalVisualStudio10Generator* lg =
-    new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS14,
-                                       parent);
-  lg->SetGlobalGenerator(this);
-  return lg;
+  return new cmLocalVisualStudio10Generator(
+    cmLocalVisualStudioGenerator::VS14, this, parent);
 }
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 55e70b3..570314e 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -173,9 +173,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
 cmLocalGenerator *
 cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  cmLocalGenerator *lg = new cmLocalVisualStudio6Generator(parent);
-  lg->SetGlobalGenerator(this);
-  return lg;
+  return new cmLocalVisualStudio6Generator(this, parent);
 }
 
 
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index db34d44..308e858 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -30,9 +30,8 @@ cmGlobalVisualStudio71Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalVisualStudio7Generator *lg =
     new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS71,
-                                      parent);
+                                      this, parent);
   lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
-  lg->SetGlobalGenerator(this);
   return lg;
 }
 
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index de90f7e..b78823f 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -255,9 +255,8 @@ cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalVisualStudio7Generator *lg =
     new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS7,
-                                      parent);
+                                      this, parent);
   lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
-  lg->SetGlobalGenerator(this);
   return lg;
 }
 
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 7174f21..ff9ff10 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -130,9 +130,8 @@ cmGlobalVisualStudio8Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalVisualStudio7Generator *lg =
     new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8,
-                                      parent);
+                                      this, parent);
   lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
-  lg->SetGlobalGenerator(this);
   return lg;
 }
 
diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx
index 0303c27..8adde23 100644
--- a/Source/cmGlobalVisualStudio9Generator.cxx
+++ b/Source/cmGlobalVisualStudio9Generator.cxx
@@ -119,9 +119,8 @@ cmGlobalVisualStudio9Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalVisualStudio7Generator *lg
     = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9,
-                                        parent);
+                                        this, parent);
   lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
-  lg->SetGlobalGenerator(this);
   return lg;
 }
 
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 77c6474..49c516f 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -45,14 +45,13 @@ cmLocalGenerator *
 cmGlobalWatcomWMakeGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg
-      = new cmLocalUnixMakefileGenerator3(parent);
+      = new cmLocalUnixMakefileGenerator3(this, parent);
   lg->SetDefineWindowsNULL(true);
 #ifdef _WIN32
   lg->SetWindowsShell(true);
 #endif
   lg->SetWatcomWMake(true);
   lg->SetMakeSilentFlag("-h");
-  lg->SetGlobalGenerator(this);
   lg->SetIgnoreLibPrefix(true);
   lg->SetPassMakeflags(false);
   lg->SetUnixCD(false);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 742750c..4a7411c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -371,9 +371,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
 cmLocalGenerator *
 cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  cmLocalGenerator *lg = new cmLocalXCodeGenerator(parent);
-  lg->SetGlobalGenerator(this);
-  return lg;
+  return new cmLocalXCodeGenerator(this, parent);
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 1c3114e..2f2da20 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -43,14 +43,17 @@
 #include <StorageDefs.h>
 #endif
 
-cmLocalGenerator::cmLocalGenerator(cmLocalGenerator* parent)
+cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
+                                   cmLocalGenerator* parent)
 {
-  this->Makefile = 0; // moved to after set on global
+  this->GlobalGenerator = gg;
   this->Parent = parent;
   if (parent)
     {
     parent->AddChild(this);
     }
+  this->Makefile = new cmMakefile(this);
+
   this->WindowsShell = false;
   this->WindowsVSIDE = false;
   this->WatcomWMake = false;
@@ -249,13 +252,6 @@ void cmLocalGenerator::SetupPathConversions()
                            this->StartOutputDirectoryComponents);
 }
 
-
-void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg)
-{
-  this->GlobalGenerator = gg;
-  this->Makefile = new cmMakefile(this);
-}
-
 void cmLocalGenerator::ConfigureFinalPass()
 {
   this->Makefile->ConfigureFinalPass();
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index af333fd..44a2d99 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -33,7 +33,7 @@ class cmCustomCommandGenerator;
 class cmLocalGenerator
 {
 public:
-  cmLocalGenerator(cmLocalGenerator* parent);
+  cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
   virtual ~cmLocalGenerator();
 
   /**
@@ -88,9 +88,6 @@ public:
   const cmGlobalGenerator *GetGlobalGenerator() const {
     return this->GlobalGenerator; }
 
-  ///! Set the Global Generator, done on creation by the GlobalGenerator
-  void SetGlobalGenerator(cmGlobalGenerator *gg);
-
   /**
    * Convert something to something else. This is a centralized conversion
    * routine used by the generators to handle relative paths and the like.
diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx
index fa2a1a5..ddef3f5 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -16,8 +16,9 @@
 #include "cmGhsMultiTargetGenerator.h"
 #include "cmGeneratedFileStream.h"
 
-cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmLocalGenerator* parent)
-  : cmLocalGenerator(parent)
+cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
+                                                   cmLocalGenerator* parent)
+  : cmLocalGenerator(gg, parent)
 {
 }
 
diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h
index 7afef56..ec25cba 100644
--- a/Source/cmLocalGhsMultiGenerator.h
+++ b/Source/cmLocalGhsMultiGenerator.h
@@ -25,7 +25,7 @@ class cmGeneratedFileStream;
 class cmLocalGhsMultiGenerator : public cmLocalGenerator
 {
 public:
-  cmLocalGhsMultiGenerator(cmLocalGenerator* parent);
+  cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
 
   virtual ~cmLocalGhsMultiGenerator();
 
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 4e817a0..ac10f09 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -22,8 +22,9 @@
 
 #include <assert.h>
 
-cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmLocalGenerator* parent)
-  : cmLocalGenerator(parent)
+cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
+                                             cmLocalGenerator* parent)
+  : cmLocalGenerator(gg, parent)
   , ConfigName("")
   , HomeRelativeOutputPath("")
 {
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index d72677b..0b87426 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -32,7 +32,7 @@ class cmLocalNinjaGenerator : public cmLocalGenerator
 {
 public:
   /// Default constructor.
-  cmLocalNinjaGenerator(cmLocalGenerator* parent);
+  cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
 
   /// Destructor.
   virtual ~cmLocalNinjaGenerator();
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index faeb9db..a2a3725 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -80,8 +80,8 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
 
 //----------------------------------------------------------------------------
 cmLocalUnixMakefileGenerator3::
-cmLocalUnixMakefileGenerator3(cmLocalGenerator* parent)
-  : cmLocalGenerator(parent)
+cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent)
+  : cmLocalGenerator(gg, parent)
 {
   this->WindowsShell = false;
   this->IncludeDirective = "include";
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index aee22ec..4e48ad7 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -34,7 +34,8 @@ class cmSourceFile;
 class cmLocalUnixMakefileGenerator3 : public cmLocalGenerator
 {
 public:
-  cmLocalUnixMakefileGenerator3(cmLocalGenerator* parent);
+  cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg,
+                                cmLocalGenerator* parent);
   virtual ~cmLocalUnixMakefileGenerator3();
 
   /**
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 73a4ec8..06a3b6c 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -62,8 +62,9 @@ class cmVS10XMLParser : public cmXMLParser
 
 //----------------------------------------------------------------------------
 cmLocalVisualStudio10Generator
-::cmLocalVisualStudio10Generator(VSVersion v, cmLocalGenerator* parent):
-  cmLocalVisualStudio7Generator(v, parent)
+::cmLocalVisualStudio10Generator(VSVersion v, cmGlobalGenerator* gg,
+                                 cmLocalGenerator* parent):
+  cmLocalVisualStudio7Generator(v, gg, parent)
 {
 }
 
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index f90daa0..987e08b 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -25,7 +25,8 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator
 {
 public:
   ///! Set cache only and recurse to false by default.
-  cmLocalVisualStudio10Generator(VSVersion v, cmLocalGenerator* parent);
+  cmLocalVisualStudio10Generator(VSVersion v, cmGlobalGenerator* gg,
+                                 cmLocalGenerator* parent);
 
   virtual ~cmLocalVisualStudio10Generator();
 
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 6d89b15..42da639 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -24,8 +24,9 @@
 #include <cmsys/FStream.hxx>
 
 cmLocalVisualStudio6Generator
-::cmLocalVisualStudio6Generator(cmLocalGenerator* parent):
-  cmLocalVisualStudioGenerator(VS6, parent)
+::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
+                                cmLocalGenerator* parent):
+  cmLocalVisualStudioGenerator(VS6, gg, parent)
 {
 }
 
diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h
index 1a0a614..a6e0b3d 100644
--- a/Source/cmLocalVisualStudio6Generator.h
+++ b/Source/cmLocalVisualStudio6Generator.h
@@ -29,7 +29,8 @@ class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator
 {
 public:
   ///! Set cache only and recurse to false by default.
-  cmLocalVisualStudio6Generator(cmLocalGenerator* parent);
+  cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
+                                cmLocalGenerator* parent);
 
   virtual ~cmLocalVisualStudio6Generator();
 
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 2152f77..63c18a7 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -55,8 +55,9 @@ static void cmConvertToWindowsSlash(std::string& s)
 
 //----------------------------------------------------------------------------
 cmLocalVisualStudio7Generator
-::cmLocalVisualStudio7Generator(VSVersion v, cmLocalGenerator* parent):
-  cmLocalVisualStudioGenerator(v, parent)
+::cmLocalVisualStudio7Generator(VSVersion v, cmGlobalGenerator* gg,
+                                cmLocalGenerator* parent):
+  cmLocalVisualStudioGenerator(v, gg, parent)
 {
   this->ExtraFlagTable = 0;
   this->Internal = new cmLocalVisualStudio7GeneratorInternals(this);
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index cfbc63c..1891369 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -35,7 +35,8 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
 {
 public:
   ///! Set cache only and recurse to false by default.
-  cmLocalVisualStudio7Generator(VSVersion v, cmLocalGenerator* parent);
+  cmLocalVisualStudio7Generator(VSVersion v, cmGlobalGenerator* gg,
+                                cmLocalGenerator* parent);
 
   virtual ~cmLocalVisualStudio7Generator();
 
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 854ad34..f95d09b 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -19,8 +19,9 @@
 
 //----------------------------------------------------------------------------
 cmLocalVisualStudioGenerator
-::cmLocalVisualStudioGenerator(VSVersion v, cmLocalGenerator* parent)
-  : cmLocalGenerator(parent)
+::cmLocalVisualStudioGenerator(VSVersion v, cmGlobalGenerator* gg,
+                               cmLocalGenerator* parent)
+  : cmLocalGenerator(gg, parent)
 {
   this->WindowsShell = true;
   this->WindowsVSIDE = true;
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 562d595..1152e82 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -45,7 +45,8 @@ public:
     VS14 = 140
   };
 
-  cmLocalVisualStudioGenerator(VSVersion v, cmLocalGenerator* parent);
+  cmLocalVisualStudioGenerator(VSVersion v, cmGlobalGenerator* gg,
+                               cmLocalGenerator* parent);
   virtual ~cmLocalVisualStudioGenerator();
 
   /** Construct a script from the given list of command lines.  */
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 1d3a8cf..a957c27 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -15,8 +15,9 @@
 #include "cmMakefile.h"
 
 //----------------------------------------------------------------------------
-cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmLocalGenerator* parent)
-  : cmLocalGenerator(parent)
+cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg,
+                                             cmLocalGenerator* parent)
+  : cmLocalGenerator(gg, parent)
 {
   // the global generator does this, so do not
   // put these flags into the language flags
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index 1a5760f..54bc6df 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -24,7 +24,7 @@ class cmLocalXCodeGenerator : public cmLocalGenerator
 {
 public:
   ///! Set cache only and recurse to false by default.
-  cmLocalXCodeGenerator(cmLocalGenerator* parent);
+  cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
 
   virtual ~cmLocalXCodeGenerator();
   virtual std::string GetTargetDirectory(cmTarget const& target) const;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5acbe27cf51ba34d34322bd19ac0f32b7ef193d6
commit 5acbe27cf51ba34d34322bd19ac0f32b7ef193d6
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue May 5 21:50:39 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 5 21:50:39 2015 +0200

    Don't use a cmLocalGenerator instance to call static methods.

diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 1109aca..dd276a8 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -242,8 +242,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
       }
 
     // Detect languages to enable.
-    cmLocalGenerator* lg = this->Makefile->GetLocalGenerator();
-    cmGlobalGenerator* gg = lg->GetGlobalGenerator();
+    cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
     std::set<std::string> testLangs;
     for(std::vector<std::string>::iterator si = sources.begin();
         si != sources.end(); ++si)
@@ -323,7 +322,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
       std::string langFlags = "CMAKE_" + *li + "_FLAGS";
       const char* flags = this->Makefile->GetDefinition(langFlags);
       fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(),
-              lg->EscapeForCMake(flags?flags:"").c_str());
+              cmLocalGenerator::EscapeForCMake(flags?flags:"").c_str());
       fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
               " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str());
       }
@@ -356,7 +355,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
         const char* exeLinkFlags =
           this->Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS");
         fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS %s)\n",
-                lg->EscapeForCMake(exeLinkFlags?exeLinkFlags:"").c_str());
+                cmLocalGenerator::EscapeForCMake(
+                    exeLinkFlags ? exeLinkFlags : "").c_str());
         } break;
       }
     fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS}"
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 6dea5c1..3551f83 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -20,15 +20,14 @@
 
 
 static std::string cmIfCommandError(
-  cmMakefile* mf, std::vector<cmExpandedCommandArgument> const& args)
+  std::vector<cmExpandedCommandArgument> const& args)
 {
-  cmLocalGenerator* lg = mf->GetLocalGenerator();
   std::string err = "given arguments:\n ";
   for(std::vector<cmExpandedCommandArgument>::const_iterator i = args.begin();
       i != args.end(); ++i)
     {
     err += " ";
-    err += lg->EscapeForCMake(i->GetValue());
+    err += cmLocalGenerator::EscapeForCMake(i->GetValue());
     }
   err += "\n";
   return err;
@@ -118,7 +117,7 @@ IsFunctionBlocked(const cmListFileFunction& lff,
 
             if (!errorString.empty())
               {
-              std::string err = cmIfCommandError(&mf, expandedArguments);
+              std::string err = cmIfCommandError(expandedArguments);
               err += errorString;
               mf.IssueMessage(messType, err);
               if (messType == cmake::FATAL_ERROR)
@@ -206,7 +205,7 @@ bool cmIfCommand
 
   if (!errorString.empty())
     {
-    std::string err = cmIfCommandError(this->Makefile, expandedArguments);
+    std::string err = cmIfCommandError(expandedArguments);
     err += errorString;
     if (status == cmake::FATAL_ERROR)
       {
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index bf6fb61..faeb9db 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1261,7 +1261,7 @@ cmLocalUnixMakefileGenerator3
         f != files.end(); ++f)
       {
       std::string fc = this->Convert(*f,START_OUTPUT,UNCHANGED);
-      fout << "  " << this->EscapeForCMake(fc) << "\n";
+      fout << "  " << cmLocalGenerator::EscapeForCMake(fc) << "\n";
       }
     fout << ")\n";
     }
@@ -2060,7 +2060,7 @@ void cmLocalUnixMakefileGenerator3
           di != defines.end(); ++di)
         {
         cmakefileStream
-          << "  " << this->EscapeForCMake(*di) << "\n";
+          << "  " << cmLocalGenerator::EscapeForCMake(*di) << "\n";
         }
       cmakefileStream
         << "  )\n";
@@ -2113,7 +2113,8 @@ void cmLocalUnixMakefileGenerator3
     for(std::vector<std::string>::const_iterator tri = transformRules.begin();
         tri != transformRules.end(); ++tri)
       {
-      cmakefileStream << "  " << this->EscapeForCMake(*tri) << "\n";
+      cmakefileStream << "  "
+          << cmLocalGenerator::EscapeForCMake(*tri) << "\n";
       }
     cmakefileStream
       << "  )\n";
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index a4dad1e..2ee23d1 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1118,8 +1118,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
         pi != this->MultipleOutputPairs.end(); ++pi)
       {
       *this->InfoFileStream
-        << "  " << this->LocalGenerator->EscapeForCMake(pi->first)
-        << " "  << this->LocalGenerator->EscapeForCMake(pi->second)
+        << "  " << cmLocalGenerator::EscapeForCMake(pi->first)
+        << " "  << cmLocalGenerator::EscapeForCMake(pi->second)
         << "\n";
       }
     *this->InfoFileStream << "  )\n\n";
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index add80fa..7e11d8c 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -82,7 +82,6 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
   // be translated.
   std::string exe = command[0];
   cmMakefile* mf = this->Test->GetMakefile();
-  cmLocalGenerator* lg = mf->GetLocalGenerator();
   cmTarget* target = mf->FindTargetToUse(exe);
   if(target && target->GetType() == cmTarget::EXECUTABLE)
     {
@@ -98,13 +97,13 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
       cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
       std::string emulatorExe(emulatorWithArgs[0]);
       cmSystemTools::ConvertToUnixSlashes(emulatorExe);
-      os << lg->EscapeForCMake(emulatorExe) << " ";
+      os << cmLocalGenerator::EscapeForCMake(emulatorExe) << " ";
       for(std::vector<std::string>::const_iterator ei =
           emulatorWithArgs.begin()+1;
           ei != emulatorWithArgs.end();
           ++ei)
         {
-        os << lg->EscapeForCMake(*ei) << " ";
+        os << cmLocalGenerator::EscapeForCMake(*ei) << " ";
         }
       }
     }
@@ -116,11 +115,12 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
     }
 
   // Generate the command line with full escapes.
-  os << lg->EscapeForCMake(exe);
+  os << cmLocalGenerator::EscapeForCMake(exe);
   for(std::vector<std::string>::const_iterator ci = command.begin()+1;
       ci != command.end(); ++ci)
     {
-    os << " " << lg->EscapeForCMake(ge.Parse(*ci)->Evaluate(mf, config));
+    os << " " << cmLocalGenerator::EscapeForCMake(
+                                         ge.Parse(*ci)->Evaluate(mf, config));
     }
 
   // Finish the test command.
@@ -136,7 +136,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
         i != pm.end(); ++i)
       {
       os << " " << i->first
-         << " " << lg->EscapeForCMake(
+         << " " << cmLocalGenerator::EscapeForCMake(
            ge.Parse(i->second.GetValue())->Evaluate(mf, config));
       }
     os << ")" << std::endl;
@@ -197,8 +197,6 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
   fout << ")" << std::endl;
 
   // Output properties for the test.
-  cmMakefile* mf = this->Test->GetMakefile();
-  cmLocalGenerator* lg = mf->GetLocalGenerator();
   cmPropertyMap& pm = this->Test->GetProperties();
   if(!pm.empty())
     {
@@ -208,7 +206,7 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
         i != pm.end(); ++i)
       {
       fout << " " << i->first
-           << " " << lg->EscapeForCMake(i->second.GetValue());
+           << " " << cmLocalGenerator::EscapeForCMake(i->second.GetValue());
       }
     fout << ")" << std::endl;
     }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee05c3c80b3cd59f7aeb64aad492587a631d6447
commit ee05c3c80b3cd59f7aeb64aad492587a631d6447
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue May 5 00:04:22 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 5 21:21:02 2015 +0200

    cmLocalGenerator: Remove EscapeForShellOldStyle to only caller.

diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 162d7a1..d23f815 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -51,6 +51,35 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
 }
 
 //----------------------------------------------------------------------------
+std::string escapeForShellOldStyle(const std::string& str)
+{
+  std::string result;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+  // if there are spaces
+  std::string temp = str;
+  if (temp.find(" ") != std::string::npos &&
+      temp.find("\"")==std::string::npos)
+    {
+    result = "\"";
+    result += str;
+    result += "\"";
+    return result;
+    }
+  return str;
+#else
+  for(const char* ch = str.c_str(); *ch != '\0'; ++ch)
+    {
+    if(*ch == ' ')
+      {
+      result += '\\';
+      }
+    result += *ch;
+    }
+  return result;
+#endif
+}
+
+//----------------------------------------------------------------------------
 void
 cmCustomCommandGenerator
 ::AppendArguments(unsigned int c, std::string& cmd) const
@@ -63,7 +92,7 @@ cmCustomCommandGenerator
     cmd += " ";
     if(this->OldStyle)
       {
-      cmd += this->LG->EscapeForShellOldStyle(arg);
+      cmd += escapeForShellOldStyle(arg);
       }
     else
       {
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 88c88cd..1c3114e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3392,35 +3392,6 @@ cmLocalGenerator
 }
 
 //----------------------------------------------------------------------------
-std::string cmLocalGenerator::EscapeForShellOldStyle(const std::string& str)
-{
-  std::string result;
-#if defined(_WIN32) && !defined(__CYGWIN__)
-  // if there are spaces
-  std::string temp = str;
-  if (temp.find(" ") != std::string::npos &&
-      temp.find("\"")==std::string::npos)
-    {
-    result = "\"";
-    result += str;
-    result += "\"";
-    return result;
-    }
-  return str;
-#else
-  for(const char* ch = str.c_str(); *ch != '\0'; ++ch)
-    {
-    if(*ch == ' ')
-      {
-      result += '\\';
-      }
-    result += *ch;
-    }
-  return result;
-#endif
-}
-
-//----------------------------------------------------------------------------
 static bool cmLocalGeneratorIsShellOperator(const std::string& str)
 {
   static std::set<std::string> shellOperators;
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 49ac9a6..af333fd 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -298,9 +298,6 @@ public:
                              bool forEcho = false,
                              bool useWatcomQuote = false);
 
-  /** Backwards-compatibility version of EscapeForShell.  */
-  std::string EscapeForShellOldStyle(const std::string& str);
-
   /** Escape the given string as an argument in a CMake script.  */
   static std::string EscapeForCMake(const std::string& str);
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f9d2545cf0853fe05e2351d80c3b580cf8b3df77
commit f9d2545cf0853fe05e2351d80c3b580cf8b3df77
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 4 22:50:54 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 5 21:20:59 2015 +0200

    cmLocalGenerator: Remove unused members.

diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index befddbf..49ac9a6 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -449,9 +449,6 @@ protected:
 
   cmMakefile *Makefile;
   cmGlobalGenerator *GlobalGenerator;
-  // members used for relative path function ConvertToMakefilePath
-  std::string RelativePathToSourceDir;
-  std::string RelativePathToBinaryDir;
   std::vector<std::string> HomeDirectoryComponents;
   std::vector<std::string> StartDirectoryComponents;
   std::vector<std::string> HomeOutputDirectoryComponents;
@@ -466,7 +463,6 @@ protected:
   bool WatcomWMake;
   bool MinGWMake;
   bool NMake;
-  bool ForceUnixPath;
   bool MSYSShell;
   bool LinkScriptShell;
   bool UseRelativePaths;

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

Summary of changes:
 Source/CPack/cpack.cxx                      |    2 +
 Source/CTest/cmCTestScriptHandler.cxx       |    2 +
 Source/cmCoreTryCompile.cxx                 |    8 +-
 Source/cmCustomCommandGenerator.cxx         |   31 ++-
 Source/cmGlobalBorlandMakefileGenerator.cxx |    5 +-
 Source/cmGlobalGenerator.cxx                |   11 +-
 Source/cmGlobalGenerator.h                  |    7 +
 Source/cmGlobalGhsMultiGenerator.cxx        |    3 +-
 Source/cmGlobalJOMMakefileGenerator.cxx     |    5 +-
 Source/cmGlobalMSYSMakefileGenerator.cxx    |    6 +-
 Source/cmGlobalMinGWMakefileGenerator.cxx   |    7 +-
 Source/cmGlobalNMakeMakefileGenerator.cxx   |    7 +-
 Source/cmGlobalNinjaGenerator.cxx           |    7 +-
 Source/cmGlobalUnixMakefileGenerator3.cxx   |    4 +-
 Source/cmGlobalVisualStudio10Generator.cxx  |    7 +-
 Source/cmGlobalVisualStudio11Generator.cxx  |    7 +-
 Source/cmGlobalVisualStudio12Generator.cxx  |    7 +-
 Source/cmGlobalVisualStudio14Generator.cxx  |    7 +-
 Source/cmGlobalVisualStudio6Generator.cxx   |    4 +-
 Source/cmGlobalVisualStudio71Generator.cxx  |    3 +-
 Source/cmGlobalVisualStudio7Generator.cxx   |    3 +-
 Source/cmGlobalVisualStudio8Generator.cxx   |    3 +-
 Source/cmGlobalVisualStudio9Generator.cxx   |    3 +-
 Source/cmGlobalVisualStudioGenerator.cxx    |    2 +
 Source/cmGlobalWatcomWMakeGenerator.cxx     |   11 +-
 Source/cmGlobalXCodeGenerator.cxx           |    4 +-
 Source/cmIfCommand.cxx                      |    9 +-
 Source/cmLocalGenerator.cxx                 |  289 +++++++++------------------
 Source/cmLocalGenerator.h                   |   47 ++---
 Source/cmLocalGhsMultiGenerator.cxx         |    5 +-
 Source/cmLocalGhsMultiGenerator.h           |    2 +-
 Source/cmLocalNinjaGenerator.cxx            |    8 +-
 Source/cmLocalNinjaGenerator.h              |    2 +-
 Source/cmLocalUnixMakefileGenerator3.cxx    |   44 ++--
 Source/cmLocalUnixMakefileGenerator3.h      |   33 +--
 Source/cmLocalVisualStudio10Generator.cxx   |    5 +-
 Source/cmLocalVisualStudio10Generator.h     |    3 +-
 Source/cmLocalVisualStudio6Generator.cxx    |    5 +-
 Source/cmLocalVisualStudio6Generator.h      |    3 +-
 Source/cmLocalVisualStudio7Generator.cxx    |    5 +-
 Source/cmLocalVisualStudio7Generator.h      |    3 +-
 Source/cmLocalVisualStudioGenerator.cxx     |    7 +-
 Source/cmLocalVisualStudioGenerator.h       |    3 +-
 Source/cmLocalXCodeGenerator.cxx            |    5 +-
 Source/cmLocalXCodeGenerator.h              |    2 +-
 Source/cmMakefile.cxx                       |   16 +-
 Source/cmMakefileTargetGenerator.cxx        |    4 +-
 Source/cmState.cxx                          |  167 ++++++++++++++++
 Source/cmState.h                            |   31 +++
 Source/cmTestGenerator.cxx                  |   16 +-
 Source/cmake.cxx                            |    3 +
 51 files changed, 467 insertions(+), 416 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list