Skip to content

allow specifying the path to the dumpbin executable when using VCPKG_APPLOCAL_DEPS #14090

@georg-emg

Description

@georg-emg

Is your feature request related to a problem? Please describe.
When creating a cmake toolchain under Windows, all the relevant executables can be specified using cmake variables like CMAKE_CXX_COMPILER CMAKE_RC_COMPILER CMAKE_MT etc. This allows for writing a toolchain file that can be run from a regular shell without calling vcvarsall.bat, which makes writing CI pipelines a lot easier. These toolchain files can include the vcpkg.cmake toolchain file to take advantage of the advanced vcpkg features. When trying to use the VCPKG_APPLOCAL_DEPS feature, however, the script applocal.ps1 will attempt to call dumpbin without a path. This results in an error if dumbin is not in the PATH, i.e. if vcvarsall.bat has not been called.

Proposed solution
The vcpkg.cmake toockain file could provide a cache variable VCPKG_DUMPBIN by calling find_program(VCPKG_DUMPBIN, dumpbin), and pass the result on to applocal.ps1 as a parameter. This would allow for specifying the path to dumpbin from the cmake command line, or from a toolchain file.

Describe alternatives you've considered
The two possible workarounds are:

  • require vcvarsall.bat to be called before building a project that uses vcpkg. This kind of defeats the purpose of a cmake toolchain file, though, which should describe the whole build environment.
  • set VCPKG_APPLOCAL_DEPS to OFF, which would be a pity.

Additional context
This is just a small change to scripts/buildsystems/vcpkg.cmake and scripts/buildsystems/msbuild/applocal.ps1 each. I have a working patch and could submit a PR if there is interest.

Metadata

Metadata

Assignees

Labels

category:vcpkg-featureThe issue is a new capability of the tool that doesn’t already exist and we haven’t committed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions