summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio14Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-08-08 20:43:14 (GMT)
committerBrad King <brad.king@kitware.com>2023-08-10 13:59:25 (GMT)
commit89b611ab3232cdeb4892458bf9d6c3281a8fda00 (patch)
treec54a6010827a11fefd621612b4145434ee5e68aa /Source/cmGlobalVisualStudio14Generator.cxx
parentae97d82e830c6ddc81808e3f44dad8a47a30bcae (diff)
downloadCMake-89b611ab3232cdeb4892458bf9d6c3281a8fda00.zip
CMake-89b611ab3232cdeb4892458bf9d6c3281a8fda00.tar.gz
CMake-89b611ab3232cdeb4892458bf9d6c3281a8fda00.tar.bz2
VS: Select latest Windows SDK even when targeting Windows 8.1 and below
The policy added by commit f90c8ab54e (VS: Select latest available Windows SDK version by default, 2023-04-03, v3.27.0-rc1~206^2~1) applied only when targeting Windows 10+. Apply it to older versions too. Fixes: #25170 Issue: #16202
Diffstat (limited to 'Source/cmGlobalVisualStudio14Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 506a12a..01294dd 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -217,6 +217,16 @@ bool cmGlobalVisualStudio14Generator::InitializePlatformWindows(cmMakefile* mf)
return this->SelectWindows10SDK(mf);
}
+ // Under CMP0149 NEW behavior, we search for a Windows 10 SDK even
+ // when targeting older Windows versions, but it is not required.
+ if (mf->GetPolicyStatus(cmPolicies::CMP0149) == cmPolicies::NEW) {
+ std::string const version = this->GetWindows10SDKVersion(mf);
+ if (!version.empty()) {
+ this->SetWindowsTargetPlatformVersion(version, mf);
+ return true;
+ }
+ }
+
// We are not targeting Windows 10+, so fall back to the Windows 8.1 SDK.
// For VS 2019 and above we must explicitly specify it.
if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS16 &&