Uploaded image for project: 'Qt Visual Studio Tools'
  1. Qt Visual Studio Tools
  2. QTVSADDINBUG-486

Allow QTDIR to be set from Visual Studio property sheets

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • 2.4.0
    • 2.1.1
    • General
    • None

    Description

      We would like to be able to set the QTDIR per configuration by settings its value via a Visual Studio property sheet applied to the project.

      At the moment, this is possible, but rather difficult and fragile. The problem seems to be that the addin writes the QTDIR value into the *.vcxproj.user file, which apparently overrides the value set in property sheets.

      One workaround we found is to use the special $(QTDIR) version intended to be used with an environment variable. In this case, the QTDIR value is not written into the user file and is read from the property sheet as desired. For actions outside an active build, e.g. opening a ui file in Qt Designer, the value of the $(QTDIR) environment variable is used, which is fine.

      This workaround has a few drawbacks. For one, it is a bit cumbersome to configure the projects to use the special $(QTDIR) version. If the environment variable points to a 32 bit distribution of Qt, setting a project's Qt version for a 64 bit configuration silently fails. The easiest way around that is to simply open the vxcproj file in a text editor and change the appropriate values (the alternative is to go through each build configuration, lots of context menu clicks and at least one restart of Visual Studio to switch the environment variable between a 32 and 64 bit distribution).

      Another drawback is the workaround's fragility. If one were to temporarily set the project's Qt version to a fixed (non environment variable) one for testing purposes and run a build, this version is written to the user file. Reverting the project back to using the $(QTDIR) version then has no effect, the QTDIR during the build is read from the user file instead. Deleting the user file (or editing our the QTDIR line) fixes this.

      The workaround also doesn't play well with $(DefaultQtVersion). We'd actually prefer to configure projects to use this placeholder to allow our developers to switch between a fixed Qt version and the version configured in the property sheet. But when the default Qt version is set to $(QTDIR), the environment variable is evaluated before the build and its value written into the user file, again overriding the property sheet.

      Would it be possible to introduce a special Qt version name, or change the behaviour of the $(QTDIR) version to

      1. Never write a fixed value for QTDIR into the user file, even when used as a default Qt version
      2. Remove such a value if it is present
      3. Use the system's QTDIR environment variable for tasks outside a build (as is the case for the $(QTDIR) version already)

      Attachments

        Issue Links

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

          Activity

            People

              mecfc Miguel Costa
              bkloster Benjamin Kloster
              Votes:
              5 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes