瀏覽代碼

ENH: enable cxx by default if no languages have been enabled

Bill Hoffman 23 年之前
父節點
當前提交
fd98b0cca0
共有 3 個文件被更改,包括 20 次插入4 次删除
  1. 1 0
      Source/cmMSDotNETGenerator.cxx
  2. 10 4
      Source/cmMSProjectGenerator.cxx
  3. 9 0
      Source/cmUnixMakefileGenerator.cxx

+ 1 - 0
Source/cmMSDotNETGenerator.cxx

@@ -34,6 +34,7 @@ cmMSDotNETGenerator::cmMSDotNETGenerator()
 
 void cmMSDotNETGenerator::GenerateMakefile()
 {
+  this->EnableLanguage("CXX");
   std::string configTypes = m_Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES");
   std::string::size_type start = 0;
   std::string::size_type endpos = 0;

+ 10 - 4
Source/cmMSProjectGenerator.cxx

@@ -28,6 +28,7 @@ cmMSProjectGenerator::cmMSProjectGenerator()
 
 void cmMSProjectGenerator::GenerateMakefile()
 {
+  this->EnableLanguage("CXX");
   if(m_BuildDSW)
     {
     delete m_DSWWriter;
@@ -64,8 +65,13 @@ void cmMSProjectGenerator::EnableLanguage(const char*)
       "CMAKE_ROOT has not been defined, bad GUI or driver program");
     return;
     }
-  std::string fpath = 
-    m_Makefile->GetDefinition("CMAKE_ROOT");
-  fpath += "/Templates/CMakeWindowsSystemConfig.cmake";
-  m_Makefile->ReadListFile(NULL,fpath.c_str());
+  if(!this->GetLanguageEnabled("CXX"))
+    {
+    std::string fpath = 
+      m_Makefile->GetDefinition("CMAKE_ROOT");
+    fpath += "/Templates/CMakeWindowsSystemConfig.cmake";
+    m_Makefile->ReadListFile(NULL,fpath.c_str());
+    this->SetLanguageEnabled("CXX");
+    }
 }
+

+ 9 - 0
Source/cmUnixMakefileGenerator.cxx

@@ -41,6 +41,15 @@ cmUnixMakefileGenerator::~cmUnixMakefileGenerator()
 
 void cmUnixMakefileGenerator::GenerateMakefile()
 {
+  // for backwards compatibility if niether c or cxx is
+  // enabled, the enable cxx
+  if(! (this->GetLanguageEnabled("C") || 
+        this->GetLanguageEnabled("CXX")))
+    {
+    this->EnableLanguage("CXX");
+    }
+  
+
   // suppoirt override in output directories
   if (m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH"))
     {