Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-81553

VS2019 always recompile a whole project because of invalid stdafx.h.cpp content

    XMLWordPrintable

Details

    • Windows
    • 1f8ced2d6df024ba007f9bb25e12bf4e23aee2db (qt/qtbase/5.14)

    Description

      Latest change in `msbuild_objectmodel.cpp` caused that projects in Visual Studio 2019 projects are always recompiled.

       

      The reason is in this line

       

      return commands.join('\n');

       

      in method

      commandLinesForOutput()

       

       

      This will produce invalid content of stdafx.h.cpp for VS2019 which causes that VS2019 to always recompile the whole project.

       

      Based on the previous version of `vcxCommandSeparator`

       

      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;
      }

       

       

      the correct version should look like this:

       

      static QString commandLinesForOutput(QStringList commands)
      {
          // 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 errchk = QStringLiteral("if errorlevel 1 goto VCEnd");
          for (int i = commands.count() - 2; i >= 0; --i) {
              if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive))
                  commands.insert(i + 1, errchk);
          }
      	
          return commands.join("
");
      }
       

       

      After updating qmake to this form, everything works fine.

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jbornema Joerg Bornemann
            ludek.vodicka Ludek Vodicka
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes