[Cmake-commits] CMake branch, next, updated. v3.2.2-2622-gd4fb98f

Brad King brad.king at kitware.com
Fri May 8 08:29:51 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  d4fb98f23ae1d83ad732f36f03f40e6303e512d4 (commit)
       via  eb0888e215eb8e5dd8174f1432fcb3289ee79630 (commit)
       via  685258b3eca572b5292cadc367cb559c231ab0cc (commit)
      from  74e9daafbd5473099394bdcb4c86afaea834864a (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=d4fb98f23ae1d83ad732f36f03f40e6303e512d4
commit d4fb98f23ae1d83ad732f36f03f40e6303e512d4
Merge: 74e9daa eb0888e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri May 8 08:29:47 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri May 8 08:29:47 2015 -0400

    Merge topic 'refactor-cmLocalGenerator' into next
    
    eb0888e2 Revert topic 'refactor-cmLocalGenerator'
    685258b3 Tests: Add case for 'ctest' run with bad CTestTestfile


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eb0888e215eb8e5dd8174f1432fcb3289ee79630
commit eb0888e215eb8e5dd8174f1432fcb3289ee79630
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri May 8 08:28:34 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri May 8 08:28:34 2015 -0400

    Revert topic 'refactor-cmLocalGenerator'
    
    It will be revised and restored.

diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index d08b5de..2207873 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -198,8 +198,6 @@ 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/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 20d303d..586070b 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -204,8 +204,6 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
     }
 
   cmake cm;
-  cm.SetHomeDirectory("");
-  cm.SetHomeOutputDirectory("");
   std::string cmakeOutString;
   cmCTestBuildAndTestCaptureRAII captureRAII(cm, cmakeOutString);
   static_cast<void>(captureRAII);
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 322855a..0a34be8 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -336,8 +336,6 @@ 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/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index dd276a8..1109aca 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -242,7 +242,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
       }
 
     // Detect languages to enable.
-    cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
+    cmLocalGenerator* lg = this->Makefile->GetLocalGenerator();
+    cmGlobalGenerator* gg = lg->GetGlobalGenerator();
     std::set<std::string> testLangs;
     for(std::vector<std::string>::iterator si = sources.begin();
         si != sources.end(); ++si)
@@ -322,7 +323,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(),
-              cmLocalGenerator::EscapeForCMake(flags?flags:"").c_str());
+              lg->EscapeForCMake(flags?flags:"").c_str());
       fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
               " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str());
       }
@@ -355,8 +356,7 @@ 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",
-                cmLocalGenerator::EscapeForCMake(
-                    exeLinkFlags ? exeLinkFlags : "").c_str());
+                lg->EscapeForCMake(exeLinkFlags?exeLinkFlags:"").c_str());
         } break;
       }
     fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS}"
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index d23f815..162d7a1 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -51,35 +51,6 @@ 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
@@ -92,7 +63,7 @@ cmCustomCommandGenerator
     cmd += " ";
     if(this->OldStyle)
       {
-      cmd += escapeForShellOldStyle(arg);
+      cmd += this->LG->EscapeForShellOldStyle(arg);
       }
     else
       {
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index d191056..597e08e 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -21,7 +21,6 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator()
   this->ForceUnixPaths = false;
   this->ToolSupportsColor = true;
   this->UseLinkScript = false;
-  this->WindowsShell = true;
 }
 
 
@@ -42,11 +41,13 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator(
     cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg =
-      new cmLocalUnixMakefileGenerator3(this, parent);
+      new cmLocalUnixMakefileGenerator3(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/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h
index 4f24d2d..3f79414 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.h
+++ b/Source/cmGlobalBorlandMakefileGenerator.h
@@ -19,7 +19,7 @@
  *
  * cmGlobalBorlandMakefileGenerator manages nmake build process for a tree
  */
-class cmGlobalBorlandMakefileGenerator : public cmGlobalUnixMakefileGenerator3
+class cmGlobalBorlandMakefileGenerator : public cmGlobalNMakeMakefileGenerator
 {
 public:
   cmGlobalBorlandMakefileGenerator();
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index fe73e8c..1c90537 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -71,13 +71,6 @@ 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()
@@ -1884,7 +1877,9 @@ void cmGlobalGenerator::EnableInstallTarget()
 cmLocalGenerator *
 cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator *parent)
 {
-  return new cmLocalGenerator(this, parent);
+  cmLocalGenerator *lg = new cmLocalGenerator(parent);
+  lg->SetGlobalGenerator(this);
+  return lg;
 }
 
 void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 3b321f2..7107198 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -354,13 +354,6 @@ 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/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index d6bf75c..181a517 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -35,7 +35,8 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
 cmLocalGenerator *
 cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  cmLocalGenerator *lg = new cmLocalGhsMultiGenerator(this, parent);
+  cmLocalGenerator *lg = new cmLocalGhsMultiGenerator(parent);
+  lg->SetGlobalGenerator(this);
   this->SetCurrentLocalGenerator(lg);
   return lg;
 }
diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx
index 25613eb..cfa5072 100644
--- a/Source/cmGlobalJOMMakefileGenerator.cxx
+++ b/Source/cmGlobalJOMMakefileGenerator.cxx
@@ -19,8 +19,6 @@ cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator()
   this->ForceUnixPaths = false;
   this->ToolSupportsColor = true;
   this->UseLinkScript = false;
-  this->WindowsShell = true;
-  this->NMake = true;
 }
 
 void cmGlobalJOMMakefileGenerator
@@ -51,11 +49,14 @@ cmLocalGenerator *
 cmGlobalJOMMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg
-      = new cmLocalUnixMakefileGenerator3(this, parent);
+      = new cmLocalUnixMakefileGenerator3(parent);
   lg->SetDefineWindowsNULL(true);
+  lg->SetWindowsShell(true);
   lg->SetMakeSilentFlag("/nologo");
+  lg->SetGlobalGenerator(this);
   lg->SetIgnoreLibPrefix(true);
   lg->SetPassMakeflags(true);
+  lg->SetNMake(true);
   lg->SetUnixCD(false);
   return lg;
 }
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index b6adcbb..fa23491 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -21,7 +21,6 @@ cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator()
   this->ForceUnixPaths = true;
   this->ToolSupportsColor = true;
   this->UseLinkScript = false;
-  this->MSYSShell = true;
 }
 
 std::string
@@ -98,7 +97,10 @@ cmLocalGenerator *
 cmGlobalMSYSMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg =
-      new cmLocalUnixMakefileGenerator3(this, parent);
+      new cmLocalUnixMakefileGenerator3(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 ba0790d..c9389aa 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -19,8 +19,6 @@ cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator()
   this->ForceUnixPaths = true;
   this->ToolSupportsColor = true;
   this->UseLinkScript = true;
-  this->WindowsShell = true;
-  this->MinGWMake = true;
 }
 
 void cmGlobalMinGWMakefileGenerator
@@ -37,10 +35,13 @@ cmLocalGenerator *
 cmGlobalMinGWMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg =
-      new cmLocalUnixMakefileGenerator3(this, parent);
+      new cmLocalUnixMakefileGenerator3(parent);
+  lg->SetWindowsShell(true);
+  lg->SetGlobalGenerator(this);
   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 98d7fb4..a3b3dd7 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -19,8 +19,6 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator()
   this->ForceUnixPaths = false;
   this->ToolSupportsColor = true;
   this->UseLinkScript = false;
-  this->WindowsShell = true;
-  this->NMake = true;
 }
 
 void cmGlobalNMakeMakefileGenerator
@@ -51,11 +49,14 @@ cmLocalGenerator *
 cmGlobalNMakeMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg =
-      new cmLocalUnixMakefileGenerator3(this, parent);
+      new cmLocalUnixMakefileGenerator3(parent);
   lg->SetDefineWindowsNULL(true);
+  lg->SetWindowsShell(true);
   lg->SetMakeSilentFlag("/nologo");
+  lg->SetGlobalGenerator(this);
   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 7a26cc0..678d60b 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -487,9 +487,6 @@ 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";
@@ -502,7 +499,9 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
 cmLocalGenerator*
 cmGlobalNinjaGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  return new cmLocalNinjaGenerator(this, parent);
+  cmLocalGenerator* lg = new cmLocalNinjaGenerator(parent);
+  lg->SetGlobalGenerator(this);
+  return lg;
 }
 
 void cmGlobalNinjaGenerator
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index f5731f4..95998ae 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -56,7 +56,9 @@ void cmGlobalUnixMakefileGenerator3
 cmLocalGenerator *
 cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  return new cmLocalUnixMakefileGenerator3(this, parent);
+  cmLocalGenerator* lg = new cmLocalUnixMakefileGenerator3(parent);
+  lg->SetGlobalGenerator(this);
+  return lg;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 04bb6ce..6481ec2 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -311,8 +311,11 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
 cmLocalGenerator *
 cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  return new cmLocalVisualStudio10Generator(
-    cmLocalVisualStudioGenerator::VS10, this, parent);
+  cmLocalVisualStudio10Generator* lg =
+    new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10,
+                                       parent);
+  lg->SetGlobalGenerator(this);
+  return lg;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 36ae0a4..45d6d95 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -240,8 +240,11 @@ void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
 cmLocalGenerator *
 cmGlobalVisualStudio11Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  return new cmLocalVisualStudio10Generator(
-    cmLocalVisualStudioGenerator::VS11, this, parent);
+  cmLocalVisualStudio10Generator* lg =
+    new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11,
+                                       parent);
+  lg->SetGlobalGenerator(this);
+  return lg;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 17b2fc7..e298b06 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -220,8 +220,11 @@ void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout)
 cmLocalGenerator *
 cmGlobalVisualStudio12Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  return new cmLocalVisualStudio10Generator(
-    cmLocalVisualStudioGenerator::VS12, this, parent);
+  cmLocalVisualStudio10Generator* lg =
+    new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS12,
+                                       parent);
+  lg->SetGlobalGenerator(this);
+  return lg;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 90fcc7e..6642d88 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -131,6 +131,9 @@ void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout)
 cmLocalGenerator *
 cmGlobalVisualStudio14Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  return new cmLocalVisualStudio10Generator(
-    cmLocalVisualStudioGenerator::VS14, this, parent);
+  cmLocalVisualStudio10Generator* lg =
+    new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS14,
+                                       parent);
+  lg->SetGlobalGenerator(this);
+  return lg;
 }
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 570314e..55e70b3 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -173,7 +173,9 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
 cmLocalGenerator *
 cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  return new cmLocalVisualStudio6Generator(this, parent);
+  cmLocalGenerator *lg = new cmLocalVisualStudio6Generator(parent);
+  lg->SetGlobalGenerator(this);
+  return lg;
 }
 
 
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 308e858..db34d44 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -30,8 +30,9 @@ cmGlobalVisualStudio71Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalVisualStudio7Generator *lg =
     new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS71,
-                                      this, parent);
+                                      parent);
   lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
+  lg->SetGlobalGenerator(this);
   return lg;
 }
 
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index b78823f..de90f7e 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -255,8 +255,9 @@ cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalVisualStudio7Generator *lg =
     new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS7,
-                                      this, parent);
+                                      parent);
   lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
+  lg->SetGlobalGenerator(this);
   return lg;
 }
 
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index ff9ff10..7174f21 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -130,8 +130,9 @@ cmGlobalVisualStudio8Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalVisualStudio7Generator *lg =
     new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8,
-                                      this, parent);
+                                      parent);
   lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
+  lg->SetGlobalGenerator(this);
   return lg;
 }
 
diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx
index 8adde23..0303c27 100644
--- a/Source/cmGlobalVisualStudio9Generator.cxx
+++ b/Source/cmGlobalVisualStudio9Generator.cxx
@@ -119,8 +119,9 @@ cmGlobalVisualStudio9Generator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalVisualStudio7Generator *lg
     = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9,
-                                        this, parent);
+                                        parent);
   lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
+  lg->SetGlobalGenerator(this);
   return lg;
 }
 
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index b74ba6f..60d545b 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -23,8 +23,6 @@
 //----------------------------------------------------------------------------
 cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator()
 {
-  this->WindowsShell = true;
-  this->WindowsVSIDE = true;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 181178f..77c6474 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -22,10 +22,6 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator()
   this->ToolSupportsColor = true;
   this->NeedSymbolicMark = true;
   this->EmptyRuleHackCommand = "@cd .";
-#ifdef _WIN32
-  this->WindowsShell = true;
-#endif
-  this->WatcomWMake = true;
 }
 
 void cmGlobalWatcomWMakeGenerator
@@ -49,9 +45,14 @@ cmLocalGenerator *
 cmGlobalWatcomWMakeGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
   cmLocalUnixMakefileGenerator3* lg
