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

PlatformToolset env var not honored by MSVC project generator

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.3.0 RC1
    • 4.8.4
    • Build tools: qmake
    • None
    • Windows 7, Visual Studio 2010 Express Edition SP1, Windows SDK 7.1
    • 0de55b6c9f5d266f891b746e2d63e6a45d3b3c32

    Description

      I believe that qmake's Visual Studio project generator should copy the value of the PlatformToolset environment variable (if present) into the PlatformToolset property of the projects it generates.

      I have encountered this issue as a user of Visual Studio Express Edition wishing to compile projects for 64bit architectures, but it may also be useful in other edge cases involving Visual Studio.

      Express Edition does not include a 64bit compiler toolset. Users of Express Edition can use the 64bit toolset provided by the Windows SDK 7.1. To cause a Visual Studio project to use this toolset, the project's PlatformToolset attribute must be set to "WindowsSDK7.1". This is what CMake does when generating x64 projects for Visual Studio Express Edition. For a project generated by qmake, the only way to do this is to manually edit the project file after it has been generated. Otherwise, Visual Studio will use its default toolset, which will fail in Express Edition for 64bit builds.

      The Windows SDK 7.1 Command Prompt has an environment variable PlatformToolset set to "WindowsSDK7.1". So, when running qmake from within the Windows SDK 7.1 Command Prompt, this problem could easily be solved by checking for the presence of this environment variable, and propogating it into the attributes of the Visual Studio projects that it generates.

      Attached is a very simple patch (one line change) which does exactly that. I wanted to keep it small so it's easy to understand. You might wish to do it in a slightly more structured way, in keeping with the rest of the code, in which case I hope that reading my patch in the context of the rest of the code will suggest to you how you might prefer to do that.

      Thanks.

      Possibly related to QTVSADDINBUG-156.

      Attachments

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

        Activity

          People

            jbornema Joerg Bornemann
            oktalist Mat Sutcliffe
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes