瀏覽代碼

ENH: fix borland make clean targets before build, add new generators for msys and mingw

Bill Hoffman 20 年之前
父節點
當前提交
f6588b7919

+ 1 - 1
Modules/CMakeDetermineCCompiler.cmake

@@ -41,7 +41,7 @@ IF(NOT CMAKE_C_COMPILER)
   SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_INIT} CACHE STRING "C compiler")
 ENDIF(NOT CMAKE_C_COMPILER)
 MARK_AS_ADVANCED(CMAKE_C_COMPILER)  
-FIND_PROGRAM(CMAKE_AR NAMES ar )
+FIND_PROGRAM(CMAKE_AR NAMES ar PATHS /mingw/bin c:/mingw/bin /msys/1.0/bin c:/msys/1.0/bin )
 
 FIND_PROGRAM(CMAKE_RANLIB NAMES ranlib)
 IF(NOT CMAKE_RANLIB)

+ 2 - 0
Modules/CMakeMSYSFindMake.cmake

@@ -0,0 +1,2 @@
+FIND_PROGRAM(CMAKE_MAKE_PROGRAM make PATHS c:/msys/1.0/bin /msys/1.0/bin)
+MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)

+ 2 - 0
Modules/CMakeMinGWFindMake.cmake

@@ -0,0 +1,2 @@
+FIND_PROGRAM(CMAKE_MAKE_PROGRAM mingw32-make.exe PATHS c:/MinGW/bin /MinGW/bin)
+MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)

+ 2 - 0
Source/CMakeLists.txt

@@ -168,6 +168,8 @@ IF (WIN32)
     SET(SRCS ${SRCS}
       cmGlobalBorlandMakefileGenerator.cxx
       cmGlobalNMakeMakefileGenerator.cxx
+      cmGlobalMSYSMakefileGenerator.cxx
+      cmGlobalMinGWMakefileGenerator.cxx
       cmGlobalVisualStudio6Generator.cxx
       cmLocalVisualStudio6Generator.cxx
       cmGlobalBorlandMakefileGenerator.h

+ 2 - 0
Source/cmGlobalBorlandMakefileGenerator.cxx

@@ -43,9 +43,11 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator()
   lg->SetEchoNeedsQuote(false);
   lg->SetIncludeDirective("!include");
   lg->SetWindowsShell(true);
+  lg->SetDefineWindowsNULL(true);
   lg->SetMakefileVariableSize(32);
   lg->SetPassMakeflags(true);
   lg->SetGlobalGenerator(this);
+  lg->SetUnixCD(false);
   return lg;
 }
 

+ 82 - 0
Source/cmGlobalMSYSMakefileGenerator.cxx

@@ -0,0 +1,82 @@
+/*=========================================================================
+
+  Program:   CMake - Cross-Platform Makefile Generator
+  Module:    $RCSfile$
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
+  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even 
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#include "cmGlobalMSYSMakefileGenerator.h"
+#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmMakefile.h"
+#include "cmake.h"
+
+cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator()
+{
+  m_FindMakeProgramFile = "CMakeMSYSFindMake.cmake";
+  m_ForceUnixPaths = true;
+}
+
+void cmGlobalMSYSMakefileGenerator::EnableLanguage(std::vector<std::string>const& l,
+                                                    cmMakefile *mf)
+{
+  this->FindMakeProgram(mf);
+  std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+  std::vector<std::string> locations;
+  locations.push_back(cmSystemTools::GetProgramPath(makeProgram.c_str()));
+  locations.push_back("c:/mingw/bin");
+  locations.push_back("/mingw/bin");
+  locations.push_back("/msys/1.0/bin");
+  locations.push_back("C:/msys/1.0/bin");
+  std::string gcc = "gcc.exe";
+  std::string gxx = "g++.exe";
+  std::string slash = "/";
+  for(std::vector<std::string>::iterator i = locations.begin();
+      i != locations.end(); ++i)
+    {
+    std::string tgcc = *i + slash + gcc;
+    std::string tgxx = *i + slash + gxx;
+    if(cmSystemTools::FileExists(tgcc.c_str()))
+      {
+      gcc = tgcc;
+      gxx = tgxx;
+      break;
+      }
+    }
+  mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
+  mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
+  this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf);
+  if(!mf->IsSet("CMAKE_AR") && !m_CMakeInstance->GetIsInTryCompile())
+    {
+    cmSystemTools::Error("CMAKE_AR was not found, please set to archive program. ",
+                         mf->GetDefinition("CMAKE_AR"));
+    }
+}
+
+///! Create a local generator appropriate to this Global Generator
+cmLocalGenerator *cmGlobalMSYSMakefileGenerator::CreateLocalGenerator()
+{
+  cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
+  lg->SetWindowsShell(false);
+  lg->SetGlobalGenerator(this);
+  lg->SetIgnoreLibPrefix(true);
+  lg->SetPassMakeflags(false);
+  lg->SetUnixCD(true);
+  return lg;
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalMSYSMakefileGenerator::GetDocumentation(cmDocumentationEntry& entry) const
+{
+  entry.name = this->GetName();
+  entry.brief = "Generates MSYS makefiles.";
+  entry.full = "The makefiles use /bin/sh as the shell.  They require msys to be installed on the machine.";
+}

+ 50 - 0
Source/cmGlobalMSYSMakefileGenerator.h

@@ -0,0 +1,50 @@
+/*=========================================================================
+
+  Program:   CMake - Cross-Platform Makefile Generator
+  Module:    $RCSfile$
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
+  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even 
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmGlobalMSYSMakefileGenerator_h
+#define cmGlobalMSYSMakefileGenerator_h
+
+#include "cmGlobalUNIXMakefileGenerator3.h"
+
+/** \class cmGlobalMSYSMakefileGenerator
+ * \brief Write a NMake makefiles.
+ *
+ * cmGlobalMSYSMakefileGenerator manages nmake build process for a tree
+ */
+class cmGlobalMSYSMakefileGenerator : public cmGlobalUnixMakefileGenerator3
+{
+public:
+  cmGlobalMSYSMakefileGenerator();
+  static cmGlobalGenerator* New() { return new cmGlobalMSYSMakefileGenerator; }
+  ///! Get the name for the generator.
+  virtual const char* GetName() const {
+    return cmGlobalMSYSMakefileGenerator::GetActualName();}
+  static const char* GetActualName() {return "MSYS Makefiles";}
+
+  /** Get the documentation entry for this generator.  */
+  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  
+  ///! Create a local generator appropriate to this Global Generator
+  virtual cmLocalGenerator *CreateLocalGenerator();
+
+  /**
+   * Try to determine system infomation such as shared library
+   * extension, pthreads, byte order etc.  
+   */
+  virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
+};
+
+#endif

+ 76 - 0
Source/cmGlobalMinGWMakefileGenerator.cxx

@@ -0,0 +1,76 @@
+/*=========================================================================
+
+  Program:   CMake - Cross-Platform Makefile Generator
+  Module:    $RCSfile$
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
+  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even 
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#include "cmGlobalMinGWMakefileGenerator.h"
+#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmMakefile.h"
+
+cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator()
+{
+  m_FindMakeProgramFile = "CMakeMinGWFindMake.cmake";
+  m_ForceUnixPaths = true;
+  
+}
+
+void cmGlobalMinGWMakefileGenerator::EnableLanguage(std::vector<std::string>const& l,
+                                                    cmMakefile *mf)
+{ 
+  this->FindMakeProgram(mf);
+  std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+  std::vector<std::string> locations;
+  locations.push_back(cmSystemTools::GetProgramPath(makeProgram.c_str()));
+  locations.push_back("c:/mingw/bin");
+  locations.push_back("/mingw/bin");
+  std::string gcc = "gcc.exe";
+  std::string gxx = "g++.exe";
+  std::string slash = "/";
+  for(std::vector<std::string>::iterator i = locations.begin();
+      i != locations.end(); ++i)
+    {
+    std::string tgcc = *i + slash + gcc;
+    std::string tgxx = *i + slash + gxx;
+    if(cmSystemTools::FileExists(tgcc.c_str()))
+      {
+      gcc = tgcc;
+      gxx = tgxx;
+      break;
+      }
+    }
+  mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
+  mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
+  this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf);
+}
+
+///! Create a local generator appropriate to this Global Generator
+cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator()
+{
+  cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
+  lg->SetWindowsShell(true);
+  lg->SetGlobalGenerator(this);
+  lg->SetIgnoreLibPrefix(true);
+  lg->SetPassMakeflags(false);
+  lg->SetUnixCD(true);
+  return lg;
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalMinGWMakefileGenerator::GetDocumentation(cmDocumentationEntry& entry) const
+{
+  entry.name = this->GetName();
+  entry.brief = "Generates a make file for use with mingw32-make.";
+  entry.full = "The makefiles generated use cmd.exe as the shell.  "
+    "They do not require msys or a unix shell.";
+}

+ 50 - 0
Source/cmGlobalMinGWMakefileGenerator.h

@@ -0,0 +1,50 @@
+/*=========================================================================
+
+  Program:   CMake - Cross-Platform Makefile Generator
+  Module:    $RCSfile$
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
+  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even 
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmGlobalMinGWMakefileGenerator_h
+#define cmGlobalMinGWMakefileGenerator_h
+
+#include "cmGlobalUNIXMakefileGenerator3.h"
+
+/** \class cmGlobalMinGWMakefileGenerator
+ * \brief Write a NMake makefiles.
+ *
+ * cmGlobalMinGWMakefileGenerator manages nmake build process for a tree
+ */
+class cmGlobalMinGWMakefileGenerator : public cmGlobalUnixMakefileGenerator3
+{
+public:
+  cmGlobalMinGWMakefileGenerator();
+  static cmGlobalGenerator* New() { return new cmGlobalMinGWMakefileGenerator; }
+  ///! Get the name for the generator.
+  virtual const char* GetName() const {
+    return cmGlobalMinGWMakefileGenerator::GetActualName();}
+  static const char* GetActualName() {return "MinGW Makefiles";}
+
+  /** Get the documentation entry for this generator.  */
+  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  
+  ///! Create a local generator appropriate to this Global Generator
+  virtual cmLocalGenerator *CreateLocalGenerator();
+
+  /**
+   * Try to determine system infomation such as shared library
+   * extension, pthreads, byte order etc.  
+   */
+  virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
+};
+
+#endif

