diff options
author | Jake Cobb <jake.cobb@gmail.com> | 2021-05-21 11:43:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-05-24 15:34:07 (GMT) |
commit | c3bd5a6a2cb0f08d125655967a2f52bdd551ae6b (patch) | |
tree | e7f7a170de971558e586f46e17c06f6a50ccd464 /Source/cmake.cxx | |
parent | f9067e806f7a7863cdb439e267750a2047814181 (diff) | |
download | CMake-c3bd5a6a2cb0f08d125655967a2f52bdd551ae6b.zip CMake-c3bd5a6a2cb0f08d125655967a2f52bdd551ae6b.tar.gz CMake-c3bd5a6a2cb0f08d125655967a2f52bdd551ae6b.tar.bz2 |
cmake-gui: Unset empty CC,CXX on global generator change
On subsequent runs of configure from cmake-gui the global generator is
swapped. So on runs other than the first it was setting CC and CXX to
empty when they were otherwise undefined.
Instead, restore them if non-empty and unset them if empty when changing
the global generator and a previous generator exists.
Fixes: #21449
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 315bd20..840a9d9 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1751,17 +1751,20 @@ void cmake::SetGlobalGenerator(std::unique_ptr<cmGlobalGenerator> gg) } if (this->GlobalGenerator) { // restore the original environment variables CXX and CC - // Restore CC std::string env = "CC="; if (!this->CCEnvironment.empty()) { env += this->CCEnvironment; + cmSystemTools::PutEnv(env); + } else { + cmSystemTools::UnPutEnv(env); } - cmSystemTools::PutEnv(env); env = "CXX="; if (!this->CXXEnvironment.empty()) { env += this->CXXEnvironment; + cmSystemTools::PutEnv(env); + } else { + cmSystemTools::UnPutEnv(env); } - cmSystemTools::PutEnv(env); } // set the new |