Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 20e99cd

Browse files
committed
Honor MSVC WindowsSDKVersion if set
Add a line to the project file setting the target SDK. Otherwise, in for example VS2017, if the default but optional 8.1 SDK is not installed the build will fail. Patch from Peifeng Qiu, slightly edited by me. Discussion: https://postgr.es/m/CABmtVJhw1boP_bd4=b3Qv5YnqEdL696NtHFi2ruiyQ6mFHkeQQ@mail.gmail.com Backpatch to all live branches.
1 parent f5a4ab2 commit 20e99cd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/tools/msvc/MSBuildProject.pm

+13
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ EOF
4040
</ItemGroup>
4141
<PropertyGroup Label="Globals">
4242
<ProjectGuid>$self->{guid}</ProjectGuid>
43+
EOF
44+
# Check whether WindowsSDKVersion env variable is present.
45+
# Add WindowsTargetPlatformVersion node if so.
46+
my $sdkVersion = $ENV{'WindowsSDKVersion'};
47+
if (defined($sdkVersion))
48+
{
49+
# remove trailing backslash if necessary.
50+
$sdkVersion, =~ s/\\$//;
51+
print $f <<EOF
52+
<WindowsTargetPlatformVersion>$sdkVersion</WindowsTargetPlatformVersion>
53+
EOF
54+
}
55+
print $f <<EOF;
4356
</PropertyGroup>
4457
<Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
4558
EOF

0 commit comments

Comments
 (0)