'msbuild with vcpkg uses different triplet from Visual Studio for x86, but works for x64

I have a library project for both x64 and x86. Within Visual Studio I can build both x64 and x86. When I use msbuild, the x64 builds with the correct triplet but the Win32 builds with x86-windows not the expected x86-windows-static. The vcproj file has the right triplets, as you can see from the snippet.

  <VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet>
  <VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet>

Here is the example for the successful x64

VERBOSE: msbuild.exe C:\code\proj53\proj53.vcxproj /nologo /p:Configuration=Release
/t:Clean,Rebuild /p:DebugSymbols=false /p:platform=x64
VcpkgTripletSelection:
  Using triplet "x64-windows-static" from "C:\code\vcpkg\installed\x64-windows-static\"
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\CL.exe
   /c /Iinclude /I"C:\code\vcpkg\installed\x64-windows-static\include" /Zi /nologo ...

And here is the example for the failing x86. I don't understand why it is selecting x86-windows and not the x86-windows-static as given in the vxcproj.

VERBOSE: msbuild.exe C:\code\proj53\proj53.vcxproj /nologo /p:Configuration=Release
/t:Clean,Rebuild /p:DebugSymbols=false /p:platform=x86
VcpkgTripletSelection:
  Using triplet "x86-windows" from "C:\code\vcpkg\installed\x86-windows\"
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\CL.exe
   /c /Iinclude /I"C:\code\vcpkg\installed\x86-windows\include" /Zi /nologo ...
fatal error C1083: Cannot open include file: 'curl/curl.h'
fatal error C1083: Cannot open include file: 'tinyxml2.h'

Can anyone point me in the right direction?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source