From d5631f370b2355b69e5895734d8fe7e4c090e8cf Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Fri, 17 Mar 2006 11:44:07 -0500 Subject: [PATCH] ENH: Add a method to remove environment variables --- Source/cmSystemTools.cxx | 5 +++++ Source/cmSystemTools.h | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 55cf61d11..3b63e8716 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1280,6 +1280,11 @@ bool cmSystemTools::PutEnv(const char* value) return ret == 0; } +bool cmSystemTools::UnsetEnv(const char* value) +{ + return unsetenv(value) == 0; +} + std::vector cmSystemTools::GetEnvironmentVariables() { std::vector env; diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 8af74ed64..698813919 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -291,9 +291,14 @@ public: */ static std::string RelativePath(const char* local, const char* remote); - /** put a string into the environment + /** Put a string into the environment of the form var=value */ static bool PutEnv(const char* value); + + /** Remove an environment variable */ + static bool UnsetEnv(const char* value); + + /** Get the list of all environment variables */ static std::vector GetEnvironmentVariables(); /** Setup the environment to enable VS 8 IDE output. */