Browse Source

ENH: try to initialize all languages at the same time

Bill Hoffman 21 years ago
parent
commit
731369ef9c

+ 2 - 1
Source/cmGlobalBorlandMakefileGenerator.cxx

@@ -24,7 +24,8 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator()
   m_ForceUnixPaths = false;
   m_ForceUnixPaths = false;
 }
 }
 
 
-void cmGlobalBorlandMakefileGenerator::EnableLanguage(const char* l,
+
+void cmGlobalBorlandMakefileGenerator::EnableLanguage(std::vector<std::string>const& l,
                                                       cmMakefile *mf)
                                                       cmMakefile *mf)
 {
 {
   std::string outdir = m_CMakeInstance->GetStartOutputDirectory();
   std::string outdir = m_CMakeInstance->GetStartOutputDirectory();

+ 1 - 1
Source/cmGlobalBorlandMakefileGenerator.h

@@ -45,7 +45,7 @@ public:
    * Try to determine system infomation such as shared library
    * Try to determine system infomation such as shared library
    * extension, pthreads, byte order etc.  
    * extension, pthreads, byte order etc.  
    */
    */
-  virtual void EnableLanguage(const char*,cmMakefile *mf);
+  virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
 };
 };
 
 
 #endif
 #endif

+ 1 - 1
Source/cmGlobalCodeWarriorGenerator.cxx

@@ -20,7 +20,7 @@
 #include "cmake.h"
 #include "cmake.h"
 #include "cmTarget.h"
 #include "cmTarget.h"
 
 
-void cmGlobalCodeWarriorGenerator::EnableLanguage(const char*, 
+void cmGlobalCodeWarriorGenerator::EnableLanguage(std::vector<std::string>const& l,
                                                   cmMakefile *mf)
                                                   cmMakefile *mf)
 {
 {
   // now load the settings
   // now load the settings

+ 1 - 1
Source/cmGlobalCodeWarriorGenerator.h

@@ -46,7 +46,7 @@ public:
    * Try to determine system infomation such as shared library
    * Try to determine system infomation such as shared library
    * extension, pthreads, byte order etc.  
    * extension, pthreads, byte order etc.  
    */
    */
-  virtual void EnableLanguage(const char*, cmMakefile *mf);
+  virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
 
 
   /**
   /**
    * Try running cmake and building a file. This is used for dynalically
    * Try running cmake and building a file. This is used for dynalically

+ 111 - 99
Source/cmGlobalGenerator.cxx

@@ -98,10 +98,10 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
 
 
 
 
 // enable the given language
 // enable the given language
-void cmGlobalGenerator::EnableLanguage(const char* lang, 
+void cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
                                        cmMakefile *mf)
                                        cmMakefile *mf)
 {  
 {  
-  if(!lang)
+  if(languages.size() == 0)
     {
     {
     cmSystemTools::Error("EnableLanguage must have a lang specified!");
     cmSystemTools::Error("EnableLanguage must have a lang specified!");
     cmSystemTools::SetFatalErrorOccured();
     cmSystemTools::SetFatalErrorOccured();
@@ -126,7 +126,7 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
 
 
   // **** Step 2, Load the CMakeDetermineSystem.cmake file and find out
   // **** Step 2, Load the CMakeDetermineSystem.cmake file and find out
   // what platform we are running on
   // what platform we are running on
-  if (!isLocal && !this->GetLanguageEnabled(lang))
+  if (!isLocal &&  !mf->GetDefinition("CMAKE_SYSTEM_NAME"))
     {
     {
 #if defined(_WIN32) && !defined(__CYGWIN__) 
 #if defined(_WIN32) && !defined(__CYGWIN__) 
     /* Windows version number data.  */
     /* Windows version number data.  */
@@ -151,65 +151,72 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
     fpath += "/CMakeSystem.cmake";
     fpath += "/CMakeSystem.cmake";
     mf->ReadListFile(0,fpath.c_str());
     mf->ReadListFile(0,fpath.c_str());
     }
     }
-  // **** Step 4, load the CMakeDetermine(LANG)Compiler.cmake file to find
-  // the compiler
-  if(!isLocal && !this->GetLanguageEnabled(lang) )
-    {  
-    if (m_CMakeInstance->GetIsInTryCompile())
-      {
-      cmSystemTools::Error("This should not have happen. "
-                           "If you see this message, you are probably using a "
-                           "broken CMakeLists.txt file or a problematic release of "
-                           "CMake");
-      }
-    needTestLanguage = true; // must test a language after finding it
-    // read determine LANG compiler
-    std::string determinCompiler = "CMakeDetermine";
-    determinCompiler += lang;
-    determinCompiler += "Compiler.cmake";
-    std::string determineFile = mf->GetModulesFile(determinCompiler.c_str());
-    if(!mf->ReadListFile(0,determineFile.c_str()))
-      {
-      cmSystemTools::Error("Could not find cmake module file:", determineFile.c_str());
+  // **** Step 4, foreach language 
+  // load the CMakeDetermine(LANG)Compiler.cmake file to find
+  // the compiler 
+  for(std::vector<std::string>::const_iterator l = languages.begin();
+      l != languages.end(); ++l)
+    {
+    const char* lang = l->c_str();
+    if(!isLocal && !this->GetLanguageEnabled(lang) )
+      {  
+      if (m_CMakeInstance->GetIsInTryCompile())
+        {
+        cmSystemTools::Error("This should not have happen. "
+                             "If you see this message, you are probably using a "
+                             "broken CMakeLists.txt file or a problematic release of "
+                             "CMake");
+        }
+      needTestLanguage = true; // must test a language after finding it
+      // read determine LANG compiler
+      std::string determinCompiler = "CMakeDetermine";
+      determinCompiler += lang;
+      determinCompiler += "Compiler.cmake";
+      std::string determineFile = mf->GetModulesFile(determinCompiler.c_str());
+      if(!mf->ReadListFile(0,determineFile.c_str()))
+        {
+        cmSystemTools::Error("Could not find cmake module file:", determineFile.c_str());
+        }
+      
+      this->SetLanguageEnabled(lang);
+      // put ${CMake_(LANG)_COMPILER_ENV_VAR}=${CMAKE_(LANG)_COMPILER into the
+      // environment, in case user scripts want to run configure, or sub cmakes
+      std::string compilerName = "CMAKE_";
+      compilerName += lang;
+      compilerName += "_COMPILER";
+      std::string compilerEnv = "CMAKE_";
+      compilerEnv += lang;
+      compilerEnv += "_COMPILER_ENV_VAR";
+      std::string envVar = mf->GetRequiredDefinition(compilerEnv.c_str());
+      std::string envVarValue = mf->GetRequiredDefinition(compilerName.c_str());
+      std::string env = envVar;
+      env += "=";
+      env += envVarValue;
+      cmSystemTools::PutEnv(env.c_str());
       }
       }
-    
-    this->SetLanguageEnabled(lang);
-    // put ${CMake_(LANG)_COMPILER_ENV_VAR}=${CMAKE_(LANG)_COMPILER into the
-    // environment, in case user scripts want to run configure, or sub cmakes
-    std::string compilerName = "CMAKE_";
-    compilerName += lang;
-    compilerName += "_COMPILER";
-    std::string compilerEnv = "CMAKE_";
-    compilerEnv += lang;
-    compilerEnv += "_COMPILER_ENV_VAR";
-    std::string envVar = mf->GetRequiredDefinition(compilerEnv.c_str());
-    std::string envVarValue = mf->GetRequiredDefinition(compilerName.c_str());
-    std::string env = envVar;
-    env += "=";
-    env += envVarValue;
-    cmSystemTools::PutEnv(env.c_str());
-    } 
 
 
-  // **** Step 5, Load the configured language compiler file, if not loaded.
-  // look to see if CMAKE_(LANG)_COMPILER_LOADED is set, 
-  // if not then load the CMake(LANG)Compiler.cmake file from the
-  // binary tree, this is a configured file provided by
-  // CMakeDetermine(LANG)Compiler.cmake
-  std::string loadedLang = "CMAKE_";
-  loadedLang +=  lang;
-  loadedLang += "_COMPILER_LOADED";
-  if(!mf->GetDefinition(loadedLang.c_str()))
-    {
-    fpath = rootBin;
-    fpath += "/CMake";
-    fpath += lang;
-    fpath += "Compiler.cmake";
-    if(!mf->ReadListFile(0,fpath.c_str()))
+    // **** Step 5, Load the configured language compiler file, if not loaded.
+    // look to see if CMAKE_(LANG)_COMPILER_LOADED is set, 
+    // if not then load the CMake(LANG)Compiler.cmake file from the
+    // binary tree, this is a configured file provided by
+    // CMakeDetermine(LANG)Compiler.cmake
+    std::string loadedLang = "CMAKE_";
+    loadedLang +=  lang;
+    loadedLang += "_COMPILER_LOADED";
+    if(!mf->GetDefinition(loadedLang.c_str()))
       {
       {
-      cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
+      fpath = rootBin;
+      fpath += "/CMake";
+      fpath += lang;
+      fpath += "Compiler.cmake";
+      if(!mf->ReadListFile(0,fpath.c_str()))
+        {
+        cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
+        }
+      this->SetLanguageEnabled(lang);
       }
       }
-    this->SetLanguageEnabled(lang);
     }
     }
