diff options
author | Ken Martin <ken.martin@kitware.com> | 2002-09-06 17:06:23 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2002-09-06 17:06:23 (GMT) |
commit | 25ff4552b3d17c9c4f601c7f488710c4350323d1 (patch) | |
tree | 79475f5fb9965ad672bb85ae245130f63e632cce /Source/cmGlobalUnixMakefileGenerator.cxx | |
parent | 2c7e9b3b59cda840adc2aa4c3bfe1ffa0707be99 (diff) | |
download | CMake-25ff4552b3d17c9c4f601c7f488710c4350323d1.zip CMake-25ff4552b3d17c9c4f601c7f488710c4350323d1.tar.gz CMake-25ff4552b3d17c9c4f601c7f488710c4350323d1.tar.bz2 |
new arch
Diffstat (limited to 'Source/cmGlobalUnixMakefileGenerator.cxx')
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator.cxx | 109 |
1 files changed, 60 insertions, 49 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator.cxx b/Source/cmGlobalUnixMakefileGenerator.cxx index 0f2a370..d3dd4e9 100644 --- a/Source/cmGlobalUnixMakefileGenerator.cxx +++ b/Source/cmGlobalUnixMakefileGenerator.cxx @@ -17,6 +17,7 @@ #include "cmGlobalUnixMakefileGenerator.h" #include "cmLocalUnixMakefileGenerator.h" #include "cmMakefile.h" +#include "cmake.h" void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang, cmMakefile *mf) @@ -25,58 +26,68 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang, { m_LanguagesEnabled = true; - // see man putenv for explaination of this stupid code.... - static char envCXX[5000]; - static char envCC[5000]; - if(mf->GetDefinition("CMAKE_CXX_COMPILER")) + // only do for global runs + if (!m_CMakeInstance->GetLocal()) { - std::string env = "CXX=${CMAKE_CXX_COMPILER}"; - mf->ExpandVariablesInString(env); - strncpy(envCXX, env.c_str(), 4999); - envCXX[4999] = 0; - putenv(envCXX); - } - if(mf->GetDefinition("CMAKE_C_COMPILER")) - { - std::string env = "CC=${CMAKE_C_COMPILER}"; - mf->ExpandVariablesInString(env); - strncpy(envCC, env.c_str(), 4999); - envCC[4999] = 0; - putenv(envCC); - } - std::string output; - std::string root - = cmSystemTools::ConvertToOutputPath(mf->GetDefinition("CMAKE_ROOT")); - // if no lang specified use CXX - if(!lang ) - { - lang = "CXX"; - } - // if CXX or C, then enable C - if((!this->GetLanguageEnabled(lang) && lang[0] == 'C')) - { - std::string cmd = root; - cmd += "/Templates/cconfigure"; - cmSystemTools::RunCommand(cmd.c_str(), output, - cmSystemTools::ConvertToOutputPath(mf->GetHomeOutputDirectory()).c_str()); - std::string fpath = mf->GetHomeOutputDirectory(); - fpath += "/CCMakeSystemConfig.cmake"; - mf->ReadListFile(NULL,fpath.c_str()); - this->SetLanguageEnabled("C"); - } - // if CXX - if(!this->GetLanguageEnabled(lang) || strcmp(lang, "CXX") == 0) - { - std::string cmd = root; - cmd += "/Templates/cxxconfigure"; - cmSystemTools::RunCommand(cmd.c_str(), output, - cmSystemTools::ConvertToOutputPath(mf->GetHomeOutputDirectory()).c_str()); - std::string fpath = mf->GetHomeOutputDirectory(); - fpath += "/CXXCMakeSystemConfig.cmake"; - mf->ReadListFile(NULL,fpath.c_str()); - this->SetLanguageEnabled("CXX"); + // see man putenv for explaination of this stupid code.... + static char envCXX[5000]; + static char envCC[5000]; + if(mf->GetDefinition("CMAKE_CXX_COMPILER")) + { + std::string env = "CXX=${CMAKE_CXX_COMPILER}"; + mf->ExpandVariablesInString(env); + strncpy(envCXX, env.c_str(), 4999); + envCXX[4999] = 0; + putenv(envCXX); + } + if(mf->GetDefinition("CMAKE_C_COMPILER")) + { + std::string env = "CC=${CMAKE_C_COMPILER}"; + mf->ExpandVariablesInString(env); + strncpy(envCC, env.c_str(), 4999); + envCC[4999] = 0; + putenv(envCC); + } + std::string output; + std::string root + = cmSystemTools::ConvertToOutputPath(mf->GetDefinition("CMAKE_ROOT")); + // if no lang specified use CXX + if(!lang ) + { + lang = "CXX"; + } + // if CXX or C, then enable C + if((!this->GetLanguageEnabled(lang) && lang[0] == 'C')) + { + std::string cmd = root; + cmd += "/Templates/cconfigure"; + cmSystemTools::RunCommand(cmd.c_str(), output, + cmSystemTools::ConvertToOutputPath(mf->GetHomeOutputDirectory()).c_str()); + std::string fpath = mf->GetHomeOutputDirectory(); + fpath += "/CCMakeSystemConfig.cmake"; + mf->ReadListFile(NULL,fpath.c_str()); + this->SetLanguageEnabled("C"); + } + // if CXX + if(!this->GetLanguageEnabled(lang) || strcmp(lang, "CXX") == 0) + { + std::string cmd = root; + cmd += "/Templates/cxxconfigure"; + cmSystemTools::RunCommand(cmd.c_str(), output, + cmSystemTools::ConvertToOutputPath(mf->GetHomeOutputDirectory()).c_str()); + std::string fpath = mf->GetHomeOutputDirectory(); + fpath += "/CXXCMakeSystemConfig.cmake"; + mf->ReadListFile(NULL,fpath.c_str()); + this->SetLanguageEnabled("CXX"); + } } } + + if (!m_CMakeInstance->GetLocal()) + { + // if we are from the top, always define this + mf->AddDefinition("RUN_CONFIGURE", true); + } } ///! Create a local generator appropriate to this Global Generator |