mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-10 15:50:50 -06:00
cmSystemTools: Fix unsetenv() fallback
The fallback path boils down to putenv(). Calling that with a "=" sets the variable to an empty string. Use cmSystemTools::UnPutEnv() instead, which correctly handles unsetting variables on a variety of systems.
This commit is contained in:
@@ -1501,8 +1501,7 @@ std::string cmSystemTools::RelativeIfUnder(std::string const& top,
|
|||||||
bool cmSystemTools::UnsetEnv(const char* value)
|
bool cmSystemTools::UnsetEnv(const char* value)
|
||||||
{
|
{
|
||||||
# if !defined(HAVE_UNSETENV)
|
# if !defined(HAVE_UNSETENV)
|
||||||
std::string var = cmStrCat(value, '=');
|
return cmSystemTools::UnPutEnv(value);
|
||||||
return cmSystemTools::PutEnv(var);
|
|
||||||
# else
|
# else
|
||||||
unsetenv(value);
|
unsetenv(value);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user