Setting environment variables for vcpkg
-
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:
and when you create them tick the box to say that you want them set as an environment variable.
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?
-
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.
-
P Perdrix has marked this topic as solved