summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-08-27 08:41:07 -0400
committerBill Hoffman <bill.hoffman@kitware.com>2004-08-27 08:41:07 -0400
commit731369ef9cfaa68dfb8582e8db873929a4cd645a (patch)
treee3c331251c22a0d969647bfac571fc410d8cad42 /Source
parentad4f98f3cf20c3befa18979521736dc49b458a6c (diff)
downloadcmake-731369ef9cfaa68dfb8582e8db873929a4cd645a.tar.gz
ENH: try to initialize all languages at the same time
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx3
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.h2
-rw-r--r--Source/cmGlobalCodeWarriorGenerator.cxx2
-rw-r--r--Source/cmGlobalCodeWarriorGenerator.h2
-rw-r--r--Source/cmGlobalGenerator.cxx210
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.cxx2
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.h3
-rw-r--r--Source/cmGlobalUnixMakefileGenerator.cxx49
-rw-r--r--Source/cmGlobalUnixMakefileGenerator.h2
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h2
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmMakefile.h2
-rw-r--r--Source/cmProjectCommand.cxx8
17 files changed, 148 insertions, 150 deletions
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 0fd068d980..4f5eef7c12 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -24,7 +24,8 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator()
m_ForceUnixPaths = false;
}
-void cmGlobalBorlandMakefileGenerator::EnableLanguage(const char* l,
+
+void cmGlobalBorlandMakefileGenerator::EnableLanguage(std::vector<std::string>const& l,
cmMakefile *mf)
{
std::string outdir = m_CMakeInstance->GetStartOutputDirectory();
diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h
index 6f5b64e417..08928c0937 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.h
+++ b/Source/cmGlobalBorlandMakefileGenerator.h
@@ -45,7 +45,7 @@ public:
* Try to determine system infomation such as shared library
* extension, pthreads, byte order etc.
*/
- virtual void EnableLanguage(const char*,cmMakefile *mf);
+ virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
};
#endif
diff --git a/Source/cmGlobalCodeWarriorGenerator.cxx b/Source/cmGlobalCodeWarriorGenerator.cxx
index 735c5c8d2f..fff678a1c7 100644
--- a/Source/cmGlobalCodeWarriorGenerator.cxx
+++ b/Source/cmGlobalCodeWarriorGenerator.cxx
@@ -20,7 +20,7 @@
#include "cmake.h"
#include "cmTarget.h"
-void cmGlobalCodeWarriorGenerator::EnableLanguage(const char*,
+void cmGlobalCodeWarriorGenerator::EnableLanguage(std::vector<std::string>const& l,
cmMakefile *mf)
{
// now load the settings
diff --git a/Source/cmGlobalCodeWarriorGenerator.h b/Source/cmGlobalCodeWarriorGenerator.h
index 3c6dee24f0..4549f68b7f 100644
--- a/Source/cmGlobalCodeWarriorGenerator.h
+++ b/Source/cmGlobalCodeWarriorGenerator.h
@@ -46,7 +46,7 @@ public:
* Try to determine system infomation such as shared library
* 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
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 1b416be511..2e6965658b 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -98,10 +98,10 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
// enable the given language
-void cmGlobalGenerator::EnableLanguage(const char* lang,
+void cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *mf)
{
- if(!lang)
+ if(languages.size() == 0)
{
cmSystemTools::Error("EnableLanguage must have a lang specified!");
cmSystemTools::SetFatalErrorOccured();
@@ -126,7 +126,7 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
// **** Step 2, Load the CMakeDetermineSystem.cmake file and find out
// what platform we are running on
- if (!isLocal && !this->GetLanguageEnabled(lang))
+ if (!isLocal && !mf->GetDefinition("CMAKE_SYSTEM_NAME"))
{
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Windows version number data. */
@@ -151,65 +151,72 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
fpath += "/CMakeSystem.cmake";
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
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());
}
}
- 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());
+ }
+
}
-
}
}
+
}
-
}
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 71b1859fa3..82b040501c 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -77,7 +77,7 @@ public:
* Try to determine system infomation such as shared library
* 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
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index ccba3a449e..5d6d82f114 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -25,7 +25,7 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator()
m_ForceUnixPaths = false;
}
-void cmGlobalNMakeMakefileGenerator::EnableLanguage(const char* l,
+void cmGlobalNMakeMakefileGenerator::EnableLanguage(std::vector<std::string>const& l,
cmMakefile *mf)
{
// pick a default
diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h
index 4647c2dc43..863d0b82c0 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.h
+++ b/Source/cmGlobalNMakeMakefileGenerator.h
@@ -44,8 +44,7 @@ public:
* Try to determine system infomation such as shared library
* extension, pthreads, byte order etc.
*/
- virtual void EnableLanguage(const char*,cmMakefile *mf);
-
+ virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
};
#endif
diff --git a/Source/cmGlobalUnixMakefileGenerator.cxx b/Source/cmGlobalUnixMakefileGenerator.cxx
index 170c97bb1e..b4b472d190 100644
--- a/Source/cmGlobalUnixMakefileGenerator.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator.cxx
@@ -27,24 +27,32 @@ cmGlobalUnixMakefileGenerator::cmGlobalUnixMakefileGenerator()
m_FindMakeProgramFile = "CMakeUnixFindMake.cmake";
}
-void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
+void cmGlobalUnixMakefileGenerator::EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *mf)
{
mf->AddDefinition("CMAKE_CFG_INTDIR",".");
- this->cmGlobalGenerator::EnableLanguage(lang, mf);
+ this->cmGlobalGenerator::EnableLanguage(languages, mf);
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);
if(path.size() == 0)
{
- std::string message = "your C compiler: ";
+ std::string message = "your ";
+ message += lang;
+ message += " compiler: ";
if(cc)
{
message += cc;
@@ -54,33 +62,10 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
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. "
"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());
+ cmSystemTools::Error(message.c_str());
}
}
}
diff --git a/Source/cmGlobalUnixMakefileGenerator.h b/Source/cmGlobalUnixMakefileGenerator.h
index 77a781eddc..a8af4310c6 100644
--- a/Source/cmGlobalUnixMakefileGenerator.h
+++ b/Source/cmGlobalUnixMakefileGenerator.h
@@ -45,7 +45,7 @@ public:
* Try to determine system infomation such as shared library
* extension, pthreads, byte order etc.
*/
- virtual void EnableLanguage(const char*, cmMakefile *mf);
+ virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
};
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index dc25c7e2c0..a85ea61e98 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -24,7 +24,7 @@ cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator()
m_FindMakeProgramFile = "CMakeVS6FindMake.cmake";
}
-void cmGlobalVisualStudio6Generator::EnableLanguage(const char* lang,
+void cmGlobalVisualStudio6Generator::EnableLanguage(std::vector<std::string>const& lang,
cmMakefile *mf)
{
mf->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)");
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index 97338a1489..d1dec8312e 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -47,8 +47,7 @@ public:
* Try to determine system infomation such as shared library
* 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
* loaded commands, not as part of the usual build process.
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index fc46ddbb26..26f16dbe84 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/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)
{
mf->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)");
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 2c4db0e426..0f9e814373 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -47,7 +47,7 @@ public:
* Try to determine system infomation such as shared library
* 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
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index c03254a7fa..cd0069cbd9 100644
--- a/Source/cmMakefile.cxx
+++ b/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);
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 44526228f7..f374e66287 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -611,7 +611,7 @@ public:
void AddCommand(cmCommand* );
///! 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
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 41592e74dd..f62d8bdac1 100644
--- a/Source/cmProjectCommand.cxx
+++ b/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());
+ std::vector<std::string> languages;
if(args.size() > 1)
{
for(size_t i =1; i < args.size(); ++i)
{
- m_Makefile->EnableLanguage(args[i].c_str());
+ languages.push_back(args[i]);
}
}
else
{
// 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;
}