+  
   // **** Step 6, Load the system specific information if not yet loaded
   // **** Step 6, Load the system specific information if not yet loaded
   if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED"))
   if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED"))
     {
     {
@@ -219,60 +226,65 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
       cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
       cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
       }
       }
     }
     }
-  std::string langLoadedVar = "CMAKE_";
-  langLoadedVar += lang;
-  langLoadedVar += "_INFORMATION_LOADED";
-  if (!mf->GetDefinition(langLoadedVar.c_str()))
-    { 
-    fpath = "CMake";
-    fpath +=  lang;
-    fpath += "Information.cmake";
-    fpath = mf->GetModulesFile(fpath.c_str());
-    if(!mf->ReadListFile(0,fpath.c_str()))
-      {
-      cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
+  for(std::vector<std::string>::const_iterator l = languages.begin();
+      l != languages.end(); ++l)
+    {
+    const char* lang = l->c_str();
+    std::string langLoadedVar = "CMAKE_";
+    langLoadedVar += lang;
+    langLoadedVar += "_INFORMATION_LOADED";
+    if (!mf->GetDefinition(langLoadedVar.c_str()))
+      { 
+      fpath = "CMake";
+      fpath +=  lang;
+      fpath += "Information.cmake";
+      fpath = mf->GetModulesFile(fpath.c_str());
+      if(!mf->ReadListFile(0,fpath.c_str()))
+        {
+        cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
+        }
       }
       }
-    }
   
   
- // **** Step 7, 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
-  if(!isLocal)
-    {
-    if(needTestLanguage)
+    // **** Step 7, 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
+    if(!isLocal)
       {
       {
-      if (!m_CMakeInstance->GetIsInTryCompile())
+      if(needTestLanguage)
         {
         {
-        std::string testLang = "CMakeTest";
-        testLang += lang;
-        testLang += "Compiler.cmake";
-        std::string ifpath = mf->GetModulesFile(testLang.c_str());
-        if(!mf->ReadListFile(0,ifpath.c_str()))
+        if (!m_CMakeInstance->GetIsInTryCompile())
           {
           {
-          cmSystemTools::Error("Could not find cmake module file:", ifpath.c_str());
-          }
-        // **** Step 8, load backwards compatibility stuff for C and CXX
-        // for old versions of CMake ListFiles C and CXX had some
-        // backwards compatibility files they have to load
-        const char* versionValue
-          = mf->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
-        if (atof(versionValue) <= 1.4)
-          {
-          if(strcmp(lang, "C") == 0)
+          std::string testLang = "CMakeTest";
+          testLang += lang;
+          testLang += "Compiler.cmake";
+          std::string ifpath = mf->GetModulesFile(testLang.c_str());
+          if(!mf->ReadListFile(0,ifpath.c_str()))
             {
             {
-            ifpath =  mf->GetModulesFile("CMakeBackwardCompatibilityC.cmake");
-            mf->ReadListFile(0,ifpath.c_str()); 
+            cmSystemTools::Error("Could not find cmake module file:", ifpath.c_str());
             }
             }
-          if(strcmp(lang, "CXX") == 0)
+          // **** Step 8, load backwards compatibility stuff for C and CXX
+          // for old versions of CMake ListFiles C and CXX had some
+          // backwards compatibility files they have to load
+          const char* versionValue
+            = mf->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
+          if (atof(versionValue) <= 1.4)
             {
             {
-            ifpath =  mf->GetModulesFile("CMakeBackwardCompatibilityCXX.cmake");
-            mf->ReadListFile(0,ifpath.c_str()); 
+            if(strcmp(lang, "C") == 0)
+              {
+              ifpath =  mf->GetModulesFile("CMakeBackwardCompatibilityC.cmake");
+              mf->ReadListFile(0,ifpath.c_str()); 
+              }
+            if(strcmp(lang, "CXX") == 0)
+              {
+              ifpath =  mf->GetModulesFile("CMakeBackwardCompatibilityCXX.cmake");
+              mf->ReadListFile(0,ifpath.c_str()); 
+              }
+            
             }
             }
-          
           }
           }
         }
         }
+      
       }
       }
-
     }
     }
 }
 }
 
 