-      = new cmLocalUnixMakefileGenerator3(this, parent);
+      = new cmLocalUnixMakefileGenerator3(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 4a7411c..742750c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -371,7 +371,9 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
 cmLocalGenerator *
 cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
 {
-  return new cmLocalXCodeGenerator(this, parent);
+  cmLocalGenerator *lg = new cmLocalXCodeGenerator(parent);
+  lg->SetGlobalGenerator(this);
+  return lg;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 3551f83..6dea5c1 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -20,14 +20,15 @@
 
 
 static std::string cmIfCommandError(
-  std::vector<cmExpandedCommandArgument> const& args)
+  cmMakefile* mf, 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 += cmLocalGenerator::EscapeForCMake(i->GetValue());
+    err += lg->EscapeForCMake(i->GetValue());
     }
   err += "\n";
   return err;
@@ -117,7 +118,7 @@ IsFunctionBlocked(const cmListFileFunction& lff,
 
             if (!errorString.empty())
               {
-              std::string err = cmIfCommandError(expandedArguments);
+              std::string err = cmIfCommandError(&mf, expandedArguments);
               err += errorString;
               mf.IssueMessage(messType, err);
               if (messType == cmake::FATAL_ERROR)
@@ -205,7 +206,7 @@ bool cmIfCommand
 
   if (!errorString.empty())
     {
-    std::string err = cmIfCommandError(expandedArguments);
+    std::string err = cmIfCommandError(this->Makefile, expandedArguments);
     err += errorString;
     if (status == cmake::FATAL_ERROR)
       {
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a5f603f..88c88cd 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -43,29 +43,27 @@
 #include <StorageDefs.h>
 #endif
 
-cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
-                                   cmLocalGenerator* parent)
+cmLocalGenerator::cmLocalGenerator(cmLocalGenerator* parent)
 {
-  this->GlobalGenerator = gg;
+  this->Makefile = 0; // moved to after set on global
   this->Parent = parent;
   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);
-
+  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;
   this->Configured = false;
   this->EmitUniversalBinaryFlags = true;
+  this->RelativePathsConfigured = false;
+  this->PathConversionsSetup = false;
   this->BackwardsCompatibility = 0;
   this->BackwardsCompatibilityFinal = false;
 }
@@ -107,7 +105,7 @@ void cmLocalGenerator::Configure()
   static_cast<void>(clg);
 
   // make sure the CMakeFiles dir is there
-  std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory();
+  std::string filesDir = this->Makefile->GetCurrentBinaryDirectory();
   filesDir += cmake::GetCMakeFilesDirectory();
   cmSystemTools::MakeDirectory(filesDir.c_str());
 
@@ -183,7 +181,7 @@ void cmLocalGenerator::ComputeObjectMaxPath()
 void cmLocalGenerator::ReadInputFile()
 {
   // Look for the CMakeLists.txt file.
-  std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory();
+  std::string currentStart = this->Makefile->GetCurrentSourceDirectory();
   currentStart += "/CMakeLists.txt";
   if(cmSystemTools::FileExists(currentStart.c_str(), true))
     {
@@ -200,7 +198,7 @@ void cmLocalGenerator::ReadInputFile()
   cmMakefile* mf = this->Parent->GetMakefile();
   std::ostringstream e;
   e << "The source directory\n"
-    << "  " << this->StateSnapshot.GetCurrentSourceDirectory() << "\n"
+    << "  " << this->Makefile->GetCurrentSourceDirectory() << "\n"
     << "does not contain a CMakeLists.txt file.";
   switch (mf->GetPolicyStatus(cmPolicies::CMP0014))
     {
@@ -227,6 +225,37 @@ void cmLocalGenerator::ReadInputFile()
     }
 }
 
+void cmLocalGenerator::SetupPathConversions()
+{
+  // Setup the current output directory components for use by
+  // Convert
+  std::string outdir;
+  outdir =
+    cmSystemTools::CollapseFullPath(this->Makefile->GetHomeDirectory());
+  cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents);
+  outdir =
+    cmSystemTools::CollapseFullPath(
+                                this->Makefile->GetCurrentSourceDirectory());
+  cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents);
+
+  outdir = cmSystemTools::CollapseFullPath
+    (this->Makefile->GetHomeOutputDirectory());
+  cmSystemTools::SplitPath(outdir,
+                           this->HomeOutputDirectoryComponents);
+
+  outdir = cmSystemTools::CollapseFullPath
+    (this->Makefile->GetCurrentBinaryDirectory());
+  cmSystemTools::SplitPath(outdir,
+                           this->StartOutputDirectoryComponents);
+}
+
+
+void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg)
+{
+  this->GlobalGenerator = gg;
+  this->Makefile = new cmMakefile(this);
+}
+
 void cmLocalGenerator::ConfigureFinalPass()
 {
   this->Makefile->ConfigureFinalPass();
@@ -271,7 +300,7 @@ void cmLocalGenerator::GenerateTestFiles()
   const std::string& config =
     this->Makefile->GetConfigurations(configurationTypes, false);
 
-  std::string file = this->StateSnapshot.GetCurrentBinaryDirectory();
+  std::string file = this->Makefile->GetCurrentBinaryDirectory();
   file += "/";
   file += "CTestTestfile.cmake";
 
@@ -280,9 +309,9 @@ void cmLocalGenerator::GenerateTestFiles()
 
   fout << "# CMake generated Testfile for " << std::endl
        << "# Source directory: "
-       << this->StateSnapshot.GetCurrentSourceDirectory() << std::endl
+       << this->Makefile->GetCurrentSourceDirectory() << std::endl
        << "# Build directory: "
-       << this->StateSnapshot.GetCurrentBinaryDirectory() << std::endl
+       << this->Makefile->GetCurrentBinaryDirectory() << std::endl
        << "# " << std::endl
        << "# This file includes the relevant testing commands "
        << "required for " << std::endl
@@ -396,9 +425,9 @@ void cmLocalGenerator::GenerateInstallRules()
     }
 
   // Create the install script file.
-  std::string file = this->StateSnapshot.GetCurrentBinaryDirectory();
-  std::string homedir = this->GetState()->GetBinaryDirectory();
-  std::string currdir = this->StateSnapshot.GetCurrentBinaryDirectory();
+  std::string file = this->Makefile->GetCurrentBinaryDirectory();
+  std::string homedir = this->Makefile->GetHomeOutputDirectory();
+  std::string currdir = this->Makefile->GetCurrentBinaryDirectory();
   cmSystemTools::ConvertToUnixSlashes(file);
   cmSystemTools::ConvertToUnixSlashes(homedir);
   cmSystemTools::ConvertToUnixSlashes(currdir);
@@ -413,7 +442,7 @@ void cmLocalGenerator::GenerateInstallRules()
 
   // Write the header.
   fout << "# Install script for directory: "
-       << this->StateSnapshot.GetCurrentSourceDirectory()
+       << this->Makefile->GetCurrentSourceDirectory()
        << std::endl << std::endl;
   fout << "# Set the install prefix" << std::endl
        << "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl
@@ -548,16 +577,6 @@ 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,
@@ -632,7 +651,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
     source.GetFullPath(),
     commandLines,
     comment.c_str(),
-    this->StateSnapshot.GetCurrentBinaryDirectory()
+    this->Makefile->GetCurrentBinaryDirectory()
     );
 }
 
