From 80ebedecf93d9494736448ac65d280c984f300b1 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 22 Oct 2014 10:01:29 +0200 Subject: [PATCH] Run VS custom build step in new environment variable scope. Task-number: QTBUG-32366 Change-Id: I99161b23e3d323fd88766ebe83c8bbfc1d50944e Reviewed-by: Joerg Bornemann --- qmake/generators/win32/msvc_objectmodel.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index f8e67718f7..74a0a20ea2 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2397,7 +2397,11 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) if (!CustomBuildTool.Description.isEmpty()) CustomBuildTool.Description += ", "; CustomBuildTool.Description += cmd_name; + // Execute custom build steps in an environment variable scope to prevent unwanted + // side effects for downstream build steps + CustomBuildTool.CommandLine += QLatin1String("setlocal"); CustomBuildTool.CommandLine += VCToolBase::fixCommandLine(cmd.trimmed()); + CustomBuildTool.CommandLine += QLatin1String("endlocal"); int space = cmd.indexOf(' '); QFileInfo finf(cmd.left(space)); if (CustomBuildTool.ToolPath.isEmpty())