Ken Martin 23 years ago
parent
commit
5b0611d709

+ 8 - 0
Source/cmGlobalGenerator.cxx

@@ -19,6 +19,11 @@
 #include "cmake.h"
 #include "cmMakefile.h"
 
+cmGlobalGenerator::cmGlobalGenerator()
+{
+  m_LanguagesEnabled = false;
+}
+
 cmGlobalGenerator::~cmGlobalGenerator()
 {
   // Delete any existing cmLocalGenerators
@@ -62,6 +67,7 @@ void cmGlobalGenerator::Configure()
   // set the Start directories
   lg->GetMakefile()->SetStartDirectory(m_CMakeInstance->GetHomeDirectory());
   lg->GetMakefile()->SetStartOutputDirectory(m_CMakeInstance->GetHomeOutputDirectory());
+  lg->GetMakefile()->MakeStartDirectoriesCurrent();
   
   // now do it
   this->RecursiveConfigure(lg);
@@ -94,6 +100,7 @@ void cmGlobalGenerator::RecursiveConfigure(cmLocalGenerator *lg)
     currentDir += "/";
     currentDir += subdirs[i];
     lg2->GetMakefile()->SetStartDirectory(currentDir.c_str());
+    lg2->GetMakefile()->MakeStartDirectoriesCurrent();
   
     this->RecursiveConfigure(lg2);
     }
@@ -119,6 +126,7 @@ void cmGlobalGenerator::LocalGenerate()
   // set the Start directories
   lg->GetMakefile()->SetStartDirectory(m_CMakeInstance->GetHomeDirectory());
   lg->GetMakefile()->SetStartOutputDirectory(m_CMakeInstance->GetHomeOutputDirectory());
+  lg->GetMakefile()->MakeStartDirectoriesCurrent();
   
   // now do trhe configure
   lg->Configure();

+ 1 - 0
Source/cmGlobalGenerator.h

@@ -34,6 +34,7 @@ class cmGlobalGenerator
 {
 public:
   ///! Free any memory allocated with the GlobalGenerator
+  cmGlobalGenerator();
   virtual ~cmGlobalGenerator();
   
   ///! Create a local generator appropriate to this Global Generator

+ 3 - 1
Source/cmGlobalNMakeMakefileGenerator.cxx

@@ -41,5 +41,7 @@ void cmGlobalNMakeMakefileGenerator::EnableLanguage(const char* lang,
 ///! Create a local generator appropriate to this Global Generator
 cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator()
 {
-  return new cmLocalNMakeMakefileGenerator;
+  cmLocalGenerator *lg = new cmLocalNMakeMakefileGenerator;
+  lg->SetGlobalGenerator(this);
+  return lg;
 }

+ 14 - 0
Source/cmLocalGenerator.cxx

@@ -15,11 +15,14 @@
 
 =========================================================================*/
 #include "cmLocalGenerator.h"
+#include "cmGlobalGenerator.h"
+#include "cmake.h"
 #include "cmMakefile.h"
 
 cmLocalGenerator::cmLocalGenerator()
 {
   m_Makefile = new cmMakefile;
+  m_Makefile->SetLocalGenerator(this);
 }
 
 cmLocalGenerator::~cmLocalGenerator()
@@ -34,3 +37,14 @@ void cmLocalGenerator::Configure()
   currentStart += "/CMakeLists.txt";
   m_Makefile->ReadListFile(currentStart.c_str());
 }
+
+void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg)
+{
+  m_GlobalGenerator = gg; 
+
+  // setup the home directories
+  m_Makefile->SetHomeDirectory(
+    gg->GetCMakeInstance()->GetHomeDirectory());
+  m_Makefile->SetHomeOutputDirectory(
+    gg->GetCMakeInstance()->GetHomeOutputDirectory());
+};

+ 2 - 3
Source/cmLocalGenerator.h

@@ -42,7 +42,7 @@ public:
    * some steps to save time, such as dependency generation for the
    * makefiles. This is done by a direct invocation from make. 
    */
-  virtual void Generate(bool fromTheTop);
+  virtual void Generate(bool fromTheTop) {};
 
   /**
    * Process the CMakeLists files for this directory to fill in the
@@ -59,8 +59,7 @@ public:
     return m_GlobalGenerator; };
 
   ///! Set the Global Generator, done on creation by the GlobalGenerator
-  void SetGlobalGenerator(cmGlobalGenerator *gg) {
-    m_GlobalGenerator = gg; };
+  void SetGlobalGenerator(cmGlobalGenerator *gg);
   
 protected:
   bool m_FromTheTop;