@@ -654,12 +673,12 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
        !sf->GetPropertyAsBool("EXTERNAL_OBJECT"))
       {
       std::string dir_max;
-      dir_max += this->StateSnapshot.GetCurrentBinaryDirectory();
+      dir_max += this->Makefile->GetCurrentBinaryDirectory();
       dir_max += "/";
       std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_max);
       if(!obj.empty())
         {
-        std::string ofname = this->StateSnapshot.GetCurrentBinaryDirectory();
+        std::string ofname = this->Makefile->GetCurrentBinaryDirectory();
         ofname += "/";
         ofname += obj;
         objVector.push_back(ofname);
@@ -729,7 +748,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
     "",
     commandLines,
     comment.c_str(),
-    this->StateSnapshot.GetCurrentBinaryDirectory()
+    this->Makefile->GetCurrentBinaryDirectory()
     );
   this->Makefile->GetSource(targetFullPath);
   target.Target->AddSource(targetFullPath);
@@ -1223,7 +1242,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->GlobalGenerator->WindowsShell && result.find(' ') != result.npos &&
+  if(this->WindowsShell && result.find(' ') != result.npos &&
      cmSystemTools::FileExists(remote.c_str()))
     {
     std::string tmp;
@@ -1533,19 +1552,19 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
   if(includeBinaryDir)
     {
     if(emitted.find(
-        this->StateSnapshot.GetCurrentBinaryDirectory()) == emitted.end())
+                this->Makefile->GetCurrentBinaryDirectory()) == emitted.end())
       {
-      dirs.push_back(this->StateSnapshot.GetCurrentBinaryDirectory());
-      emitted.insert(this->StateSnapshot.GetCurrentBinaryDirectory());
+      dirs.push_back(this->Makefile->GetCurrentBinaryDirectory());
+      emitted.insert(this->Makefile->GetCurrentBinaryDirectory());
       }
     }
   if(includeSourceDir)
     {
     if(emitted.find(
-        this->StateSnapshot.GetCurrentSourceDirectory()) == emitted.end())
+                this->Makefile->GetCurrentSourceDirectory()) == emitted.end())
       {
-      dirs.push_back(this->StateSnapshot.GetCurrentSourceDirectory());
-      emitted.insert(this->StateSnapshot.GetCurrentSourceDirectory());
+      dirs.push_back(this->Makefile->GetCurrentSourceDirectory());
+      emitted.insert(this->Makefile->GetCurrentSourceDirectory());
       }
     }
 
@@ -1587,8 +1606,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->GetState()->GetSourceDirectory();
-    const char* topBinaryDir = this->GetState()->GetBinaryDirectory();
+    const char* topSourceDir = this->Makefile->GetHomeDirectory();
+    const char* topBinaryDir = this->Makefile->GetHomeOutputDirectory();
     for(std::vector<std::string>::const_iterator i = includes.begin();
         i != includes.end(); ++i)
       {
@@ -2146,7 +2165,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
 
   // Treat the name as relative to the source directory in which it
   // was given.
-  dep = this->StateSnapshot.GetCurrentSourceDirectory();
+  dep = this->Makefile->GetCurrentSourceDirectory();
   dep += "/";
   dep += inName;
   return true;
@@ -2595,7 +2614,7 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
     {
     // Append the definition with proper escaping.
     std::string def = dflag;
-    if(this->GlobalGenerator->WatcomWMake)
+    if(this->WatcomWMake)
       {
       // The Watcom compiler does its own command line parsing instead
       // of using the windows shell rules.  Definitions are one of
@@ -2698,10 +2717,10 @@ const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot)
 {
   switch (relroot)
     {
-    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();
+    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();
     default: break;
     }
   return 0;
@@ -2713,6 +2732,13 @@ 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;
 
@@ -2722,23 +2748,25 @@ std::string cmLocalGenerator::Convert(const std::string& source,
       {
       case HOME:
         //result = cmSystemTools::CollapseFullPath(result.c_str());
-        result = this->ConvertToRelativePath(
-            this->GetState()->GetSourceDirectoryComponents(), result);
+        result = this->ConvertToRelativePath(this->HomeDirectoryComponents,
+                                             result);
         break;
       case START:
         //result = cmSystemTools::CollapseFullPath(result.c_str());
-        result = this->ConvertToRelativePath(
-            this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result);
+        result = this->ConvertToRelativePath(this->StartDirectoryComponents,
+                                             result);
         break;
       case HOME_OUTPUT:
         //result = cmSystemTools::CollapseFullPath(result.c_str());
-        result = this->ConvertToRelativePath(
-            this->GetState()->GetBinaryDirectoryComponents(), result);
+        result =
+          this->ConvertToRelativePath(this->HomeOutputDirectoryComponents,
+                                      result);
         break;
       case START_OUTPUT:
         //result = cmSystemTools::CollapseFullPath(result.c_str());
-        result = this->ConvertToRelativePath(
-            this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result);
+        result =
+          this->ConvertToRelativePath(this->StartOutputDirectoryComponents,
+                                      result);
         break;
       case FULL:
         result = cmSystemTools::CollapseFullPath(result);
@@ -2765,7 +2793,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->GlobalGenerator->MSYSShell && !this->LinkScriptShell)
+    if(this->MSYSShell && !this->LinkScriptShell)
       {
       if(result.size() > 2 && result[1] == ':')
         {
@@ -2773,7 +2801,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
         result[0] = '/';
         }
       }
-    if(this->GlobalGenerator->WindowsShell)
+    if(this->WindowsShell)
       {
       std::replace(result.begin(), result.end(), '/', '\\');
       }
@@ -2811,6 +2839,69 @@ 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())
+    {
+    std::string parentTop = parent->FindRelativePathTopSource();
+    if(cmSystemTools::IsSubDirectory(
+         this->Makefile->GetCurrentSourceDirectory(), parentTop))
+      {
+      return parentTop;
+      }
+    }
+
+  // Otherwise this directory itself is the new top.
+  return this->Makefile->GetCurrentSourceDirectory();
+}
+
+//----------------------------------------------------------------------------
+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())
+    {
+    std::string parentTop = parent->FindRelativePathTopBinary();
+    if(cmSystemTools::IsSubDirectory(
+         this->Makefile->GetCurrentBinaryDirectory(), parentTop))
+      {
+      return parentTop;
+      }
+    }
+
+  // Otherwise this directory itself is the new top.
+  return this->Makefile->GetCurrentBinaryDirectory();
+}
+
+//----------------------------------------------------------------------------
+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) ||
@@ -2835,19 +2926,26 @@ 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->StateSnapshot.GetRelativePathTopBinary()) &&
+                                   this->RelativePathTopBinary.c_str()) &&
           cmLocalGeneratorNotAbove(in_remote.c_str(),
-              this->StateSnapshot.GetRelativePathTopBinary())) ||
+                                   this->RelativePathTopBinary.c_str())) ||
          (cmLocalGeneratorNotAbove(local_path.c_str(),
-              this->StateSnapshot.GetRelativePathTopSource()) &&
+                                   this->RelativePathTopSource.c_str()) &&
           cmLocalGeneratorNotAbove(in_remote.c_str(),
-              this->StateSnapshot.GetRelativePathTopSource()))))
+                                   this->RelativePathTopSource.c_str()))))
       {
       return in_remote;
       }
