diff options
Diffstat (limited to 'qmake/generators/win32/msbuild_objectmodel.cpp')
-rw-r--r-- | qmake/generators/win32/msbuild_objectmodel.cpp | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 2505056..c963f46 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -377,6 +377,16 @@ inline XmlOutput::xml_output valueTagT( const triState v) } +static QString vcxCommandSeparator() +{ + // MSBuild puts the contents of the custom commands into a batch file and calls it. + // As we want every sub-command to be error-checked (as is done by makefile-based + // backends), we insert the checks ourselves, using the undocumented jump target. + static QString cmdSep = + QLatin1String("
if errorlevel 1 goto VCEnd
"); + return cmdSep; +} + // VCXCLCompilerTool ------------------------------------------------- VCXCLCompilerTool::VCXCLCompilerTool() : BrowseInformation(_False), @@ -2142,32 +2152,6 @@ VCXCustomBuildTool::VCXCustomBuildTool() XmlOutput &operator<<(XmlOutput &xml, const VCXCustomBuildTool &tool) { - // The code below offers two ways to split custom build step commands. - // Normally the $$escape_expand(\n\t) is used in a project file, which is correctly translated - // in all generators. However, if you use $$escape_expand(\n\r) (or \n\h) instead, the VCPROJ - // generator will instead of binding the commands with " && " will insert a proper newline into - // the VCPROJ file. We sometimes use this method of splitting commands if the custom buildstep - // contains a command-line which is too big to run on certain OS. - QString cmds; - int end = tool.CommandLine.count(); - for(int i = 0; i < end; ++i) { - QString cmdl = tool.CommandLine.at(i); - if (cmdl.contains("\r\t")) { - if (i == end - 1) - cmdl = cmdl.trimmed(); - cmdl.replace("\r\t", " && "); - } else if (cmdl.contains("\r\n")) { - ; - } else if (cmdl.contains("\r\\h")) { - // The above \r\n should work, but doesn't, so we have this hack - cmdl.replace("\r\\h", "\r\n"); - } else { - if (i < end - 1) - cmdl += " && "; - } - cmds += cmdl; - } - if ( !tool.AdditionalDependencies.isEmpty() ) { xml << tag("AdditionalInputs") @@ -2175,11 +2159,11 @@ XmlOutput &operator<<(XmlOutput &xml, const VCXCustomBuildTool &tool) << valueTagDefX(tool.AdditionalDependencies, "AdditionalInputs", ";"); } - if( !cmds.isEmpty() ) + if( !tool.CommandLine.isEmpty() ) { xml << tag("Command") << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.ConfigName)) - << valueTag(cmds); + << valueTag(tool.CommandLine.join(vcxCommandSeparator())); } if ( !tool.Description.isEmpty() ) @@ -2249,7 +2233,7 @@ XmlOutput &operator<<(XmlOutput &xml, const VCXEventTool &tool) { return xml << tag(tool.EventName) - << attrTagS(_Command, tool.CommandLine) + << attrTagS(_Command, tool.CommandLine.join(vcxCommandSeparator())) << attrTagS(_Message, tool.Description) << closetag(tool.EventName); } @@ -2525,7 +2509,7 @@ bool VCXFilter::addExtraCompiler(const VCXFilterFile &info) if (!CustomBuildTool.Description.isEmpty()) CustomBuildTool.Description += " & "; CustomBuildTool.Description += cmd_name; - CustomBuildTool.CommandLine += cmd.trimmed().split("\n", QString::SkipEmptyParts); + CustomBuildTool.CommandLine += VCToolBase::fixCommandLine(cmd.trimmed()); int space = cmd.indexOf(' '); QFileInfo finf(cmd.left(space)); if (CustomBuildTool.ToolPath.isEmpty()) |