+ 1 - 1
Source/cmGlobalGenerator.h

@@ -77,7 +77,7 @@ public:
    * Try to determine system infomation such as shared library
    * Try to determine system infomation such as shared library
    * extension, pthreads, byte order etc.  
    * extension, pthreads, byte order etc.  
    */
    */
-  virtual void EnableLanguage(const char*, cmMakefile *);
+  virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
 
 
   /**
   /**
    * Try to determine system infomation, get it from another generator
    * Try to determine system infomation, get it from another generator

+ 1 - 1
Source/cmGlobalNMakeMakefileGenerator.cxx

@@ -25,7 +25,7 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator()
   m_ForceUnixPaths = false;
   m_ForceUnixPaths = false;
 }
 }
 
 
-void cmGlobalNMakeMakefileGenerator::EnableLanguage(const char* l,
+void cmGlobalNMakeMakefileGenerator::EnableLanguage(std::vector<std::string>const& l,
                                                     cmMakefile *mf)
                                                     cmMakefile *mf)
 {
 {
   // pick a default 
   // pick a default 

+ 1 - 2
Source/cmGlobalNMakeMakefileGenerator.h

@@ -44,8 +44,7 @@ public:
    * Try to determine system infomation such as shared library
    * Try to determine system infomation such as shared library
    * extension, pthreads, byte order etc.  
    * extension, pthreads, byte order etc.  
    */
    */
-  virtual void EnableLanguage(const char*,cmMakefile *mf);
-
+  virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
 };
 };
 
 
 #endif
 #endif

+ 17 - 32
Source/cmGlobalUnixMakefileGenerator.cxx

@@ -27,24 +27,32 @@ cmGlobalUnixMakefileGenerator::cmGlobalUnixMakefileGenerator()
   m_FindMakeProgramFile = "CMakeUnixFindMake.cmake";
   m_FindMakeProgramFile = "CMakeUnixFindMake.cmake";
 }
 }
 
 
