1

I recently switched from using the Visual Studio 2015 IDE to the Visual Studio 2019 IDE. Around that same time I started using vcpkg for library installations. I've been using a pre-build version of an earlier version of boost, which I compiled myself. Thinking I ought to switch to a newer version of boost using vcpkg, I installed it with:

vcpkg.exe install boost --triplet x64-windows-static

Yet when I look inside C:\dev\vcpkg\installed\x64-windows-static\lib I see that vc140 - the Visual Studio 2015 toolset - is the version of boost built. Note that I am not using cmake. I am working purely in the IDE. How do I tell vcpkg I want the vc142 toolset, the version for Visual Studio 2019, built?

Blake Senftner
  • 756
  • 1
  • 8
  • 24

1 Answers1

2

The answer is a modified version of the GitHub issues,

Edit file from your VCPKG path

vcpkg\triplets\x86-windows.cmake

To add line

set(VCPKG_PLATFORM_TOOLSET v142)
prehistoricpenguin
  • 6,130
  • 3
  • 25
  • 42
  • Do I need to uninstall and reinstall a given library after adding this line? After editing and saving the x64-windows-static.cmake (the triplet I'm building), running the same command I show in my original post returns the package is already installed. – Blake Senftner Jul 05 '21 at 15:16
  • Looks like one needs to create separate .cmake files. I modified my x64-windows-static.cmake to be two files x64-windows-static-140.cmake and x64-windows-static-142.cmake files. Then I requested a build with "vcpkg install boost:x64-windows-static-v140 boost:x64-windows-static-v142" and that seems to be the trick... – Blake Senftner Jul 05 '21 at 15:49
  • Yeah, pain in the butt - it built the 140 libs, not the 142. I've reverted to hand building boost. – Blake Senftner Jul 05 '21 at 17:58
  • @BlakeSenftner Why did you specify the two triplets together? `"vcpkg install boost:x64-windows-static-v140 boost:x64-windows-static-v142"` I think it's the reason you got two type of builds. – prehistoricpenguin Jul 06 '21 at 00:59
  • @prehistorispenguin my searching found a github issue discussing this same goal, and in the solution they posted it had install requests with multiple triplets. So that's what I tried... Trying again now with individual install requests for each triplet. (To be honest, building boost itself is easier than figuring out vcpkg. The vcpkg documentation is some of the worst I seen; clearly written by people that do not know how to write documentation. – Blake Senftner Jul 06 '21 at 13:05
  • 1
    @BlakeSenftner haha, I would like to blame Microsoft too, they make it too hard to uninstall the visual studio, or we can just uninstall the vs2015, then everything would be fine. – prehistoricpenguin Jul 06 '21 at 14:30