summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-01-26 18:32:46 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-01-26 18:32:46 (GMT)
commit222e9a2876fccaf5b7da399430b4ec0e4db5d4d4 (patch)
treec59ac6ae8d4ac8c5bd5f6417b8ce1f828c93039a /Source/cmSystemTools.cxx
parentdd7f85a9dc791440b48138aecfff02fb934c1027 (diff)
downloadCMake-222e9a2876fccaf5b7da399430b4ec0e4db5d4d4.zip
CMake-222e9a2876fccaf5b7da399430b4ec0e4db5d4d4.tar.gz
CMake-222e9a2876fccaf5b7da399430b4ec0e4db5d4d4.tar.bz2
BUG: fix put/get env problems
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 9f0ea3d..fe6cfa6 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1177,3 +1177,27 @@ std::string cmSystemTools::RelativePath(const char* local, const char* remote)
relativePath += relativeSplit[i];
return relativePath;
}
+class cmDeletingCharVector : public std::vector<char*>
+{
+public:
+ ~cmDeletingCharVector()
+ {
+ for(std::vector<char*>::iterator i = this->begin();
+ i != this->end(); ++i)
+ {
+ delete *i;
+ }
+ }
+};
+
+
+bool cmSystemTools::PutEnv(const char* value)
+{
+ static cmDeletingCharVector localEnvironment;
+ char* envVar = new char[strlen(value)+1];
+ strcpy(envVar, value);
+ putenv(envVar);
+ // save the pointer in the static vector so that it can
+ // be deleted on exit
+ localEnvironment.push_back(envVar);
+}