diff options
author | Ken Martin <ken.martin@kitware.com> | 2003-01-09 17:18:22 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2003-01-09 17:18:22 (GMT) |
commit | 05955d64034002db93b43b6ed373d91d825a8c2b (patch) | |
tree | 23b5f20eff6f199670aadc53e9cad9d4082ce271 /Source/cmake.cxx | |
parent | bd217452cd9fa24ea537e56dc649f9600dcb2ea8 (diff) | |
download | CMake-05955d64034002db93b43b6ed373d91d825a8c2b.zip CMake-05955d64034002db93b43b6ed373d91d825a8c2b.tar.gz CMake-05955d64034002db93b43b6ed373d91d825a8c2b.tar.bz2 |
fix bug in env settings
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 4200de8..8aff9e3 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -708,9 +708,46 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) if (m_GlobalGenerator) { delete m_GlobalGenerator; + // restore the original environment variables CXX and CC + // Restor CC + static char envCC[5000]; + std::string env = "CC="; + if(m_CCEnvironment) + { + env += m_CCEnvironment; + } + std::string::size_type size = env.size(); + if(size > 4999) + { + size = 4999; + } + strncpy(envCC, env.c_str(), size); + envCC[4999] = 0; + putenv(envCC); + + // Restore CXX + static char envCXX[5000]; + env = "CXX="; + if(m_CXXEnvironment) + { + env += m_CXXEnvironment; + } + size = env.size(); + if(size > 4999) + { + size = 4999; + } + strncpy(envCXX, env.c_str(), size); + envCXX[4999] = 0; + putenv(envCXX); } + // set the new m_GlobalGenerator = gg; + // Save the environment variables CXX and CC + m_CXXEnvironment = getenv("CXX"); + m_CCEnvironment = getenv("CC"); + // set the cmake instance just to be sure gg->SetCMakeInstance(this); } |