[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 committed by GitHub
parent 5d6bbf3da3
commit d97c3ab76c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View File

@ -3,7 +3,29 @@
<PropertyGroup> <PropertyGroup>
<VcpkgPropsImported>true</VcpkgPropsImported> <VcpkgPropsImported>true</VcpkgPropsImported>
<VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled> <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> <VcpkgUseStatic Condition="'$(VcpkgUseStatic)' == ''">false</VcpkgUseStatic>
<VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\..'))</VcpkgRoot> <VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\..'))</VcpkgRoot>

View File

@ -109,6 +109,8 @@
<Target Name="VcpkgTripletSelection" BeforeTargets="ClCompile"> <Target Name="VcpkgTripletSelection" BeforeTargets="ClCompile">
<Message Text="Using triplet &quot;$(VcpkgTriplet)&quot; from &quot;$(_ZVcpkgCurrentInstalledDir)&quot;" <Message Text="Using triplet &quot;$(VcpkgTriplet)&quot; from &quot;$(_ZVcpkgCurrentInstalledDir)&quot;"
Importance="Normal" Condition="'$(VcpkgEnabled)' == 'true'"/> 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;" <Message Text="Not using Vcpkg because VcpkgEnabled is &quot;$(VcpkgEnabled)&quot;"
Importance="Normal" Condition="'$(VcpkgEnabled)' != 'true'"/> 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)')." <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)')."