Browse Source

cmGlobalGenerator: Require a cmake instance in ctor.

It is required anyway, so this makes it explicit.
Stephen Kelly 10 years ago
parent
commit
c7b79aa16a
52 changed files with 124 additions and 149 deletions
  1. 1 2
      Source/CPack/cmCPackGenerator.cxx
  2. 1 2
      Source/CPack/cpack.cxx
  3. 1 2
      Source/CTest/cmCTestLaunch.cxx
  4. 1 2
      Source/CTest/cmCTestScriptHandler.cxx
  5. 1 2
      Source/CTest/cmCTestTestHandler.cxx
  6. 1 2
      Source/cmCTest.cxx
  7. 2 1
      Source/cmGlobalBorlandMakefileGenerator.cxx
  8. 1 1
      Source/cmGlobalBorlandMakefileGenerator.h
  9. 2 7
      Source/cmGlobalGenerator.cxx
  10. 1 4
      Source/cmGlobalGenerator.h
  11. 5 4
      Source/cmGlobalGeneratorFactory.h
  12. 2 2
      Source/cmGlobalGhsMultiGenerator.cxx
  13. 1 1
      Source/cmGlobalGhsMultiGenerator.h
  14. 2 1
      Source/cmGlobalJOMMakefileGenerator.cxx
  15. 1 1
      Source/cmGlobalJOMMakefileGenerator.h
  16. 2 1
      Source/cmGlobalMSYSMakefileGenerator.cxx
  17. 1 1
      Source/cmGlobalMSYSMakefileGenerator.h
  18. 2 1
      Source/cmGlobalMinGWMakefileGenerator.cxx
  19. 1 1
      Source/cmGlobalMinGWMakefileGenerator.h
  20. 2 1
      Source/cmGlobalNMakeMakefileGenerator.cxx
  21. 1 1
      Source/cmGlobalNMakeMakefileGenerator.h
  22. 2 2
      Source/cmGlobalNinjaGenerator.cxx
  23. 1 2
      Source/cmGlobalNinjaGenerator.h
  24. 2 1
      Source/cmGlobalUnixMakefileGenerator3.cxx
  25. 1 1
      Source/cmGlobalUnixMakefileGenerator3.h
  26. 7 10
      Source/cmGlobalVisualStudio10Generator.cxx
  27. 1 1
      Source/cmGlobalVisualStudio10Generator.h
  28. 8 11
      Source/cmGlobalVisualStudio11Generator.cxx
  29. 1 1
      Source/cmGlobalVisualStudio11Generator.h
  30. 7 10
      Source/cmGlobalVisualStudio12Generator.cxx
  31. 1 1
      Source/cmGlobalVisualStudio12Generator.h
  32. 7 10
      Source/cmGlobalVisualStudio14Generator.cxx
  33. 1 1
      Source/cmGlobalVisualStudio14Generator.h
  34. 2 1
      Source/cmGlobalVisualStudio6Generator.cxx
  35. 1 1
      Source/cmGlobalVisualStudio6Generator.h
  36. 2 2
      Source/cmGlobalVisualStudio71Generator.cxx
  37. 2 1
      Source/cmGlobalVisualStudio71Generator.h
  38. 2 1
      Source/cmGlobalVisualStudio7Generator.cxx
  39. 2 1
      Source/cmGlobalVisualStudio7Generator.h
  40. 8 10
      Source/cmGlobalVisualStudio8Generator.cxx
  41. 1 1
      Source/cmGlobalVisualStudio8Generator.h
  42. 9 12
      Source/cmGlobalVisualStudio9Generator.cxx
  43. 1 1
      Source/cmGlobalVisualStudio9Generator.h
  44. 2 1
      Source/cmGlobalVisualStudioGenerator.cxx
  45. 1 1
      Source/cmGlobalVisualStudioGenerator.h
  46. 2 1
      Source/cmGlobalWatcomWMakeGenerator.cxx
  47. 1 1
      Source/cmGlobalWatcomWMakeGenerator.h
  48. 8 6
      Source/cmGlobalXCodeGenerator.cxx
  49. 1 1
      Source/cmGlobalXCodeGenerator.h
  50. 1 2
      Source/cmGraphVizWriter.cxx
  51. 1 2
      Source/cmQtAutoGenerators.cxx
  52. 6 12
      Source/cmake.cxx

+ 1 - 2
Source/CPack/cmCPackGenerator.cxx

@@ -715,8 +715,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
         cm.SetHomeOutputDirectory("");
         cm.AddCMakePaths();
         cm.SetProgressCallback(cmCPackGeneratorProgress, this);
-        cmGlobalGenerator gg;
-        gg.SetCMakeInstance(&cm);
+        cmGlobalGenerator gg(&cm);
         cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
         cmMakefile *mf = lg->GetMakefile();
         std::string realInstallDirectory = tempInstallDirectory;

+ 1 - 2
Source/CPack/cpack.cxx

@@ -201,8 +201,7 @@ int main (int argc, char const* const* argv)
   cminst.SetHomeDirectory("");
   cminst.SetHomeOutputDirectory("");
   cminst.GetState()->RemoveUnscriptableCommands();
