summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudioVersionedGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-02-19 14:22:55 (GMT)
committerBrad King <brad.king@kitware.com>2019-02-19 14:31:50 (GMT)
commit4dab8e69bd46b6aa85a97c4d23e9d894fc5fbcf6 (patch)
tree1f56daddb56b0e5022e9f20a9b305cfe73e132d0 /Source/cmGlobalVisualStudioVersionedGenerator.cxx
parent35bf9ded3b116209ca864eff2da481c22117e17d (diff)
downloadCMake-4dab8e69bd46b6aa85a97c4d23e9d894fc5fbcf6.zip
CMake-4dab8e69bd46b6aa85a97c4d23e9d894fc5fbcf6.tar.gz
CMake-4dab8e69bd46b6aa85a97c4d23e9d894fc5fbcf6.tar.bz2
VS: Tell VS 2019 to use Windows SDK 8.1 explicitly when needed
VS 2019 does not default to the 8.1 SDK as VS 2017 and VS 2015 did. When `CMAKE_SYSTEM_VERSION` is 8.1 or lower, select the 8.1 SDK explicitly. Fixes: #18927
Diffstat (limited to 'Source/cmGlobalVisualStudioVersionedGenerator.cxx')
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 913fc4a..2f9eb3f 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -401,6 +401,12 @@ bool cmGlobalVisualStudioVersionedGenerator::InitializeWindows(cmMakefile* mf)
// If the Win 8.1 SDK is installed then we can select a SDK matching
// the target Windows version.
if (this->IsWin81SDKInstalled()) {
+ // VS 2019 does not default to 8.1 so specify it explicitly when needed.
+ if (this->Version >= cmGlobalVisualStudioGenerator::VS16 &&
+ !cmSystemTools::VersionCompareGreater(this->SystemVersion, "8.1")) {
+ this->SetWindowsTargetPlatformVersion("8.1", mf);
+ return true;
+ }
return cmGlobalVisualStudio14Generator::InitializeWindows(mf);
}
// Otherwise we must choose a Win 10 SDK even if we are not targeting