[vcpkg-msbuild-integration] Set the default value of `VcpkgConfiguration` according to `$(UseDebugLibraries)` rather than `$(Configuration)` for better support of custom configuration names. (#26177)

Competing resolution of https://github.com/microsoft/vcpkg/pull/9496 and https://github.com/microsoft/vcpkg/pull/22086
This commit is contained in:
Billy O'Neal 2022-08-10 13:14:52 -07:00 коммит произвёл GitHub
Родитель 5d6bbf3da3
Коммит d97c3ab76c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 25 добавлений и 1 удалений

Просмотреть файл

@ -3,7 +3,29 @@
<PropertyGroup>
<VcpkgPropsImported>true</VcpkgPropsImported>
<VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
<VcpkgConfiguration Condition="'$(VcpkgConfiguration)' == ''">$(Configuration)</VcpkgConfiguration>
</PropertyGroup>
<!-- Set the default value of $(VcpkgConfiguration) according to $(UseDebugLibraries) and $(Configuration) -->
<Choose>
<When Condition="'$(VcpkgConfiguration)' != ''" />
<When Condition="'$(UseDebugLibraries)' == ''">
<PropertyGroup>
<VcpkgConfiguration>$(Configuration)</VcpkgConfiguration>
</PropertyGroup>
</When>
<When Condition="'$(UseDebugLibraries)' == 'true'">
<PropertyGroup>
<VcpkgConfiguration>Debug</VcpkgConfiguration>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<VcpkgConfiguration>Release</VcpkgConfiguration>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<VcpkgUseStatic Condition="'$(VcpkgUseStatic)' == ''">false</VcpkgUseStatic>
<VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\..'))</VcpkgRoot>

Просмотреть файл

@ -109,6 +109,8 @@
<Target Name="VcpkgTripletSelection" BeforeTargets="ClCompile">
<Message Text="Using triplet &quot;$(VcpkgTriplet)&quot; from &quot;$(_ZVcpkgCurrentInstalledDir)&quot;"
Importance="Normal" Condition="'$(VcpkgEnabled)' == 'true'"/>
<Message Text="Using normalized configuration &quot;$(_ZVcpkgNormalizedConfiguration)&quot;"
Importance="Normal" Condition="'$(VcpkgEnabled)' == 'true'"/>
<Message Text="Not using Vcpkg because VcpkgEnabled is &quot;$(VcpkgEnabled)&quot;"
Importance="Normal" Condition="'$(VcpkgEnabled)' != 'true'"/>
<Message Text="Vcpkg is unable to link because we cannot decide between Release and Debug libraries. Please define the property VcpkgConfiguration to be 'Release' or 'Debug' (currently '$(VcpkgConfiguration)')."