-void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang, 
+void cmGlobalUnixMakefileGenerator::EnableLanguage(std::vector<std::string>const& languages,
                                                    cmMakefile *mf)
                                                    cmMakefile *mf)
 {
 {
   mf->AddDefinition("CMAKE_CFG_INTDIR",".");
   mf->AddDefinition("CMAKE_CFG_INTDIR",".");
-  this->cmGlobalGenerator::EnableLanguage(lang, mf);
+  this->cmGlobalGenerator::EnableLanguage(languages, mf);
   std::string path;
   std::string path;
-  if(strcmp(lang, "C") == 0)
+  for(std::vector<std::string>::const_iterator l = languages.begin();
+      l != languages.end(); ++l)
     {
     {
-    if(!mf->GetDefinition("CMAKE_C_COMPILER"))
+    const char* lang = l->c_str();
+    std::string langComp = "CMAKE_";
+    langComp += lang;
+    langComp += "_COMPILER";
+    
+    if(!mf->GetDefinition(langComp.c_str()))
       {
       {
-      cmSystemTools::Error("CMAKE_C_COMPILER not set, after EnableLanguage");
-      return;
+      cmSystemTools::Error(langComp.c_str(), " not set, after EnableLanguage");
+      continue;
       }
       }
-    const char* cc = mf->GetRequiredDefinition("CMAKE_C_COMPILER");
+    const char* cc = mf->GetRequiredDefinition(langComp.c_str());
     path = cmSystemTools::FindProgram(cc);
     path = cmSystemTools::FindProgram(cc);
     if(path.size() == 0)
     if(path.size() == 0)
       {
       {
-      std::string message = "your C compiler: ";
+      std::string message = "your ";
+      message += lang;
+      message += " compiler: ";
       if(cc)
       if(cc)
         {
         {
         message +=  cc;
         message +=  cc;
@@ -53,34 +61,11 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
         {
         {
         message += "(NULL)";
         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());
-      }
-    }
-  if(strcmp(lang, "CXX") == 0)
-    {
-    const char* cxx = mf->GetRequiredDefinition("CMAKE_CXX_COMPILER");
-    path = cmSystemTools::FindProgram(cxx);
-    if(path.size() == 0)
-      {
-      std::string message = "your C++ compiler: ";
-      if(cxx)
-        {
-        message +=  cxx;
-        }
-      else
-        {
-        message +=  "(NULL)";
-        }
-      
       message += " was not found in your path.   "
       message += " was not found in your path.   "
         "For CMake to correctly use try compile commands, the compiler must "
         "For CMake to correctly use try compile commands, the compiler must "
         "be in your path.   Please add the compiler to your PATH environment,"
         "be in your path.   Please add the compiler to your PATH environment,"
         " and re-run CMake.";
         " and re-run CMake.";
-      cmSystemTools::Error(message.c_str());
+        cmSystemTools::Error(message.c_str());
       }
       }
     }
     }
 }
 }

+ 1 - 1
Source/cmGlobalUnixMakefileGenerator.h

@@ -45,7 +45,7 @@ public:
    * Try to determine system infomation such as shared library
    * Try to determine system infomation such as shared library
    * extension, pthreads, byte order etc.  
    * extension, pthreads, byte order etc.  
    */
    */
-  virtual void EnableLanguage(const char*, cmMakefile *mf);
+  virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
 
 
 };
 };
 
 

+ 1 - 1
Source/cmGlobalVisualStudio6Generator.cxx

@@ -24,7 +24,7 @@ cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator()
   m_FindMakeProgramFile = "CMakeVS6FindMake.cmake";
   m_FindMakeProgramFile = "CMakeVS6FindMake.cmake";
 }
 }
 
 
-void cmGlobalVisualStudio6Generator::EnableLanguage(const char* lang, 
+void cmGlobalVisualStudio6Generator::EnableLanguage(std::vector<std::string>const& lang,
                                                     cmMakefile *mf)
                                                     cmMakefile *mf)
 {
 {
   mf->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)");
   mf->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)");

