forked from qt-creator/qt-creator
PE: Use original vcvarsall.bat to do environment cleanup
Amends ae07c31976
Calling a VS2022 vcvarsall.bat /clean_env in a VS2019 environment causes
failures. Using the original vcvarsall.bat does the proper cleanup.
Change-Id: I12426e9eb97baecae5357e6bb419333464ea1ded
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -2085,23 +2085,21 @@ std::optional<QString> MsvcToolChain::generateEnvironmentSettings(const Utils::E
|
||||
// Create a batch file to create and save the env settings
|
||||
Utils::TempFileSaver saver(Utils::TemporaryDirectory::masterDirectoryPath() + "/XXXXXX.bat");
|
||||
|
||||
auto makeCall = [](const QString &batchFile, const QString &batchArgs) -> QByteArray {
|
||||
QByteArray call = "call ";
|
||||
call += ProcessArgs::quoteArg(batchFile).toLocal8Bit();
|
||||
if (!batchArgs.isEmpty()) {
|
||||
call += ' ';
|
||||
call += batchArgs.toLocal8Bit();
|
||||
}
|
||||
return call;
|
||||
};
|
||||
QByteArray callCleanEnv = makeCall(batchFile, "/clean_env");
|
||||
QByteArray call = makeCall(batchFile, batchArgs);
|
||||
QByteArray call = "call ";
|
||||
call += ProcessArgs::quoteArg(batchFile).toLocal8Bit();
|
||||
if (!batchArgs.isEmpty()) {
|
||||
call += ' ';
|
||||
call += batchArgs.toLocal8Bit();
|
||||
}
|
||||
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
saver.write("chcp 65001\r\n");
|
||||
saver.write("set VSCMD_SKIP_SENDTELEMETRY=1\r\n");
|
||||
saver.write("set CLINK_NOAUTORUN=1\r\n");
|
||||
saver.write(callCleanEnv + "\r\n");
|
||||
saver.write("setlocal enableextensions\r\n");
|
||||
saver.write("if defined VCINSTALLDIR (\r\n");
|
||||
saver.write(" call \"%VCINSTALLDIR%/Auxiliary/Build/vcvarsall.bat\" /clean_env\r\n");
|
||||
saver.write(")\r\n");
|
||||
saver.write(call + "\r\n");
|
||||
saver.write("@echo " + marker.toLocal8Bit() + "\r\n");
|
||||
saver.write("set\r\n");
|
||||
|
Reference in New Issue
Block a user