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.
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_COMPILERCMAKE_RC_COMPILERCMAKE_MTetc. This allows for writing a toolchain file that can be run from a regular shell without callingvcvarsall.bat, which makes writing CI pipelines a lot easier. These toolchain files can include thevcpkg.cmaketoolchain file to take advantage of the advanced vcpkg features. When trying to use theVCPKG_APPLOCAL_DEPSfeature, however, the scriptapplocal.ps1will attempt to calldumpbinwithout a path. This results in an error ifdumbinis not in the PATH, i.e. ifvcvarsall.bathas not been called.Proposed solution
The
vcpkg.cmaketoockain file could provide a cache variableVCPKG_DUMPBINby callingfind_program(VCPKG_DUMPBIN, dumpbin), and pass the result on toapplocal.ps1as a parameter. This would allow for specifying the path todumpbinfrom the cmake command line, or from a toolchain file.Describe alternatives you've considered
The two possible workarounds are:
vcvarsall.batto 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.VCPKG_APPLOCAL_DEPStoOFF, which would be a pity.Additional context
This is just a small change to
scripts/buildsystems/vcpkg.cmakeandscripts/buildsystems/msbuild/applocal.ps1each. I have a working patch and could submit a PR if there is interest.