| 2226 | } |
| 2227 | |
| 2228 | void cmake::SetGlobalGenerator(std::unique_ptr<cmGlobalGenerator> gg) |
| 2229 | { |
| 2230 | if (!gg) { |
| 2231 | cmSystemTools::Error("Error SetGlobalGenerator called with null"); |
| 2232 | return; |
| 2233 | } |
| 2234 | if (this->GlobalGenerator) { |
| 2235 | // restore the original environment variables CXX and CC |
| 2236 | std::string env = "CC="; |
| 2237 | if (!this->CCEnvironment.empty()) { |
| 2238 | env += this->CCEnvironment; |
| 2239 | cmSystemTools::PutEnv(env); |
| 2240 | } else { |
| 2241 | cmSystemTools::UnPutEnv(env); |
| 2242 | } |
| 2243 | env = "CXX="; |
| 2244 | if (!this->CXXEnvironment.empty()) { |
| 2245 | env += this->CXXEnvironment; |
| 2246 | cmSystemTools::PutEnv(env); |
| 2247 | } else { |
| 2248 | cmSystemTools::UnPutEnv(env); |
| 2249 | } |
| 2250 | } |
| 2251 | |
| 2252 | // set the new |
| 2253 | this->GlobalGenerator = std::move(gg); |
| 2254 | |
| 2255 | // set the global flag for unix style paths on cmSystemTools as soon as |
| 2256 | // the generator is set. This allows gmake to be used on windows. |
| 2257 | cmSystemTools::SetForceUnixPaths(this->GlobalGenerator->GetForceUnixPaths()); |
| 2258 | |
| 2259 | // Save the environment variables CXX and CC |
| 2260 | if (!cmSystemTools::GetEnv("CXX", this->CXXEnvironment)) { |
| 2261 | this->CXXEnvironment.clear(); |
| 2262 | } |
| 2263 | if (!cmSystemTools::GetEnv("CC", this->CCEnvironment)) { |
| 2264 | this->CCEnvironment.clear(); |
| 2265 | } |
| 2266 | } |
| 2267 | |
| 2268 | int cmake::DoPreConfigureChecks() |
| 2269 | { |