ENH: Add a method to remove environment variables

This commit is contained in:
Andy Cedilnik 2006-03-17 11:44:07 -05:00
parent fe1fda6431
commit d5631f370b
2 changed files with 11 additions and 1 deletions

View File

@ -1280,6 +1280,11 @@ bool cmSystemTools::PutEnv(const char* value)
return ret == 0; return ret == 0;
} }
bool cmSystemTools::UnsetEnv(const char* value)
{
return unsetenv(value) == 0;
}
std::vector<std::string> cmSystemTools::GetEnvironmentVariables() std::vector<std::string> cmSystemTools::GetEnvironmentVariables()
{ {
std::vector<std::string> env; std::vector<std::string> env;

View File

@ -291,9 +291,14 @@ public:
*/ */
static std::string RelativePath(const char* local, const char* remote); 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 */ of the form var=value */
static bool PutEnv(const char* 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<std::string> GetEnvironmentVariables(); static std::vector<std::string> GetEnvironmentVariables();
/** Setup the environment to enable VS 8 IDE output. */ /** Setup the environment to enable VS 8 IDE output. */