summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2003-01-09 17:18:22 (GMT)
committerKen Martin <ken.martin@kitware.com>2003-01-09 17:18:22 (GMT)
commit05955d64034002db93b43b6ed373d91d825a8c2b (patch)
tree23b5f20eff6f199670aadc53e9cad9d4082ce271 /Source/cmake.cxx
parentbd217452cd9fa24ea537e56dc649f9600dcb2ea8 (diff)
downloadCMake-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.cxx37
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);
}