@@ -3186,26 +3284,6 @@ 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
@@ -3314,6 +3392,35 @@ 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;
@@ -3349,7 +3456,7 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str,
 
   // Compute the flags for the target shell environment.
   int flags = 0;
-  if(this->GlobalGenerator->WindowsVSIDE)
+  if(this->WindowsVSIDE)
     {
     flags |= cmsysSystem_Shell_Flag_VSIDE;
     }
@@ -3369,27 +3476,27 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str,
     {
     flags |= cmsysSystem_Shell_Flag_WatcomQuote;
     }
-  if(this->GlobalGenerator->WatcomWMake)
+  if(this->WatcomWMake)
     {
     flags |= cmsysSystem_Shell_Flag_WatcomWMake;
     }
-  if(this->GlobalGenerator->MinGWMake)
+  if(this->MinGWMake)
     {
     flags |= cmsysSystem_Shell_Flag_MinGWMake;
     }
-  if(this->GlobalGenerator->NMake)
+  if(this->NMake)
     {
     flags |= cmsysSystem_Shell_Flag_NMake;
     }
 
   // Compute the buffer size needed.
-  int size = (this->GlobalGenerator->WindowsShell ?
+  int size = (this->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->GlobalGenerator->WindowsShell)
+  if(this->WindowsShell)
     {
     cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags);
     }
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index c0da4f6..befddbf 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -13,7 +13,6 @@
 #define cmLocalGenerator_h
 
 #include "cmStandardIncludes.h"
-#include "cmState.h"
 
 class cmMakefile;
 class cmGlobalGenerator;
