[vcpkg] Add support of -static-md to Visual Studio UI (#28045)

* Add support of -static-md to UI

* Remove redundant comparison

* Fix typo

* Check if 'Use Static Libraries' is selected
This commit is contained in:
sbrajchuk 2022-11-29 22:38:53 +03:00 committed by GitHub
parent 1885879b33
commit 11e021f9f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -62,8 +62,11 @@
<BoolProperty Name="VcpkgUseStatic" DisplayName="Use Static Libraries" Category="Conditional" Default="false" <BoolProperty Name="VcpkgUseStatic" DisplayName="Use Static Libraries" Category="Conditional" Default="false"
Description="Vcpkg can build static libraries (e.g. x64-windows-static). This options changes the default triplet to use these static libraries by appending -static to $(VcpkgTriplet). This will not be shown in the evaluation of the Triplet within the UI." /> Description="Vcpkg can build static libraries (e.g. x64-windows-static). This options changes the default triplet to use these static libraries by appending -static to $(VcpkgTriplet). This will not be shown in the evaluation of the Triplet within the UI." />
<BoolProperty Name="VcpkgUseMD" DisplayName="Use Dynamic CRT" Category="Conditional" Default="false"
Description="Only effective if 'Use Static Libraries' is selected. Vcpkg can build static libraries compiled against MSVC runtime (e.g. x64-windows-static-md). This options changes the default triplet to use these static libraries by appending -md to $(VcpkgTriplet). This will not be shown in the evaluation of the Triplet within the UI." />
<StringProperty Name="VcpkgTriplet" DisplayName="Triplet" Category="Conditional" Subtype="Text" <StringProperty Name="VcpkgTriplet" DisplayName="Triplet" Category="Conditional" Subtype="Text"
Description="Specifies the triplet used by Vcpkg. Does not include the '-static' suffix that may be added by the 'Use static libraries' flag." /> Description="Specifies the triplet used by Vcpkg. Does not include the '-static' or '-static-md' suffixes that may be added by the 'Use static libraries' and 'Use Dynamic CRT' flags." />
<StringProperty Name="VcpkgHostTriplet" DisplayName="Host Triplet" Category="Conditional" Subtype="Text" <StringProperty Name="VcpkgHostTriplet" DisplayName="Host Triplet" Category="Conditional" Subtype="Text"
Description="Specifies the host triplet used by Vcpkg. If empty, this will be automatically determined." /> Description="Specifies the host triplet used by Vcpkg. If empty, this will be automatically determined." />

View File

@ -38,7 +38,10 @@
<PropertyGroup> <PropertyGroup>
<_ZVcpkgLinkage /> <_ZVcpkgLinkage />
<_ZVcpkgLinkage Condition="'$(VcpkgUseStatic)' == 'true'">-static</_ZVcpkgLinkage> <_ZVcpkgLinkage Condition="'$(VcpkgUseStatic)' == 'true'">-static</_ZVcpkgLinkage>
<VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">$(VcpkgPlatformTarget)-$(VcpkgOSTarget)$(_ZVcpkgLinkage)</VcpkgTriplet> <_ZVcpkgLinkageMD />
<_ZVcpkgLinkageMD Condition="'$(VcpkgUseStatic)' == 'true' and '$(VcpkgUseMD)' == 'true'">-md</_ZVcpkgLinkageMD>
<VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">$(VcpkgPlatformTarget)-$(VcpkgOSTarget)$(_ZVcpkgLinkage)$(_ZVcpkgLinkageMD)</VcpkgTriplet>
<VcpkgTriplet Condition="!$(VcpkgTriplet.EndsWith($(_ZVcpkgLinkage)$(_ZVcpkgLinkageMD)))">$(VcpkgTriplet)$(_ZVcpkgLinkage)$(_ZVcpkgLinkageMD)</VcpkgTriplet>
</PropertyGroup> </PropertyGroup>
<!-- Include the triplet in ProjectStateLine to force VS2017 and later to fully rebuild if the user changes it. --> <!-- Include the triplet in ProjectStateLine to force VS2017 and later to fully rebuild if the user changes it. -->