-  cmGlobalGenerator cmgg;
-  cmgg.SetCMakeInstance(&cminst);
+  cmGlobalGenerator cmgg(&cminst);
   cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.MakeLocalGenerator());
   cmMakefile* globalMF = cmlg->GetMakefile();
 #if defined(__CYGWIN__)

+ 1 - 2
Source/CTest/cmCTestLaunch.cxx

@@ -752,8 +752,7 @@ void cmCTestLaunch::LoadConfig()
   cmake cm;
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");
-  cmGlobalGenerator gg;
-  gg.SetCMakeInstance(&cm);
+  cmGlobalGenerator gg(&cm);
   cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
   cmMakefile* mf = lg->GetMakefile();
   std::string fname = this->LogDir;

+ 1 - 2
Source/CTest/cmCTestScriptHandler.cxx

@@ -339,8 +339,7 @@ void cmCTestScriptHandler::CreateCMake()
   this->CMake->SetHomeDirectory("");
   this->CMake->SetHomeOutputDirectory("");
   this->CMake->AddCMakePaths();
-  this->GlobalGenerator = new cmGlobalGenerator;
-  this->GlobalGenerator->SetCMakeInstance(this->CMake);
+  this->GlobalGenerator = new cmGlobalGenerator(this->CMake);
 
   this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator();
   this->Makefile = this->LocalGenerator->GetMakefile();

+ 1 - 2
Source/CTest/cmCTestTestHandler.cxx

@@ -1573,8 +1573,7 @@ void cmCTestTestHandler::GetListOfTests()
   cmake cm;
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");
-  cmGlobalGenerator gg;
-  gg.SetCMakeInstance(&cm);
+  cmGlobalGenerator gg(&cm);
   cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
   cmMakefile *mf = lg->GetMakefile();
   mf->AddDefinition("CTEST_CONFIGURATION_TYPE",

+ 1 - 2
Source/cmCTest.cxx

@@ -512,8 +512,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
   cmake cm;
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");
-  cmGlobalGenerator gg;
-  gg.SetCMakeInstance(&cm);
+  cmGlobalGenerator gg(&cm);
   cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
   cmMakefile *mf = lg->GetMakefile();
   if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) )

+ 2 - 1
Source/cmGlobalBorlandMakefileGenerator.cxx

@@ -14,7 +14,8 @@
 #include "cmMakefile.h"
 #include "cmake.h"
 
-cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator()
+cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator(cmake* cm)
+  : cmGlobalUnixMakefileGenerator3(cm)
 {
   this->EmptyRuleHackDepends = "NUL";
   this->FindMakeProgramFile = "CMakeBorlandFindMake.cmake";

+ 1 - 1
Source/cmGlobalBorlandMakefileGenerator.h

@@ -22,7 +22,7 @@
 class cmGlobalBorlandMakefileGenerator : public cmGlobalUnixMakefileGenerator3
 {
 public:
-  cmGlobalBorlandMakefileGenerator();
+  cmGlobalBorlandMakefileGenerator(cmake* cm);
   static cmGlobalGeneratorFactory* NewFactory() {
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalBorlandMakefileGenerator>(); }

+ 2 - 7
Source/cmGlobalGenerator.cxx

@@ -48,7 +48,8 @@
 
 #include <assert.h>
 
-cmGlobalGenerator::cmGlobalGenerator()
+cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
+  : CMakeInstance(cm)
 {
   // By default the .SYMBOLIC dependency is not needed on symbolic rules.
   this->NeedSymbolicMark = false;
@@ -2141,12 +2142,6 @@ inline std::string removeQuotes(const std::string& s)
   return s;
 }
 
-void cmGlobalGenerator::SetCMakeInstance(cmake* cm)
-{
-  // Store a pointer to the cmake object instance.
-  this->CMakeInstance = cm;
-}
-
 void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
 {
   cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();

+ 1 - 4
Source/cmGlobalGenerator.h

@@ -53,7 +53,7 @@ class cmGlobalGenerator
 {
 public:
   ///! Free any memory allocated with the GlobalGenerator
-  cmGlobalGenerator();
+  cmGlobalGenerator(cmake* cm);
   virtual ~cmGlobalGenerator();
 
   cmLocalGenerator* MakeLocalGenerator(cmLocalGenerator* parent = 0);
@@ -158,9 +158,6 @@ public:
                                         const std::string& native,
                                         bool ignoreErrors);
 
-  ///! Set the CMake instance
-  void SetCMakeInstance(cmake *cm);
-
   ///! Get the CMake instance
   cmake *GetCMakeInstance() const { return this->CMakeInstance; }
 

+ 5 - 4
Source/cmGlobalGeneratorFactory.h

@@ -15,6 +15,7 @@
 
 #include "cmStandardIncludes.h"
 
+class cmake;
 class cmGlobalGenerator;
 struct cmDocumentationEntry;
 
@@ -30,7 +31,7 @@ public:
 
   /** Create a GlobalGenerator */
   virtual cmGlobalGenerator* CreateGlobalGenerator(
-      const std::string& n) const = 0;
+      const std::string& n, cmake* cm) const = 0;
 
   /** Get the documentation entry for this factory */
   virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0;
@@ -44,10 +45,10 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory
 {
 public:
   /** Create a GlobalGenerator */
-  virtual cmGlobalGenerator* CreateGlobalGenerator(
-                                              const std::string& name) const {
+  virtual cmGlobalGenerator*
+  CreateGlobalGenerator(const std::string& name, cmake* cm) const {
     if (name != T::GetActualName()) return 0;
-    return new T; }
+    return new T(cm); }
 
   /** Get the documentation entry for this factory */
   virtual void GetDocumentation(cmDocumentationEntry& entry) const {

+ 2 - 2
Source/cmGlobalGhsMultiGenerator.cxx

@@ -21,8 +21,8 @@
 const char *cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj";
 const char *cmGlobalGhsMultiGenerator::DEFAULT_MAKE_PROGRAM = "gbuild";
 
-cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator()
-  : OSDirRelative(false)
+cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm)
+  : cmGlobalGenerator(cm), OSDirRelative(false)
 {
   this->GhsBuildCommandInitialized = false;
 }

+ 1 - 1
Source/cmGlobalGhsMultiGenerator.h

@@ -24,7 +24,7 @@ public:
   /// The default name of GHS MULTI's build file. Typically: monolith.gpj.
   static const char *FILE_EXTENSION;
 
-  cmGlobalGhsMultiGenerator();
+  cmGlobalGhsMultiGenerator(cmake* cm);
   ~cmGlobalGhsMultiGenerator();
 
   static cmGlobalGeneratorFactory *NewFactory()

+ 2 - 1
Source/cmGlobalJOMMakefileGenerator.cxx

@@ -13,7 +13,8 @@
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
 
-cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator()
+cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator(cmake* cm)
+  : cmGlobalUnixMakefileGenerator3(cm)
 {
   this->FindMakeProgramFile = "CMakeJOMFindMake.cmake";
   this->ForceUnixPaths = false;

+ 1 - 1
Source/cmGlobalJOMMakefileGenerator.h

@@ -22,7 +22,7 @@
 class cmGlobalJOMMakefileGenerator : public cmGlobalUnixMakefileGenerator3
 {
 public:
-  cmGlobalJOMMakefileGenerator();
+  cmGlobalJOMMakefileGenerator(cmake* cm);
   static cmGlobalGeneratorFactory* NewFactory() {
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalJOMMakefileGenerator>(); }

+ 2 - 1
Source/cmGlobalMSYSMakefileGenerator.cxx

@@ -15,7 +15,8 @@
 #include "cmake.h"
 #include <cmsys/FStream.hxx>
 
-cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator()
+cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator(cmake* cm)
+  : cmGlobalUnixMakefileGenerator3(cm)
 {
   this->FindMakeProgramFile = "CMakeMSYSFindMake.cmake";
   this->ForceUnixPaths = true;

+ 1 - 1
Source/cmGlobalMSYSMakefileGenerator.h

@@ -22,7 +22,7 @@
 class cmGlobalMSYSMakefileGenerator : public cmGlobalUnixMakefileGenerator3
 {
 public:
-  cmGlobalMSYSMakefileGenerator();
+  cmGlobalMSYSMakefileGenerator(cmake* cm);
   static cmGlobalGeneratorFactory* NewFactory() {
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalMSYSMakefileGenerator>(); }

+ 2 - 1
Source/cmGlobalMinGWMakefileGenerator.cxx

@@ -13,7 +13,8 @@
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
 
-cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator()
+cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm)
+  : cmGlobalUnixMakefileGenerator3(cm)
 {
   this->FindMakeProgramFile = "CMakeMinGWFindMake.cmake";
   this->ForceUnixPaths = true;

+ 1 - 1
Source/cmGlobalMinGWMakefileGenerator.h

@@ -22,7 +22,7 @@
 class cmGlobalMinGWMakefileGenerator : public cmGlobalUnixMakefileGenerator3
 {
 public:
-  cmGlobalMinGWMakefileGenerator();
+  cmGlobalMinGWMakefileGenerator(cmake* cm);
   static cmGlobalGeneratorFactory* NewFactory() {
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalMinGWMakefileGenerator>(); }

+ 2 - 1
Source/cmGlobalNMakeMakefileGenerator.cxx

@@ -13,7 +13,8 @@
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
 
-cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator()
+cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator(cmake* cm)
+  : cmGlobalUnixMakefileGenerator3(cm)
 {
   this->FindMakeProgramFile = "CMakeNMakeFindMake.cmake";
   this->ForceUnixPaths = false;

+ 1 - 1
Source/cmGlobalNMakeMakefileGenerator.h

@@ -22,7 +22,7 @@
 class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3
 {
 public:
-  cmGlobalNMakeMakefileGenerator();
+  cmGlobalNMakeMakefileGenerator(cmake* cm);
   static cmGlobalGeneratorFactory* NewFactory() {
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalNMakeMakefileGenerator>(); }

+ 2 - 2
Source/cmGlobalNinjaGenerator.cxx

@@ -505,8 +505,8 @@ void cmGlobalNinjaGenerator::WriteDefault(std::ostream& os,
 }
 
 
-cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
-  : cmGlobalGenerator()
+cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
+  : cmGlobalGenerator(cm)
   , BuildFileStream(0)
   , RulesFileStream(0)
   , CompileCommandsStream(0)

+ 1 - 2
Source/cmGlobalNinjaGenerator.h

@@ -160,8 +160,7 @@ public:
   bool IsGCCOnWindows() const { return UsingGCCOnWindows; }
 
 public:
-  /// Default constructor.
-  cmGlobalNinjaGenerator();
+  cmGlobalNinjaGenerator(cmake* cm);
 
   /// Convenience method for creating an instance of this class.
   static cmGlobalGeneratorFactory* NewFactory() {

+ 2 - 1
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -20,7 +20,8 @@
 #include "cmGeneratorTarget.h"
 #include "cmAlgorithms.h"
 
-cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3()
+cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3(cmake* cm)
+  : cmGlobalGenerator(cm)
 {
   // This type of makefile always requires unix style paths
   this->ForceUnixPaths = true;

+ 1 - 1
Source/cmGlobalUnixMakefileGenerator3.h

@@ -54,7 +54,7 @@ class cmLocalUnixMakefileGenerator3;
 class cmGlobalUnixMakefileGenerator3 : public cmGlobalGenerator
 {
 public:
-  cmGlobalUnixMakefileGenerator3();
+  cmGlobalUnixMakefileGenerator3(cmake* cm);
   static cmGlobalGeneratorFactory* NewFactory() {
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalUnixMakefileGenerator3>(); }

+ 7 - 10
Source/cmGlobalVisualStudio10Generator.cxx

@@ -42,8 +42,8 @@ class cmGlobalVisualStudio10Generator::Factory
   : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator(
-                                            const std::string& name) const
+  virtual cmGlobalGenerator*
+  CreateGlobalGenerator(const std::string& name, cmake* cm) const
     {
     std::string genName;
     const char* p = cmVS10GenName(name, genName);
@@ -51,20 +51,17 @@ public:
       { return 0; }
     if(!*p)
       {
-      return new cmGlobalVisualStudio10Generator(
-        genName, "");
+      return new cmGlobalVisualStudio10Generator(cm, genName, "");
       }
     if(*p++ != ' ')
       { return 0; }
     if(strcmp(p, "Win64") == 0)
       {
-      return new cmGlobalVisualStudio10Generator(
-        genName, "x64");
+      return new cmGlobalVisualStudio10Generator(cm, genName, "x64");
       }
     if(strcmp(p, "IA64") == 0)
       {
-      return new cmGlobalVisualStudio10Generator(
-        genName, "Itanium");
+      return new cmGlobalVisualStudio10Generator(cm, genName, "Itanium");
       }
     return 0;
     }
@@ -93,9 +90,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory()
 }
 
 //----------------------------------------------------------------------------
-cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
+cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(cmake* cm,
   const std::string& name, const std::string& platformName)
-  : cmGlobalVisualStudio8Generator(name, platformName)
+  : cmGlobalVisualStudio8Generator(cm, name, platformName)
 {
   std::string vc10Express;
   this->ExpressEdition = cmSystemTools::ReadRegistryValue(

+ 1 - 1
Source/cmGlobalVisualStudio10Generator.h

@@ -24,7 +24,7 @@ class cmGlobalVisualStudio10Generator :
   public cmGlobalVisualStudio8Generator
 {
 public:
-  cmGlobalVisualStudio10Generator(const std::string& name,
+  cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name,
     const std::string& platformName);
   static cmGlobalGeneratorFactory* NewFactory();
 

+ 8 - 11
Source/cmGlobalVisualStudio11Generator.cxx

@@ -37,8 +37,8 @@ class cmGlobalVisualStudio11Generator::Factory
   : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator(
-                                                const std::string& name) const
+  virtual cmGlobalGenerator*
+  CreateGlobalGenerator(const std::string& name, cmake* cm) const
     {
     std::string genName;
     const char* p = cmVS11GenName(name, genName);
@@ -46,20 +46,17 @@ public:
       { return 0; }
     if(!*p)
       {
-      return new cmGlobalVisualStudio11Generator(
-        genName, "");
+      return new cmGlobalVisualStudio11Generator(cm, genName, "");
       }
     if(*p++ != ' ')
       { return 0; }
     if(strcmp(p, "Win64") == 0)
       {
-      return new cmGlobalVisualStudio11Generator(
-        genName, "x64");
+      return new cmGlobalVisualStudio11Generator(cm, genName, "x64");
       }
     if(strcmp(p, "ARM") == 0)
       {
-      return new cmGlobalVisualStudio11Generator(
-        genName, "ARM");
+      return new cmGlobalVisualStudio11Generator(cm, genName, "ARM");
       }
 
     std::set<std::string> installedSDKs =
@@ -71,7 +68,7 @@ public:
       }
 
     cmGlobalVisualStudio11Generator* ret =
-      new cmGlobalVisualStudio11Generator(name, p);
+      new cmGlobalVisualStudio11Generator(cm, name, p);
     ret->WindowsCEVersion = "8.00";
     return ret;
     }
@@ -108,9 +105,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory()
 }
 
 //----------------------------------------------------------------------------
-cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
+cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(cmake* cm,
   const std::string& name, const std::string& platformName)
-  : cmGlobalVisualStudio10Generator(name, platformName)
+  : cmGlobalVisualStudio10Generator(cm, name, platformName)
 {
   std::string vc11Express;
   this->ExpressEdition = cmSystemTools::ReadRegistryValue(

+ 1 - 1
Source/cmGlobalVisualStudio11Generator.h

@@ -20,7 +20,7 @@ class cmGlobalVisualStudio11Generator:
   public cmGlobalVisualStudio10Generator
 {
 public:
-  cmGlobalVisualStudio11Generator(const std::string& name,
+  cmGlobalVisualStudio11Generator(cmake* cm, const std::string& name,
     const std::string& platformName);
   static cmGlobalGeneratorFactory* NewFactory();
 

+ 7 - 10
Source/cmGlobalVisualStudio12Generator.cxx

@@ -37,8 +37,8 @@ class cmGlobalVisualStudio12Generator::Factory
   : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator(
-                                                const std::string& name) const
+  virtual cmGlobalGenerator*
+  CreateGlobalGenerator(const std::string& name, cmake* cm) const
     {
     std::string genName;
     const char* p = cmVS12GenName(name, genName);
@@ -46,20 +46,17 @@ public:
       { return 0; }
     if(!*p)
       {
-      return new cmGlobalVisualStudio12Generator(
-        genName, "");
+      return new cmGlobalVisualStudio12Generator(cm, genName, "");
       }
     if(*p++ != ' ')
       { return 0; }
     if(strcmp(p, "Win64") == 0)
       {
-      return new cmGlobalVisualStudio12Generator(
-        genName, "x64");
+      return new cmGlobalVisualStudio12Generator(cm, genName, "x64");
       }
     if(strcmp(p, "ARM") == 0)
       {
-      return new cmGlobalVisualStudio12Generator(
-        genName, "ARM");
+      return new cmGlobalVisualStudio12Generator(cm, genName, "ARM");
       }
     return 0;
     }
@@ -88,9 +85,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory()
 }
 
 //----------------------------------------------------------------------------
-cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
+cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(cmake* cm,
   const std::string& name, const std::string& platformName)
-  : cmGlobalVisualStudio11Generator(name, platformName)
+  : cmGlobalVisualStudio11Generator(cm, name, platformName)
 {
   std::string vc12Express;
   this->ExpressEdition = cmSystemTools::ReadRegistryValue(

+ 1 - 1
Source/cmGlobalVisualStudio12Generator.h

@@ -20,7 +20,7 @@ class cmGlobalVisualStudio12Generator:
   public cmGlobalVisualStudio11Generator
 {
 public:
-  cmGlobalVisualStudio12Generator(const std::string& name,
+  cmGlobalVisualStudio12Generator(cmake* cm, const std::string& name,
     const std::string& platformName);
   static cmGlobalGeneratorFactory* NewFactory();
 

+ 7 - 10
Source/cmGlobalVisualStudio14Generator.cxx

@@ -37,8 +37,8 @@ class cmGlobalVisualStudio14Generator::Factory
   : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator(
-                                                const std::string& name) const
+  virtual cmGlobalGenerator*
+  CreateGlobalGenerator(const std::string& name, cmake* cm) const
     {
     std::string genName;
     const char* p = cmVS14GenName(name, genName);
@@ -46,20 +46,17 @@ public:
       { return 0; }
     if(!*p)
       {
-      return new cmGlobalVisualStudio14Generator(
-        genName, "");
+      return new cmGlobalVisualStudio14Generator(cm, genName, "");
       }
     if(*p++ != ' ')
       { return 0; }
     if(strcmp(p, "Win64") == 0)
       {
-      return new cmGlobalVisualStudio14Generator(
-        genName, "x64");
+      return new cmGlobalVisualStudio14Generator(cm, genName, "x64");
       }
     if(strcmp(p, "ARM") == 0)
       {
-      return new cmGlobalVisualStudio14Generator(
-        genName, "ARM");
+      return new cmGlobalVisualStudio14Generator(cm, genName, "ARM");
       }
     return 0;
     }
@@ -88,9 +85,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory()
 }
 
 //----------------------------------------------------------------------------
-cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator(
+cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator(cmake* cm,
   const std::string& name, const std::string& platformName)
-  : cmGlobalVisualStudio12Generator(name, platformName)
+  : cmGlobalVisualStudio12Generator(cm, name, platformName)
 {
   std::string vc14Express;
   this->ExpressEdition = cmSystemTools::ReadRegistryValue(

+ 1 - 1
Source/cmGlobalVisualStudio14Generator.h

@@ -20,7 +20,7 @@ class cmGlobalVisualStudio14Generator:
   public cmGlobalVisualStudio12Generator
 {
 public:
-  cmGlobalVisualStudio14Generator(const std::string& name,
+  cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name,
     const std::string& platformName);
   static cmGlobalGeneratorFactory* NewFactory();
 

+ 2 - 1
Source/cmGlobalVisualStudio6Generator.cxx

@@ -31,7 +31,8 @@ std::string GetVS6TargetName(const std::string& targetName)
   return name;
 }
 
-cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator()
+cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator(cmake* cm)
+  : cmGlobalVisualStudioGenerator(cm)
 {
   this->MSDevCommandInitialized = false;
   this->Version = VS6;

+ 1 - 1
Source/cmGlobalVisualStudio6Generator.h

@@ -25,7 +25,7 @@ class cmTarget;
 class cmGlobalVisualStudio6Generator : public cmGlobalVisualStudioGenerator
 {
 public:
-  cmGlobalVisualStudio6Generator();
+  cmGlobalVisualStudio6Generator(cmake* cm);
   static cmGlobalGeneratorFactory* NewFactory() {
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalVisualStudio6Generator>(); }

+ 2 - 2
Source/cmGlobalVisualStudio71Generator.cxx

@@ -16,9 +16,9 @@
 #include "cmake.h"
 
 //----------------------------------------------------------------------------
-cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator(
+cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator(cmake* cm,
   const std::string& platformName)
-  : cmGlobalVisualStudio7Generator(platformName)
+  : cmGlobalVisualStudio7Generator(cm, platformName)
 {
   this->ProjectConfigurationSectionName = "ProjectConfiguration";
   this->Version = VS71;

+ 2 - 1
Source/cmGlobalVisualStudio71Generator.h

@@ -23,7 +23,8 @@
 class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator
 {
 public:
-  cmGlobalVisualStudio71Generator(const std::string& platformName = "");
+  cmGlobalVisualStudio71Generator(cmake* cm,
+                                  const std::string& platformName = "");
   static cmGlobalGeneratorFactory* NewFactory() {
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalVisualStudio71Generator>(); }

+ 2 - 1
Source/cmGlobalVisualStudio7Generator.cxx

@@ -44,8 +44,9 @@ static cmVS7FlagTable cmVS7ExtraFlagTable[] =
   {0,0,0,0,0}
 };
 
-cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(
+cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(cmake *cm,
   const std::string& platformName)
+  : cmGlobalVisualStudioGenerator(cm)
 {
   this->IntelProjectVersion = 0;
   this->DevEnvCommandInitialized = false;

+ 2 - 1
Source/cmGlobalVisualStudio7Generator.h

@@ -26,7 +26,8 @@ struct cmIDEFlagTable;
 class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator
 {
 public:
-  cmGlobalVisualStudio7Generator(const std::string& platformName = "");
+  cmGlobalVisualStudio7Generator(cmake* cm,
+                                 const std::string& platformName = "");
   ~cmGlobalVisualStudio7Generator();
 
   static cmGlobalGeneratorFactory* NewFactory() {

+ 8 - 10
Source/cmGlobalVisualStudio8Generator.cxx

@@ -24,8 +24,8 @@ class cmGlobalVisualStudio8Generator::Factory
   : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator(
-                                              const std::string& name) const {
+  virtual cmGlobalGenerator*
+  CreateGlobalGenerator(const std::string& name, cmake* cm) const {
     if(strncmp(name.c_str(), vs8generatorName,
                sizeof(vs8generatorName) - 1) != 0)
       {
@@ -35,8 +35,7 @@ public:
     const char* p = name.c_str() + sizeof(vs8generatorName) - 1;
     if(p[0] == '\0')
       {
-      return new cmGlobalVisualStudio8Generator(
-        name, "");
+      return new cmGlobalVisualStudio8Generator(cm, name, "");
       }
 
     if(p[0] != ' ')
@@ -48,8 +47,7 @@ public:
 
     if(!strcmp(p, "Win64"))
       {
-      return new cmGlobalVisualStudio8Generator(
-        name, "x64");
+      return new cmGlobalVisualStudio8Generator(cm, name, "x64");
       }
 
     cmVisualStudioWCEPlatformParser parser(p);
@@ -59,8 +57,8 @@ public:
       return 0;
       }
 
-    cmGlobalVisualStudio8Generator* ret = new cmGlobalVisualStudio8Generator(
-      name, p);
+    cmGlobalVisualStudio8Generator* ret =
+        new cmGlobalVisualStudio8Generator(cm, name, p);
     ret->WindowsCEVersion = parser.GetOSVersion();
     return ret;
   }
@@ -95,9 +93,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory()
 }
 
 //----------------------------------------------------------------------------
-cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
+cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(cmake* cm,
   const std::string& name, const std::string& platformName)
-  : cmGlobalVisualStudio71Generator(platformName)
+  : cmGlobalVisualStudio71Generator(cm, platformName)
 {
   this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
   this->Name = name;

+ 1 - 1
Source/cmGlobalVisualStudio8Generator.h

@@ -23,7 +23,7 @@
 class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator
 {
 public:
-  cmGlobalVisualStudio8Generator(const std::string& name,
+  cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name,
     const std::string& platformName);
   static cmGlobalGeneratorFactory* NewFactory();
 

+ 9 - 12
Source/cmGlobalVisualStudio9Generator.cxx

@@ -22,8 +22,8 @@ class cmGlobalVisualStudio9Generator::Factory
   : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator(
-                                              const std::string& name) const {
+  virtual cmGlobalGenerator*
+  CreateGlobalGenerator(const std::string& name, cmake* cm) const {
     if(strncmp(name.c_str(), vs9generatorName,
                sizeof(vs9generatorName) - 1) != 0)
       {
@@ -33,8 +33,7 @@ public:
     const char* p = name.c_str() + sizeof(vs9generatorName) - 1;
     if(p[0] == '\0')
       {
-      return new cmGlobalVisualStudio9Generator(
-        name, "");
+      return new cmGlobalVisualStudio9Generator(cm, name, "");
       }
 
     if(p[0] != ' ')
@@ -46,14 +45,12 @@ public:
 
     if(!strcmp(p, "IA64"))
       {
-      return new cmGlobalVisualStudio9Generator(
-        name, "Itanium");
+      return new cmGlobalVisualStudio9Generator(cm, name, "Itanium");
       }
 
     if(!strcmp(p, "Win64"))
       {
-      return new cmGlobalVisualStudio9Generator(
-        name, "x64");
+      return new cmGlobalVisualStudio9Generator(cm, name, "x64");
       }
 
     cmVisualStudioWCEPlatformParser parser(p);
@@ -63,8 +60,8 @@ public:
       return 0;
       }
 
-    cmGlobalVisualStudio9Generator* ret = new cmGlobalVisualStudio9Generator(
-      name, p);
+    cmGlobalVisualStudio9Generator* ret =
+        new cmGlobalVisualStudio9Generator(cm, name, p);
     ret->WindowsCEVersion = parser.GetOSVersion();
     return ret;
   }
@@ -100,9 +97,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory()
 }
 
 //----------------------------------------------------------------------------
-cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator(
+cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator(cmake* cm,
   const std::string& name, const std::string& platformName)
-  : cmGlobalVisualStudio8Generator(name, platformName)
+  : cmGlobalVisualStudio8Generator(cm, name, platformName)
 {
   this->Version = VS9;
 }

+ 1 - 1
Source/cmGlobalVisualStudio9Generator.h

@@ -24,7 +24,7 @@ class cmGlobalVisualStudio9Generator :
   public cmGlobalVisualStudio8Generator
 {
 public:
-  cmGlobalVisualStudio9Generator(const std::string& name,
+  cmGlobalVisualStudio9Generator(cmake* cm, const std::string& name,
     const std::string& platformName);
   static cmGlobalGeneratorFactory* NewFactory();
 

+ 2 - 1
Source/cmGlobalVisualStudioGenerator.cxx

@@ -21,7 +21,8 @@
 #include <cmsys/Encoding.hxx>
 
 //----------------------------------------------------------------------------
-cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator()
+cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm)
+  : cmGlobalGenerator(cm)
 {
   this->WindowsShell = true;
   this->WindowsVSIDE = true;

+ 1 - 1
Source/cmGlobalVisualStudioGenerator.h

@@ -38,7 +38,7 @@ public:
     VS14 = 140
   };
 
-  cmGlobalVisualStudioGenerator();
+  cmGlobalVisualStudioGenerator(cmake* cm);
   virtual ~cmGlobalVisualStudioGenerator();
 
   VSVersion GetVersion() const;

+ 2 - 1
Source/cmGlobalWatcomWMakeGenerator.cxx

@@ -13,7 +13,8 @@
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
 
-cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator()
+cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm)
+  : cmGlobalUnixMakefileGenerator3(cm)
 {
   this->FindMakeProgramFile = "CMakeFindWMake.cmake";
 #ifdef _WIN32

+ 1 - 1
Source/cmGlobalWatcomWMakeGenerator.h

@@ -22,7 +22,7 @@
 class cmGlobalWatcomWMakeGenerator : public cmGlobalUnixMakefileGenerator3
 {
 public:
-  cmGlobalWatcomWMakeGenerator();
+  cmGlobalWatcomWMakeGenerator(cmake* cm);
   static cmGlobalGeneratorFactory* NewFactory() {
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalWatcomWMakeGenerator>(); }

+ 8 - 6
Source/cmGlobalXCodeGenerator.cxx

@@ -117,8 +117,8 @@ public:
 class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator(
-                                              const std::string& name) const;
+  virtual cmGlobalGenerator*
+  CreateGlobalGenerator(const std::string& name, cmake* cm) const;
 
   virtual void GetDocumentation(cmDocumentationEntry& entry) const {
     cmGlobalXCodeGenerator::GetDocumentation(entry); }
@@ -128,7 +128,9 @@ public:
 };
 
 //----------------------------------------------------------------------------
-cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version)
+cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(cmake* cm,
+                                               std::string const& version)
+  : cmGlobalGenerator(cm)
 {
   this->VersionString = version;
 
@@ -154,7 +156,7 @@ cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory()
 
 //----------------------------------------------------------------------------
 cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
-::CreateGlobalGenerator(const std::string& name) const
+::CreateGlobalGenerator(const std::string& name, cmake* cm) const
 {
   if (name != GetActualName())
     return 0;
@@ -187,7 +189,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
       ("/Developer/Applications/Xcode.app/Contents/version.plist");
     }
   cmsys::auto_ptr<cmGlobalXCodeGenerator>
-    gg(new cmGlobalXCodeGenerator(parser.Version));
+    gg(new cmGlobalXCodeGenerator(cm, parser.Version));
   if (gg->XcodeVersion == 20)
     {
     cmSystemTools::Message("Xcode 2.0 not really supported by cmake, "
@@ -198,7 +200,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
 #else
   std::cerr << "CMake should be built with cmake to use Xcode, "
     "default to Xcode 1.5\n";
-  return new cmGlobalXCodeGenerator;
+  return new cmGlobalXCodeGenerator(cm);
 #endif
 }
 

+ 1 - 1
Source/cmGlobalXCodeGenerator.h

@@ -29,7 +29,7 @@ class cmSourceGroup;
 class cmGlobalXCodeGenerator : public cmGlobalGenerator
 {
 public:
-  cmGlobalXCodeGenerator(std::string const& version);
+  cmGlobalXCodeGenerator(cmake* cm, std::string const& version);
   static cmGlobalGeneratorFactory* NewFactory();
 
   ///! Get the name for the generator.

+ 1 - 2
Source/cmGraphVizWriter.cxx

@@ -67,8 +67,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
   cmake cm;
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");
-  cmGlobalGenerator ggi;
-  ggi.SetCMakeInstance(&cm);
+  cmGlobalGenerator ggi(&cm);
   cmsys::auto_ptr<cmLocalGenerator> lg(ggi.MakeLocalGenerator());
   cmMakefile *mf = lg->GetMakefile();
 

+ 1 - 2
Source/cmQtAutoGenerators.cxx

@@ -1210,8 +1210,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
   cmake cm;
   cm.SetHomeOutputDirectory(targetDirectory);
   cm.SetHomeDirectory(targetDirectory);
-  cmGlobalGenerator gg;
-  gg.SetCMakeInstance(&cm);
+  cmGlobalGenerator gg(&cm);
 
   cmLocalGenerator* lg = gg.MakeLocalGenerator();
   lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory);

+ 6 - 12
Source/cmake.cxx

@@ -363,8 +363,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
   // if a generator was not specified use a generic one
   if (!gg)
     {
-    gg = new cmGlobalGenerator;
-    gg->SetCMakeInstance(this);
+    gg = new cmGlobalGenerator(this);
     created = true;
     }
 
@@ -412,8 +411,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
     (cmSystemTools::GetCurrentWorkingDirectory());
 
   // if a generator was not yet created, temporarily create one
-  cmGlobalGenerator *gg = new cmGlobalGenerator;
-  gg->SetCMakeInstance(this);
+  cmGlobalGenerator *gg = new cmGlobalGenerator(this);
   this->SetGlobalGenerator(gg);
 
   // read in the list file to fill the cache
@@ -952,7 +950,7 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
   for (RegisteredGeneratorsVector::const_iterator i =
     this->Generators.begin(); i != this->Generators.end(); ++i)
     {
-    generator = (*i)->CreateGlobalGenerator(name);
+    generator = (*i)->CreateGlobalGenerator(name, this);
     if (generator)
       {
       break;
@@ -961,7 +959,6 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
 
   if (generator)
     {
-    generator->SetCMakeInstance(this);
     generator->SetExternalMakefileProjectGenerator(extraGenerator);
     }
   else
@@ -1046,8 +1043,6 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)
     {
     this->CCEnvironment = "";
     }
-  // set the cmake instance just to be sure
-  gg->SetCMakeInstance(this);
 }
 
 int cmake::DoPreConfigureChecks()
@@ -1300,12 +1295,12 @@ int cmake::ActualConfigure()
         = this->CreateGlobalGenerator(installedCompiler.c_str());
       if(!gen)
         {
-        gen = new cmGlobalNMakeMakefileGenerator;
+        gen = new cmGlobalNMakeMakefileGenerator(this);
         }
       this->SetGlobalGenerator(gen);
       std::cout << "-- Building for: " << gen->GetName() << "\n";
 #else
-      this->SetGlobalGenerator(new cmGlobalUnixMakefileGenerator3);
+      this->SetGlobalGenerator(new cmGlobalUnixMakefileGenerator3(this));
 #endif
       }
     if(!this->GlobalGenerator)
@@ -1918,8 +1913,7 @@ int cmake::CheckBuildSystem()
   cmake cm;
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");
-  cmGlobalGenerator gg;
-  gg.SetCMakeInstance(&cm);
+  cmGlobalGenerator gg(&cm);
   cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
   cmMakefile* mf = lg->GetMakefile();
   if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||