+ 2 - 0
Source/cmGlobalNMakeMakefileGenerator.cxx

@@ -38,11 +38,13 @@ cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator()
 {
   cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
   lg->SetEchoNeedsQuote(false);
+  lg->SetDefineWindowsNULL(true);
   lg->SetWindowsShell(true);
   lg->SetMakeSilentFlag("/nologo");
   lg->SetGlobalGenerator(this);
   lg->SetIgnoreLibPrefix(true);
   lg->SetPassMakeflags(true);
+  lg->SetUnixCD(false);
   return lg;
 }
 

+ 23 - 18
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -51,27 +51,31 @@ void cmGlobalUnixMakefileGenerator3
       cmSystemTools::Error(langComp.c_str(), " not set, after EnableLanguage");
       continue;
       }
-    const char* cc = mf->GetRequiredDefinition(langComp.c_str());
-    path = cmSystemTools::FindProgram(cc);
-    if(path.size() == 0)
+    const char* name = mf->GetRequiredDefinition(langComp.c_str());
+    if(!cmSystemTools::FileIsFullPath(name))
+      {
+      path = cmSystemTools::FindProgram(name);
+      }
+    else
+      {
+      path = name;
+      }
+    if(path.size() == 0 || !cmSystemTools::FileExists(path.c_str()))
       {
       std::string message = "your ";
       message += lang;
-      message += " compiler: ";
-      if(cc)
-        {
-        message +=  cc;
-        }
-      else
-        {
-        message += "(NULL)";
-        }
-      message += " was not found in your path.   "
-        "For CMake to correctly use try compile commands, the compiler must "
-        "be in your path.   Please add the compiler to your PATH environment,"
-        " and re-run CMake.";
-        cmSystemTools::Error(message.c_str());
+      message += " compiler: \"";
+      message +=  name;
+      message += "\" was not found.   Please set ";
+      message += langComp;
+      message += " to a valid compiler path or name.";
+      cmSystemTools::Error(message.c_str());
+      path = name;
       }
+    std::string doc = lang;
+    doc += " compiler.";
+    mf->AddCacheDefinition(langComp.c_str(), path.c_str(),
+                           doc.c_str(), cmCacheManager::FILEPATH);
     }
 }
 
@@ -125,7 +129,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
     
   // Write the do not edit header.
   lg->WriteDisclaimer(makefileStream);
-  
+  // Write out the "special" stuff
+  lg->WriteSpecialTargetsTop(makefileStream);
   // Write the main entry point target.  This must be the VERY first
   // target so that make with no arguments will run it.
   // Just depend on the all target to drive the build.

+ 18 - 2
Source/cmLocalGenerator.cxx

@@ -1604,10 +1604,26 @@ std::string cmLocalGenerator::Convert(const char* source,
     }
   
   // Now convert it to an output path.
-  if (output == MAKEFILE || output == SHELL)
+  if (output == MAKEFILE)
     {
     result = cmSystemTools::ConvertToOutputPath(result.c_str());
     }
