为 Visual Studio 的不同版本构建提升

Building boost for different versions of Visual Studio

我安装了 Visual Studio 2019 和 2022。我想为 2019 vc142 构建 boost 库。我如何构建 vc142 库而不是 vc143?

我目前的搭建方法如下。我正在使用 Developer Command Prompt for 2019,运行 以下,

  1. bootstrapper.bat
  2. b2.exe install --prefix=MY_PATH

不幸的是输出的lib文件都是vc143。我也试过在 bootstrap.bat 中注释掉 IF "%1"=="vc143" SET TOOLSET=msvc : 14.3 但没有成功。 运行 bootstrap.bat 时的第一个输出是 Found with vswhere C:\Program Files\Microsoft Visual Studio22\Community。我怀疑这可能是问题所在

toolset=msvc-14.2 添加到 b2.exe 构建正确的版本。

b2.exe install --prefix=MY_PATH toolset=msvc-14.2