diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-12-06 16:43:23 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-12-06 16:43:23 (GMT) |
commit | 7987ce88cbf5b13eea118e78fa410c0305355280 (patch) | |
tree | 4091e8c96792a1801dafe9a06f5aa49dc3aae58f /Source | |
parent | b6cb67eaa9b8f7c12848bfaf2aea8c5eb9e7526e (diff) | |
download | CMake-7987ce88cbf5b13eea118e78fa410c0305355280.zip CMake-7987ce88cbf5b13eea118e78fa410c0305355280.tar.gz CMake-7987ce88cbf5b13eea118e78fa410c0305355280.tar.bz2 |
ENH: set the CXX and CC environment vars
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b3f4b0a..36190d9 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -86,7 +86,7 @@ void cmGlobalGenerator::EnableLanguage(const char* lang, if(!isLocal && !this->GetLanguageEnabled("C") && lang[0] == 'C') - { + { if (m_CMakeInstance->GetIsInTryCompile()) { cmSystemTools::Error("This should not have happen. " @@ -104,6 +104,18 @@ void cmGlobalGenerator::EnableLanguage(const char* lang, determineCFile += "/Modules/CMakeDetermineCCompiler.cmake"; mf->ReadListFile(0,determineCFile.c_str()); this->SetLanguageEnabled("C"); + // put CC in the environment in case user scripts want + // to run configure + // see man putenv for explaination of this stupid code... + if(mf->GetDefinition("CMAKE_C_COMPILER")) + { + static char envCC[5000]; + std::string env = "CC=${CMAKE_C_COMPILER}"; + mf->ExpandVariablesInString(env); + strncpy(envCC, env.c_str(), 4999); + envCC[4999] = 0; + putenv(envCC); + } } // check for a CXX compiler and configure it @@ -116,6 +128,18 @@ void cmGlobalGenerator::EnableLanguage(const char* lang, determineCFile += "/Modules/CMakeDetermineCXXCompiler.cmake"; mf->ReadListFile(0,determineCFile.c_str()); this->SetLanguageEnabled("CXX"); + // put CXX in the environment in case user scripts want + // to run configure + // see man putenv for explaination of this stupid code... + static char envCXX[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); + } } |