@@ -34,7 +33,7 @@ class cmCustomCommandGenerator;
 class cmLocalGenerator
 {
 public:
-  cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
+  cmLocalGenerator(cmLocalGenerator* parent);
   virtual ~cmLocalGenerator();
 
   /**
@@ -89,8 +88,8 @@ public:
   const cmGlobalGenerator *GetGlobalGenerator() const {
     return this->GlobalGenerator; }
 
-  cmState* GetState() const;
-  cmState::Snapshot GetStateSnapshot() const;
+  ///! Set the Global Generator, done on creation by the GlobalGenerator
+  void SetGlobalGenerator(cmGlobalGenerator *gg);
 
   /**
    * Convert something to something else. This is a centralized conversion
@@ -299,6 +298,9 @@ 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);
 
@@ -383,11 +385,6 @@ 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,
@@ -435,6 +432,11 @@ protected:
                                               std::string const& dir_max);
   void ComputeObjectMaxPath();
 
+  void ConfigureRelativePaths();
+  std::string FindRelativePathTopSource();
+  std::string FindRelativePathTopBinary();
+  void SetupPathConversions();
+
   virtual std::string ConvertToLinkReference(std::string const& lib,
                                              OutputFormat format = SHELL);
 
@@ -446,24 +448,45 @@ protected:
   void ReadInputFile();
 
   cmMakefile *Makefile;
-  cmState::Snapshot StateSnapshot;
   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;
+  std::vector<std::string> StartOutputDirectoryComponents;
   cmLocalGenerator* Parent;
   std::vector<cmLocalGenerator*> Children;
   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 ForceUnixPath;
+  bool MSYSShell;
   bool LinkScriptShell;
   bool UseRelativePaths;
   bool IgnoreLibPrefix;
   bool Configured;
   bool EmitUniversalBinaryFlags;
-
   // Hack for ExpandRuleVariable until object-oriented version is
   // 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;
+  bool PathConversionsSetup;
+
   cmIML_INT_uint64_t BackwardsCompatibility;
   bool BackwardsCompatibilityFinal;
 private:
diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx
index ddef3f5..fa2a1a5 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -16,9 +16,8 @@
 #include "cmGhsMultiTargetGenerator.h"
 #include "cmGeneratedFileStream.h"
 
-cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
-                                                   cmLocalGenerator* parent)
-  : cmLocalGenerator(gg, parent)
+cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmLocalGenerator* parent)
+  : cmLocalGenerator(parent)
 {
 }
 
diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h
index ec25cba..7afef56 100644
--- a/Source/cmLocalGhsMultiGenerator.h
+++ b/Source/cmLocalGhsMultiGenerator.h
@@ -25,7 +25,7 @@ class cmGeneratedFileStream;
 class cmLocalGhsMultiGenerator : public cmLocalGenerator
 {
 public:
-  cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
+  cmLocalGhsMultiGenerator(cmLocalGenerator* parent);
 
   virtual ~cmLocalGhsMultiGenerator();
 
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index ded4c25..4e817a0 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -22,12 +22,14 @@
 
 #include <assert.h>
 
-cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
-                                             cmLocalGenerator* parent)
-  : cmLocalGenerator(gg, parent)
+cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmLocalGenerator* parent)
+  : cmLocalGenerator(parent)
   , ConfigName("")
   , HomeRelativeOutputPath("")
 {
+#ifdef _WIN32
+  this->WindowsShell = true;
+#endif
   this->TargetImplib = "$TARGET_IMPLIB";
 }
 
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 0b87426..d72677b 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -32,7 +32,7 @@ class cmLocalNinjaGenerator : public cmLocalGenerator
 {
 public:
   /// Default constructor.
-  cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
+  cmLocalNinjaGenerator(cmLocalGenerator* parent);
 
   /// Destructor.
   virtual ~cmLocalNinjaGenerator();
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 54bff7f..bf6fb61 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -80,9 +80,10 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
 
 //----------------------------------------------------------------------------
 cmLocalUnixMakefileGenerator3::
-cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent)
-  : cmLocalGenerator(gg, parent)
+cmLocalUnixMakefileGenerator3(cmLocalGenerator* parent)
+  : cmLocalGenerator(parent)
 {
+  this->WindowsShell = false;
   this->IncludeDirective = "include";
   this->MakefileVariableSize = 0;
   this->IgnoreLibPrefix = false;
@@ -545,11 +546,9 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
   // Setup relative path conversion tops.
   infoFileStream
     << "# Relative path conversion top directories.\n"
-    << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \""
-    << this->StateSnapshot.GetRelativePathTopSource()
+    << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource
     << "\")\n"
-    << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \""
-    << this->StateSnapshot.GetRelativePathTopBinary()
+    << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary
     << "\")\n"
     << "\n";
 
@@ -680,7 +679,7 @@ cmLocalUnixMakefileGenerator3
 
   // Write the list of commands.
   os << cmWrap("\t", commands, "", "\n") << "\n";
-  if(symbolic && !this->IsWatcomWMake())
+  if(symbolic && !this->WatcomWMake)
     {
     os << ".PHONY : " << cmMakeSafe(tgt) << "\n";
     }
@@ -697,7 +696,7 @@ std::string
 cmLocalUnixMakefileGenerator3
 ::ConvertShellCommand(std::string const& cmd, RelativeRoot root)
 {
-  if(this->IsWatcomWMake() &&
+  if(this->WatcomWMake &&
      cmSystemTools::FileIsFullPath(cmd.c_str()) &&
      cmd.find_first_of("( )") != cmd.npos)
     {
@@ -731,7 +730,7 @@ cmLocalUnixMakefileGenerator3
       << "NULL=nul\n"
       << "!ENDIF\n";
     }
-  if(this->IsWindowsShell())
+  if(this->WindowsShell)
     {
      makefileStream
        << "SHELL = cmd.exe\n"
@@ -799,8 +798,7 @@ cmLocalUnixMakefileGenerator3
     makefileStream, "Disable implicit rules so canonical targets will work.",
     ".SUFFIXES", no_depends, no_commands, false);
 
-  if(!this->IsNMake()
-      && !this->IsWatcomWMake() && !this->BorlandMakeCurlyHack)
+  if(!this->NMake && !this->WatcomWMake && !this->BorlandMakeCurlyHack)
     {
     // turn off RCS and SCCS automatic stuff from gmake
     makefileStream
@@ -812,7 +810,7 @@ cmLocalUnixMakefileGenerator3
   depends.push_back(".hpux_make_needs_suffix_list");
   this->WriteMakeRule(makefileStream, 0,
                       ".SUFFIXES", depends, no_commands, false);
-  if(this->IsWatcomWMake())
+  if(this->WatcomWMake)
     {
     // Switch on WMake feature, if an error or interrupt occurs during
     // makefile processing, the current target being made may be deleted
@@ -830,7 +828,7 @@ cmLocalUnixMakefileGenerator3
       << "VERBOSE = 1\n"
       << "\n";
     }
-  if(this->IsWatcomWMake())
+  if(this->WatcomWMake)
     {
     makefileStream <<
       "!ifndef VERBOSE\n"
@@ -964,7 +962,7 @@ cmLocalUnixMakefileGenerator3
 void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
                                                 const std::string& newFlags)
 {
-  if(this->IsWatcomWMake() && !newFlags.empty())
+  if(this->WatcomWMake && !newFlags.empty())
     {
     std::string newf = newFlags;
     if(newf.find("\\\"") != newf.npos)
@@ -1114,7 +1112,7 @@ cmLocalUnixMakefileGenerator3
       //
       bool useCall = false;
 
-      if (this->IsWindowsShell())
+      if (this->WindowsShell)
         {
         std::string suffix;
         if (cmd.size() > 4)
@@ -1181,7 +1179,7 @@ cmLocalUnixMakefileGenerator3
           {
           cmd = "call " + cmd;
           }
-        else if (this->IsNMake() && cmd[0]=='"')
+        else if (this->NMake && cmd[0]=='"')
           {
           cmd = "echo >nul && " + cmd;
           }
@@ -1263,7 +1261,7 @@ cmLocalUnixMakefileGenerator3
         f != files.end(); ++f)
       {
       std::string fc = this->Convert(*f,START_OUTPUT,UNCHANGED);
-      fout << "  " << cmLocalGenerator::EscapeForCMake(fc) << "\n";
+      fout << "  " << this->EscapeForCMake(fc) << "\n";
       }
     fout << ")\n";
     }
@@ -1615,15 +1613,16 @@ cmLocalUnixMakefileGenerator3
       }
 
     // Setup relative path top directories.
+    this->RelativePathsConfigured = true;
     if(const char* relativePathTopSource =
        mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE"))
       {
-      this->StateSnapshot.SetRelativePathTopSource(relativePathTopSource);
+      this->RelativePathTopSource = relativePathTopSource;
       }
     if(const char* relativePathTopBinary =
        mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY"))
       {
-      this->StateSnapshot.SetRelativePathTopBinary(relativePathTopBinary);
+      this->RelativePathTopBinary = relativePathTopBinary;
       }
     }
   else
@@ -2061,7 +2060,7 @@ void cmLocalUnixMakefileGenerator3
           di != defines.end(); ++di)
         {
         cmakefileStream
-          << "  " << cmLocalGenerator::EscapeForCMake(*di) << "\n";
+          << "  " << this->EscapeForCMake(*di) << "\n";
         }
       cmakefileStream
         << "  )\n";
@@ -2114,8 +2113,7 @@ void cmLocalUnixMakefileGenerator3
     for(std::vector<std::string>::const_iterator tri = transformRules.begin();
         tri != transformRules.end(); ++tri)
       {
-      cmakefileStream << "  "
-          << cmLocalGenerator::EscapeForCMake(*tri) << "\n";
+      cmakefileStream << "  " << this->EscapeForCMake(*tri) << "\n";
       }
     cmakefileStream
       << "  )\n";
@@ -2345,7 +2343,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->IsMinGWMake() ? "cd /d " : "cd ";
+  const char* cd_cmd = this->MinGWMake? "cd /d " : "cd ";
 
   if(!this->UnixCD)
     {
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 7b436a5..aee22ec 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -34,8 +34,7 @@ class cmSourceFile;
 class cmLocalUnixMakefileGenerator3 : public cmLocalGenerator
 {
 public:
-  cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg,
-                                cmLocalGenerator* parent);
+  cmLocalUnixMakefileGenerator3(cmLocalGenerator* parent);
   virtual ~cmLocalUnixMakefileGenerator3();
 
   /**
@@ -81,6 +80,36 @@ 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/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 06a3b6c..73a4ec8 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -62,9 +62,8 @@ class cmVS10XMLParser : public cmXMLParser
 
 //----------------------------------------------------------------------------
 cmLocalVisualStudio10Generator
-::cmLocalVisualStudio10Generator(VSVersion v, cmGlobalGenerator* gg,
-                                 cmLocalGenerator* parent):
-  cmLocalVisualStudio7Generator(v, gg, parent)
+::cmLocalVisualStudio10Generator(VSVersion v, cmLocalGenerator* parent):
+  cmLocalVisualStudio7Generator(v, parent)
 {
 }
 
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index 987e08b..f90daa0 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -25,8 +25,7 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator
 {
 public:
   ///! Set cache only and recurse to false by default.
-  cmLocalVisualStudio10Generator(VSVersion v, cmGlobalGenerator* gg,
-                                 cmLocalGenerator* parent);
+  cmLocalVisualStudio10Generator(VSVersion v, cmLocalGenerator* parent);
 
   virtual ~cmLocalVisualStudio10Generator();
 
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 42da639..6d89b15 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -24,9 +24,8 @@
 #include <cmsys/FStream.hxx>
 
 cmLocalVisualStudio6Generator
-::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
-                                cmLocalGenerator* parent):
-  cmLocalVisualStudioGenerator(VS6, gg, parent)
+::cmLocalVisualStudio6Generator(cmLocalGenerator* parent):
+  cmLocalVisualStudioGenerator(VS6, parent)
 {
 }
 
diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h
index a6e0b3d..1a0a614 100644
--- a/Source/cmLocalVisualStudio6Generator.h
+++ b/Source/cmLocalVisualStudio6Generator.h
@@ -29,8 +29,7 @@ class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator
 {
 public:
   ///! Set cache only and recurse to false by default.
-  cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
-                                cmLocalGenerator* parent);
+  cmLocalVisualStudio6Generator(cmLocalGenerator* parent);
 
   virtual ~cmLocalVisualStudio6Generator();
 
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 63c18a7..2152f77 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -55,9 +55,8 @@ static void cmConvertToWindowsSlash(std::string& s)
 
 //----------------------------------------------------------------------------
 cmLocalVisualStudio7Generator
-::cmLocalVisualStudio7Generator(VSVersion v, cmGlobalGenerator* gg,
-                                cmLocalGenerator* parent):
-  cmLocalVisualStudioGenerator(v, gg, parent)
+::cmLocalVisualStudio7Generator(VSVersion v, cmLocalGenerator* parent):
+  cmLocalVisualStudioGenerator(v, parent)
 {
   this->ExtraFlagTable = 0;
   this->Internal = new cmLocalVisualStudio7GeneratorInternals(this);
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 1891369..cfbc63c 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -35,8 +35,7 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
 {
 public:
   ///! Set cache only and recurse to false by default.
-  cmLocalVisualStudio7Generator(VSVersion v, cmGlobalGenerator* gg,
-                                cmLocalGenerator* parent);
+  cmLocalVisualStudio7Generator(VSVersion v, cmLocalGenerator* parent);
 
   virtual ~cmLocalVisualStudio7Generator();
 
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 4a596d5..854ad34 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -19,10 +19,11 @@
 
 //----------------------------------------------------------------------------
 cmLocalVisualStudioGenerator
-::cmLocalVisualStudioGenerator(VSVersion v, cmGlobalGenerator* gg,
-                               cmLocalGenerator* parent)
-  : cmLocalGenerator(gg, parent)
+::cmLocalVisualStudioGenerator(VSVersion v, cmLocalGenerator* parent)
+  : cmLocalGenerator(parent)
 {
+  this->WindowsShell = true;
+  this->WindowsVSIDE = true;
   this->Version = v;
 }
 
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 1152e82..562d595 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -45,8 +45,7 @@ public:
     VS14 = 140
   };
 
-  cmLocalVisualStudioGenerator(VSVersion v, cmGlobalGenerator* gg,
-                               cmLocalGenerator* parent);
+  cmLocalVisualStudioGenerator(VSVersion v, 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 a957c27..1d3a8cf 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -15,9 +15,8 @@
 #include "cmMakefile.h"
 
 //----------------------------------------------------------------------------
-cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg,
-                                             cmLocalGenerator* parent)
-  : cmLocalGenerator(gg, parent)
+cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmLocalGenerator* parent)
+  : cmLocalGenerator(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 54bc6df..1a5760f 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(cmGlobalGenerator* gg, cmLocalGenerator* parent);
+  cmLocalXCodeGenerator(cmLocalGenerator* parent);
 
   virtual ~cmLocalXCodeGenerator();
   virtual std::string GetTargetDirectory(cmTarget const& target) const;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index b448338..82add86 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -153,13 +153,27 @@ public:
 cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
   : Internal(new Internals),
     LocalGenerator(localGenerator),
-    StateSnapshot(localGenerator->GetStateSnapshot())
+    StateSnapshot(localGenerator->GetGlobalGenerator()
+                                ->GetCMakeInstance()->GetState())
 {
   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;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 2ee23d1..a4dad1e 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1118,8 +1118,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
         pi != this->MultipleOutputPairs.end(); ++pi)
       {
       *this->InfoFileStream
-        << "  " << cmLocalGenerator::EscapeForCMake(pi->first)
-        << " "  << cmLocalGenerator::EscapeForCMake(pi->second)
+        << "  " << this->LocalGenerator->EscapeForCMake(pi->first)
+        << " "  << this->LocalGenerator->EscapeForCMake(pi->second)
         << "\n";
       }
     *this->InfoFileStream << "  )\n\n";
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 4965ae3..67a2274 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -197,10 +197,6 @@ void cmState::Initialize()
   this->Locations.clear();
   this->OutputLocations.clear();
   this->ParentPositions.clear();
-  this->CurrentSourceDirectoryComponents.clear();
-  this->CurrentBinaryDirectoryComponents.clear();
-  this->RelativePathTopSource.clear();
-  this->RelativePathTopBinary.clear();
 
   this->CreateSnapshot(Snapshot());
   this->DefineProperty
@@ -462,10 +458,6 @@ 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
@@ -473,19 +465,10 @@ 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
@@ -493,103 +476,12 @@ const char* cmState::GetBinaryDirectory() const
   return this->BinaryDirectory.c_str();
 }
 
-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();
   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);
-  this->RelativePathTopSource.resize(this->RelativePathTopSource.size() + 1);
-  this->RelativePathTopBinary.resize(this->RelativePathTopBinary.size() + 1);
   return cmState::Snapshot(this, pos);
 }
 
@@ -613,11 +505,6 @@ 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]);
-  this->ComputeRelativePathTopSource();
 }
 
 const char* cmState::Snapshot::GetCurrentBinaryDirectory() const
@@ -634,62 +521,4 @@ 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]);
-  this->ComputeRelativePathTopBinary();
-}
-
-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];
-}
-
-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 ? true : false;
-}
-
-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 23d3f0d..d10fae3 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -36,21 +36,6 @@ public:
     const char* GetCurrentBinaryDirectory() const;
     void SetCurrentBinaryDirectory(std::string const& dir);
 
-    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;
@@ -135,9 +120,6 @@ 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;
@@ -147,19 +129,6 @@ private:
   std::vector<std::string> Locations;
   std::vector<std::string> OutputLocations;
   std::vector<PositionType> ParentPositions;
-
-  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;
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 7e11d8c..add80fa 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -82,6 +82,7 @@ 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)
     {
@@ -97,13 +98,13 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
       cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
       std::string emulatorExe(emulatorWithArgs[0]);
       cmSystemTools::ConvertToUnixSlashes(emulatorExe);
-      os << cmLocalGenerator::EscapeForCMake(emulatorExe) << " ";
+      os << lg->EscapeForCMake(emulatorExe) << " ";
       for(std::vector<std::string>::const_iterator ei =
           emulatorWithArgs.begin()+1;
           ei != emulatorWithArgs.end();
           ++ei)
         {
-        os << cmLocalGenerator::EscapeForCMake(*ei) << " ";
+        os << lg->EscapeForCMake(*ei) << " ";
         }
       }
     }
@@ -115,12 +116,11 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
     }
 
   // Generate the command line with full escapes.
-  os << cmLocalGenerator::EscapeForCMake(exe);
+  os << lg->EscapeForCMake(exe);
   for(std::vector<std::string>::const_iterator ci = command.begin()+1;
       ci != command.end(); ++ci)
     {
-    os << " " << cmLocalGenerator::EscapeForCMake(
-                                         ge.Parse(*ci)->Evaluate(mf, config));
+    os << " " << lg->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
-         << " " << cmLocalGenerator::EscapeForCMake(
+         << " " << lg->EscapeForCMake(
            ge.Parse(i->second.GetValue())->Evaluate(mf, config));
       }
     os << ")" << std::endl;
@@ -197,6 +197,8 @@ 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())
     {
@@ -206,7 +208,7 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
         i != pm.end(); ++i)
       {
       fout << " " << i->first
-           << " " << cmLocalGenerator::EscapeForCMake(i->second.GetValue());
+           << " " << lg->EscapeForCMake(i->second.GetValue());
       }
     fout << ")" << std::endl;
     }
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 2f9789d..5c5c428 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2580,9 +2580,6 @@ 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";
diff --git a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt
deleted file mode 100644
index d95bb33..0000000
--- a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-^CMake Error at CTestTestfile.cmake:[0-9]+ \(subdirs\):
-  subdirs called with incorrect number of arguments
-+
-No tests were found!!!$
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index 0cb11ac..22a8d20 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -26,16 +26,3 @@ function(run_repeat_until_fail_tests)
     )
 endfunction()
 run_repeat_until_fail_tests()
-
-function(run_BadCTestTestfile)
-  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BadCTestTestfile)
-  set(RunCMake_TEST_NO_CLEAN 1)
-  file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
-  file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
-  file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
-subdirs()
-")
-
-  run_cmake_command(BadCTestTestfile ${CMAKE_CTEST_COMMAND})
-endfunction()
-run_BadCTestTestfile()

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=685258b3eca572b5292cadc367cb559c231ab0cc
commit 685258b3eca572b5292cadc367cb559c231ab0cc
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu May 7 10:43:58 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu May 7 10:44:16 2015 -0400

    Tests: Add case for 'ctest' run with bad CTestTestfile

diff --git a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt
new file mode 100644
index 0000000..d95bb33
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at CTestTestfile.cmake:[0-9]+ \(subdirs\):
+  subdirs called with incorrect number of arguments
++
+No tests were found!!!$
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index 22a8d20..0cb11ac 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -26,3 +26,16 @@ function(run_repeat_until_fail_tests)
     )
 endfunction()
 run_repeat_until_fail_tests()
+
+function(run_BadCTestTestfile)
+  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BadCTestTestfile)
+  set(RunCMake_TEST_NO_CLEAN 1)
+  file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+  file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+  file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+subdirs()
+")
+
+  run_cmake_command(BadCTestTestfile ${CMAKE_CTEST_COMMAND})
+endfunction()
+run_BadCTestTestfile()

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

Summary of changes:
 Source/CPack/cpack.cxx                      |    2 -
 Source/CTest/cmCTestBuildAndTestHandler.cxx |    2 -
 Source/CTest/cmCTestScriptHandler.cxx       |    2 -
 Source/cmCoreTryCompile.cxx                 |    8 +-
 Source/cmCustomCommandGenerator.cxx         |   31 +--
 Source/cmGlobalBorlandMakefileGenerator.cxx |    5 +-
 Source/cmGlobalBorlandMakefileGenerator.h   |    2 +-
 Source/cmGlobalGenerator.cxx                |   11 +-
 Source/cmGlobalGenerator.h                  |    7 -
 Source/cmGlobalGhsMultiGenerator.cxx        |    3 +-
 Source/cmGlobalJOMMakefileGenerator.cxx     |    7 +-
 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                          |  171 ----------------
 Source/cmState.h                            |   31 ---
 Source/cmTestGenerator.cxx                  |   16 +-
 Source/cmake.cxx                            |    3 -
 53 files changed, 418 insertions(+), 475 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list