diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-03-17 20:46:20 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-03-17 20:46:20 (GMT) |
commit | b20cb780495630fa8088f9c95309597af22734c1 (patch) | |
tree | 2747cff8befd423ac960dcec3caab1dc3ed121e4 /Source/cmSystemTools.cxx | |
parent | ca8d1bc99b68f39fb24e76ac1a546e7849248771 (diff) | |
download | CMake-b20cb780495630fa8088f9c95309597af22734c1.zip CMake-b20cb780495630fa8088f9c95309597af22734c1.tar.gz CMake-b20cb780495630fa8088f9c95309597af22734c1.tar.bz2 |
ENH: Handle missing unsetenv and add check for environ
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index b047547..8903cc3 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -56,7 +56,14 @@ # pragma set woff 1375 /* base class destructor not virtual */ #endif -extern char** environ; // For GetEnvironmentVariables +#if !defined(HAVE_ENVIRON_WITHOUT_SIGNATURE) +// For GetEnvironmentVariables +# if defined(_WIN32) +extern __declspec( dllimport ) char** environ; +# else +extern char** environ; +# endif +#endif bool cmSystemTools::s_RunCommandHideConsole = false; bool cmSystemTools::s_DisableRunCommandOutput = false; @@ -1280,9 +1287,17 @@ bool cmSystemTools::PutEnv(const char* value) return ret == 0; } +#ifdef CMAKE_BUILD_WITH_CMAKE bool cmSystemTools::UnsetEnv(const char* value) { - return false; +#if !defined(HAVE_UNSETENV) + std::string var = value; + var += "="; + return cmSystemTools::PutEnv(var.c_str()); +#else + unsetenv(value); + return true; +#endif } std::vector<std::string> cmSystemTools::GetEnvironmentVariables() @@ -1295,6 +1310,7 @@ std::vector<std::string> cmSystemTools::GetEnvironmentVariables() } return env; } +#endif void cmSystemTools::EnableVSConsoleOutput() { |