+ 1 - 2
Source/cmGlobalVisualStudio6Generator.h

@@ -47,8 +47,7 @@ public:
    * Try to determine system infomation such as shared library
    * Try to determine system infomation such as shared library
    * extension, pthreads, byte order etc.  
    * extension, pthreads, byte order etc.  
    */
    */
-  virtual void EnableLanguage(const char*, cmMakefile *mf);
-
+  virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
   /**
   /**
    * Try running cmake and building a file. This is used for dynalically
    * Try running cmake and building a file. This is used for dynalically
    * loaded commands, not as part of the usual build process.
    * loaded commands, not as part of the usual build process.

+ 1 - 1
Source/cmGlobalVisualStudio7Generator.cxx

@@ -28,7 +28,7 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator()
 }
 }
 
 
 
 
-void cmGlobalVisualStudio7Generator::EnableLanguage(const char* lang, 
+void cmGlobalVisualStudio7Generator::EnableLanguage(std::vector<std::string>const &  lang, 
                                                     cmMakefile *mf)
                                                     cmMakefile *mf)
 {
 {
   mf->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)");
   mf->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)");

+ 1 - 1
Source/cmGlobalVisualStudio7Generator.h

@@ -47,7 +47,7 @@ public:
    * Try to determine system infomation such as shared library
    * Try to determine system infomation such as shared library
    * extension, pthreads, byte order etc.  
    * extension, pthreads, byte order etc.  
    */
    */
-  virtual void EnableLanguage(const char*, cmMakefile *mf);
+  virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
 
 
   /**
   /**
    * Try running cmake and building a file. This is used for dynalically
    * Try running cmake and building a file. This is used for dynalically

+ 1 - 1
Source/cmMakefile.cxx

@@ -2006,7 +2006,7 @@ cmSourceFile* cmMakefile::AddSource(cmSourceFile const&sf)
 }
 }
 
 
   
   
-void cmMakefile::EnableLanguage(const char* lang)
+void cmMakefile::EnableLanguage(std::vector<std::string> const &  lang)
 {
 {
   m_LocalGenerator->GetGlobalGenerator()->EnableLanguage(lang, this);
   m_LocalGenerator->GetGlobalGenerator()->EnableLanguage(lang, this);
 }
 }

+ 1 - 1
Source/cmMakefile.h

@@ -611,7 +611,7 @@ public:
   void AddCommand(cmCommand* );
   void AddCommand(cmCommand* );
 
 
   ///! Enable support for the named language, if null then all languages are enabled.
   ///! Enable support for the named language, if null then all languages are enabled.
-  void EnableLanguage(const char* );
+  virtual void EnableLanguage(std::vector<std::string>const& languages);
 
 
   /**
   /**
    * Set/Get the name of the parent directories CMakeLists file
    * Set/Get the name of the parent directories CMakeLists file

+ 5 - 3
Source/cmProjectCommand.cxx

@@ -48,19 +48,21 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args)
 
 
   m_Makefile->AddDefinition("PROJECT_NAME", args[0].c_str());
   m_Makefile->AddDefinition("PROJECT_NAME", args[0].c_str());
 
 
+  std::vector<std::string> languages;
   if(args.size() > 1)
   if(args.size() > 1)
     {
     {
     for(size_t i =1; i < args.size(); ++i)
     for(size_t i =1; i < args.size(); ++i)
       {
       {
-      m_Makefile->EnableLanguage(args[i].c_str());
+      languages.push_back(args[i]);
       }
       }
     }
     }
   else
   else
     {
     {
     // if no language is specified do c and c++
     // if no language is specified do c and c++
-    m_Makefile->EnableLanguage("C");
-    m_Makefile->EnableLanguage("CXX");
+    languages.push_back("C");
+    languages.push_back("CXX");
     }
     }
+  m_Makefile->EnableLanguage(languages);
   return true;
   return true;
 }
 }