The current design of Kits don't mix well with Vcpkg, an invaluable tool for Windows OSS developers. It's practically a package manager written in CMake. I recently started using it and went straight to contributing 3 packages into it.
The problem is, that Vcpkg _abuses_ toolchain files for dependencies only, but not the compiler itself. Because Kits rightfully expect a compiler to be defined when using toolchain kits, it chokes on vcpkg.cmake, because it does not define a compiler, but just about everything else.
I would like CMake Tools to allow toolchain files to be specified in any of the Kit types.
I though of going for the Visual Studio 15 2017 Win64 generator to implicitly find the compiler when using Vcpkg. However, using this generator it chokes saying
The Platform for project 'VCTargetsPath.vcxproj' is invalid. Platform=' Win64'.
By changing the generator to Visual Studio 15 2017Win64 it works as expected, it's just CMake Tools that throws an error that it doesn't know this generator, otherwise it works.
Looks like a bad regex in driver.ts grabs the space before Win64 in the full generator name.
Here's a possible better workaround, and maybe a bit easier to support: You can set arbitrary CMake settings in a kit with the cmakeSettings key. Try adding CMAKE_TOOLCHAIN_FILE there?
It worked like a charm! Awesome! Thanks for the tip. For others (future reference):
[
{
"name": "MSVC 15.6-beta5",
"visualStudio": "a2f9235f",
"visualStudioArchitecture": "amd64",
"preferredGenerator": {
"name": "Visual Studio 15 2017",
"platform": "x64"
},
"cmakeSettings": {
"CMAKE_TOOLCHAIN_FILE": "C:/Users/mnagy/Source/Repos/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
}
]
Most helpful comment
It worked like a charm! Awesome! Thanks for the tip. For others (future reference):