-  
+  if( output == SHELL)
+    {
+    // for shell commands if force unix is on, but m_WindowsShell
+    // is true, then turn off force unix paths for the output path
+    // so that the path is windows style and will work with windows
+    // cmd.exe.
+    bool forceOn =  cmSystemTools::GetForceUnixPaths();
+    if(forceOn && m_WindowsShell)
+      {
+      cmSystemTools::SetForceUnixPaths(false);
+      }
+    result = cmSystemTools::ConvertToOutputPath(result.c_str());
+    if(forceOn && m_WindowsShell)
+      {
+      cmSystemTools::SetForceUnixPaths(true);
+      }
+    }
   return result;
 }

+ 1 - 0
Source/cmLocalGenerator.h

@@ -220,6 +220,7 @@ protected:
   std::vector<cmLocalGenerator*> Children;
   std::map<cmStdString, cmStdString> m_LanguageToIncludeFlags;
   bool m_WindowsShell;
+  bool m_ForceUnixPath;
   bool m_UseRelativePaths;
   bool m_IgnoreLibPrefix;
   bool Configured;

+ 38 - 16
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -47,6 +47,8 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3()
   m_IgnoreLibPrefix = false;
   m_PassMakeflags = false;
   m_EchoNeedsQuote = true;
+  m_DefineWindowsNULL = false;
+  m_UnixCD = true;
 }
 
 //----------------------------------------------------------------------------
@@ -329,7 +331,7 @@ cmLocalUnixMakefileGenerator3
     return;
     }
   this->WriteDisclaimer(ruleFileStream);
-  
+  this->WriteSpecialTargetsTop(ruleFileStream);
   this->WriteMakeVariables(ruleFileStream);
   
   // Open the flags file.  This should be copy-if-different because the
@@ -932,7 +934,7 @@ cmLocalUnixMakefileGenerator3
   makefileStream
     << "# Set environment variables for the build.\n"
     << "\n";
-  if(m_WindowsShell)
+  if(m_DefineWindowsNULL)
     {
     makefileStream
       << "!IF \"$(OS)\" == \"Windows_NT\"\n"
@@ -941,12 +943,17 @@ cmLocalUnixMakefileGenerator3
       << "NULL=nul\n"
       << "!ENDIF\n";
     }
+  if(m_WindowsShell)
+    {
+     makefileStream
+       << "SHELL = C:\\WINDOWS\\system32\\cmd.exe\n";
+    }
   else
     {
-    makefileStream
-      << "# The shell in which to execute make rules.\n"
-      << "SHELL = /bin/sh\n"
-      << "\n";
+      makefileStream
+        << "# The shell in which to execute make rules.\n"
+        << "SHELL = /bin/sh\n"
+        << "\n";
     }
 
   if(m_Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"))
@@ -962,7 +969,7 @@ cmLocalUnixMakefileGenerator3
   makefileStream
     << "# The CMake executable.\n"
     << "CMAKE_COMMAND = "
-    << this->Convert(cmakecommand.c_str(), FULL, MAKEFILE).c_str() 
+    << this->Convert(cmakecommand.c_str(), FULL, SHELL).c_str() 
     << "\n"
     << "\n";
   makefileStream
@@ -1392,10 +1399,15 @@ cmLocalUnixMakefileGenerator3
     exeCleanFiles.push_back
       (this->Convert(cleanFullRealName.c_str(),START_OUTPUT,MAKEFILE));
     }
-  }
-  // Add a command to remove any existing files for this executable.
-  this->AppendCleanCommand(commands, exeCleanFiles);
+  } 
 
+  // Add a command to remove any existing files for this executable.
+  std::vector<std::string> commands1;
+  this->AppendCleanCommand(commands1, exeCleanFiles);
+  this->CreateCDCommand(commands1,m_Makefile->GetStartOutputDirectory(),
+                        m_Makefile->GetHomeOutputDirectory()); 
+  commands.insert(commands.end(), commands1.begin(), commands1.end());
+  commands1.clear();
   // Add the pre-build and pre-link rules.
   this->AppendCustomCommands(commands, target.GetPreBuildCommands());
   this->AppendCustomCommands(commands, target.GetPreLinkCommands());
@@ -1406,7 +1418,6 @@ cmLocalUnixMakefileGenerator3
   linkRuleVar += "_LINK_EXECUTABLE";
   std::string linkRule = 
     m_Makefile->GetRequiredDefinition(linkRuleVar.c_str());
-  std::vector<std::string> commands1;
   cmSystemTools::ExpandListArgument(linkRule, commands1);
   this->CreateCDCommand(commands1,m_Makefile->GetStartOutputDirectory(),
                         m_Makefile->GetHomeOutputDirectory());
@@ -1737,17 +1748,19 @@ cmLocalUnixMakefileGenerator3
       (this->Convert(cleanFullSharedName.c_str(),START_OUTPUT,MAKEFILE));
     }
   }
-  
   // Add a command to remove any existing files for this library.
-  this->AppendCleanCommand(commands, libCleanFiles);
-
+  std::vector<std::string> commands1;
+  this->AppendCleanCommand(commands1, libCleanFiles);
+  this->CreateCDCommand(commands1,m_Makefile->GetStartOutputDirectory(),
+                        m_Makefile->GetHomeOutputDirectory());
+  commands.insert(commands.end(), commands1.begin(), commands1.end());
+  commands1.clear();
   // Add the pre-build and pre-link rules.
   this->AppendCustomCommands(commands, target.GetPreBuildCommands());
   this->AppendCustomCommands(commands, target.GetPreLinkCommands());
 
   // Construct the main link rule.
   std::string linkRule = m_Makefile->GetRequiredDefinition(linkRuleVar);
-  std::vector<std::string> commands1;
   cmSystemTools::ExpandListArgument(linkRule, commands1);
   this->CreateCDCommand(commands1,m_Makefile->GetStartOutputDirectory(),
                         m_Makefile->GetHomeOutputDirectory());
@@ -2349,7 +2362,16 @@ cmLocalUnixMakefileGenerator3
       for(unsigned int j=1; j < commandLine.size(); ++j)
         {
         cmd += " ";
+        bool forceOn =  cmSystemTools::GetForceUnixPaths();
+        if(forceOn && m_WindowsShell)
+          {
+          cmSystemTools::SetForceUnixPaths(false);
+          }
         cmd += cmSystemTools::EscapeSpaces(commandLine[j].c_str());
+        if(forceOn && m_WindowsShell)
+          {
+          cmSystemTools::SetForceUnixPaths(true);
+          }
         }
       
       commands1.push_back(cmd);
@@ -3015,7 +3037,7 @@ void cmLocalUnixMakefileGenerator3
     return;
     }
   
-  if(m_WindowsShell)
+  if(!m_UnixCD)
     {
     // On Windows we must perform each step separately and then change
     // back because the shell keeps the working directory between

+ 15 - 0
Source/cmLocalUnixMakefileGenerator3.h

@@ -102,6 +102,19 @@ public:
    */
   void SetWindowsShell(bool v)  {m_WindowsShell = 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.
+   */
+  void SetDefineWindowsNULL(bool v)  {m_DefineWindowsNULL = v;}
+
+  /**
+   * If set to true, cd dir && command is used to 
+   * run commands in a different directory.
+   */
+  void SetUnixCD(bool v)  {m_UnixCD = v;}
+
   /**
    * Set the string used to include one makefile into another default
    * is include.
@@ -345,6 +358,8 @@ private:
   std::string m_MakeSilentFlag;
   std::string m_ExecutableOutputPath;
   std::string m_LibraryOutputPath;
+  bool m_DefineWindowsNULL;
+  bool m_UnixCD;
   bool m_PassMakeflags;
   //==========================================================================
 

+ 7 - 1
Source/cmake.cxx

@@ -47,6 +47,8 @@
 #  endif
 #  include "cmGlobalBorlandMakefileGenerator.h"
 #  include "cmGlobalNMakeMakefileGenerator.h"
+#  include "cmGlobalMSYSMakefileGenerator.h"
+#  include "cmGlobalMinGWMakefileGenerator.h"
 #  include "cmWin32ProcessExecution.h"
 #else
 #endif
@@ -932,9 +934,9 @@ int cmake::CMakeCommand(std::vector<std::string>& args)
       {
       cmake cm;
       cmGlobalGenerator *ggd = cm.CreateGlobalGenerator(args[2].c_str());
-      ggd->SetCMakeInstance(&cm);
       if (ggd)
         {
+        ggd->SetCMakeInstance(&cm);
         std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
         lgd->SetGlobalGenerator(ggd);
         return lgd->ScanDependencies(args)? 0 : 2;
@@ -1541,6 +1543,10 @@ void cmake::AddDefaultGenerators()
     &cmGlobalBorlandMakefileGenerator::New;
   m_Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] =
     &cmGlobalNMakeMakefileGenerator::New;
+  m_Generators[cmGlobalMSYSMakefileGenerator::GetActualName()] =
+    &cmGlobalMSYSMakefileGenerator::New;
+  m_Generators[cmGlobalMinGWMakefileGenerator::GetActualName()] =
+    &cmGlobalMinGWMakefileGenerator::New;
 #endif
   m_Generators[cmGlobalUnixMakefileGenerator3::GetActualName()] =
     &cmGlobalUnixMakefileGenerator3::New;