[cmake-commits] alex committed cmGlobalGenerator.h 1.79 1.80 cmGlobalGenerator.cxx 1.182 1.183

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Jun 11 15:31:44 EDT 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv23711/Source

Modified Files:
	cmGlobalGenerator.h cmGlobalGenerator.cxx 
Log Message:

ENH: split cmGlobalGenerator::SetLanguageEnabled() in two parts, where the
second part copies the values from the cmake variables into internal maps.
So this can now be done after the compiler-specific information has been
loaded, which can now overwrite more settings.

Alex


Index: cmGlobalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.h,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- cmGlobalGenerator.h	8 Jun 2007 16:42:29 -0000	1.79
+++ cmGlobalGenerator.h	11 Jun 2007 19:31:42 -0000	1.80
@@ -208,6 +208,9 @@
 
   const std::map<cmStdString, std::vector<cmLocalGenerator*> >& GetProjectMap() const {return this->ProjectMap;}
 protected:
+  void SetLanguageEnabledFlag(const char* l, cmMakefile* mf);
+  void SetLanguageEnabledMaps(const char* l, cmMakefile* mf);
+
   // Fill the ProjectMap, this must be called after LocalGenerators 
   // has been populated.
   void FillProjectMap();

Index: cmGlobalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.cxx,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -d -r1.182 -r1.183
--- cmGlobalGenerator.cxx	11 Jun 2007 18:28:31 -0000	1.182
+++ cmGlobalGenerator.cxx	11 Jun 2007 19:31:42 -0000	1.183
@@ -255,6 +255,7 @@
     mf->ReadListFile(0,fpath.c_str());
     }
   std::map<cmStdString, bool> needTestLanguage;
+  std::map<cmStdString, bool> needSetLanguageEnabledMaps;
   // foreach language
   // load the CMakeDetermine(LANG)Compiler.cmake file to find
   // the compiler
@@ -263,6 +264,7 @@
       l != languages.end(); ++l)
     {
     const char* lang = l->c_str();
+    needSetLanguageEnabledMaps[lang] = false;
     if(*l == "NONE")
       {
       this->SetLanguageEnabled("NONE", mf);
@@ -296,7 +298,8 @@
         // if this file was found then the language was already determined
         // to be working
         needTestLanguage[lang] = false;
-        this->SetLanguageEnabled(lang, mf);
+        this->SetLanguageEnabledFlag(lang, mf);
+        needSetLanguageEnabledMaps[lang] = true;
         // this can only be called after loading CMake(LANG)Compiler.cmake
         }
       }
@@ -356,7 +359,8 @@
         cmSystemTools::Error("Could not find cmake module file:",
                              fpath.c_str());
         }
-      this->SetLanguageEnabled(lang, mf);
+      this->SetLanguageEnabledFlag(lang, mf);
+      needSetLanguageEnabledMaps[lang] = true;
       // this can only be called after loading CMake(LANG)Compiler.cmake
       // the language must be enabled for try compile to work, but we do
       // not know if it is a working compiler yet so set the test language
@@ -401,6 +405,11 @@
                              fpath.c_str());
         }
       }
+    if (needSetLanguageEnabledMaps[lang])
+      {
+      this->SetLanguageEnabledMaps(lang, mf);
+      }
+
     // Test the compiler for the language just setup
     // At this point we should have enough info for a try compile
     // which is used in the backward stuff
@@ -527,10 +536,35 @@
 
 void cmGlobalGenerator::SetLanguageEnabled(const char* l, cmMakefile* mf)
 {
-  if(this->LanguageEnabled.count(l) > 0)
+  this->SetLanguageEnabledFlag(l, mf);
+  this->SetLanguageEnabledMaps(l, mf);
+}
+
+void cmGlobalGenerator::SetLanguageEnabledFlag(const char* l, cmMakefile* mf)
+{
+  this->LanguageEnabled[l] = true;
+}
+
+void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf)
+{
+  // use LanguageToLinkerPreference to detect whether this functions has
+  // run before
+  if (this->LanguageToLinkerPreference.find(l) !=
+                                        this->LanguageToLinkerPreference.end())
     {
     return;
     }
+
+  std::string linkerPrefVar = std::string("CMAKE_") +
+    std::string(l) + std::string("_LINKER_PREFERENCE");
+  const char* linkerPref = mf->GetDefinition(linkerPrefVar.c_str());
+  if(!linkerPref)
+    {
+    linkerPref = "None";
+    }
+  this->LanguageToLinkerPreference[l] = linkerPref;
+
+
   std::string outputExtensionVar = std::string("CMAKE_") +
     std::string(l) + std::string("_OUTPUT_EXTENSION");
   const char* outputExtension = mf->GetDefinition(outputExtensionVar.c_str());
@@ -544,15 +578,6 @@
       }
     }
 
-  std::string linkerPrefVar = std::string("CMAKE_") +
-    std::string(l) + std::string("_LINKER_PREFERENCE");
-  const char* linkerPref = mf->GetDefinition(linkerPrefVar.c_str());
-  if(!linkerPref)
-    {
-    linkerPref = "None";
-    }
-  this->LanguageToLinkerPreference[l] = linkerPref;
-
   std::string extensionsVar = std::string("CMAKE_") +
     std::string(l) + std::string("_SOURCE_FILE_EXTENSIONS");
   std::string ignoreExtensionsVar = std::string("CMAKE_") +
@@ -572,9 +597,9 @@
     {
     this->IgnoreExtensions[*i] = true;
     }
-  this->LanguageEnabled[l] = true;
 
 }
+
 bool cmGlobalGenerator::IgnoreFile(const char* l)
 {
   if(this->GetLanguageFromExtension(l))



More information about the Cmake-commits mailing list