Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Setting environment variables for vcpkg
Forum Updated to NodeBB v4.3 + New Features

Setting environment variables for vcpkg

Scheduled Pinned Locked Moved Solved Installation and Deployment
2 Posts 1 Posters 36 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote last edited by
    #1

    For CMake I can use CMakePresets.json to set e.g.

          "environment": {
            "VCPKG_KEEP_ENV_VARS": "QTDIR",
            "QTDIR": "/opt/Qt/6.9.0/gcc_64"
          },
    

    which can be checked into a VCS.

    For MSBuild AFAICT, but only option is to use the Visual Studio Properties Manager (View/Property Manager), and open the Qt section then got to "User macros" and add the names you want to set:
    9fa2f0a8-58f4-4b9c-aacd-cc1d39e31eb3-image.png
    and when you create them tick the box to say that you want them set as an environment variable.
    32f441c8-6288-4f07-a378-8957d0f2e7ea-image.png
    So far so good - BUT AFAICT that isn't preserved anywhere in a file that can be checked into a VCS.

    Is there a "better" way to do this please that will preserve the information in a file that I can check in to a VCS?

    1 Reply Last reply
    0
    • PerdrixP Offline
      PerdrixP Offline
      Perdrix
      wrote last edited by Perdrix
      #2

      To answer my own question! I used "Add New Project Property Sheet" to add a property sheet called vcpkg. I told it to save it a file called vcpkg.props in the root directory of the solution. I then configured the two User Macros as above.

      I then used "Add Existing Property Sheet" to add this file to all configurations of all the projects in the solution.

      Sounds rather awkward, but it does seem to work.

      1 Reply Last reply
      0
      • PerdrixP Perdrix has marked this topic as solved

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved