summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-04-03 15:12:18 (GMT)
committerBrad King <brad.king@kitware.com>2023-04-05 16:06:22 (GMT)
commitf90c8ab54ebd751600f525a3e548841e6aa16049 (patch)
tree2cd8954fd3362418f46407b8f43df4d26ffa4ab7 /Source
parentb512c53d43b6078c97e06231ccbfa8599a66a4f4 (diff)
downloadCMake-f90c8ab54ebd751600f525a3e548841e6aa16049.zip
CMake-f90c8ab54ebd751600f525a3e548841e6aa16049.tar.gz
CMake-f90c8ab54ebd751600f525a3e548841e6aa16049.tar.bz2
VS: Select latest available Windows SDK version by default
Add policy `CMP0149` to stop preferring SDKs exactly matching `CMAKE_SYSTEM_VERSION` over the latest SDK. Fixes: #16202
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx11
-rw-r--r--Source/cmPolicies.h3
2 files changed, 10 insertions, 4 deletions
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 57082f4..0f9a334 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -12,6 +12,7 @@
#include "cmGlobalVisualStudioGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmPolicies.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
@@ -436,10 +437,12 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion(
return std::string();
}
- // Look for a SDK exactly matching the target Windows version.
- for (std::string const& i : sdks) {
- if (cmSystemTools::VersionCompareEqual(i, this->SystemVersion)) {
- return i;
+ if (mf->GetPolicyStatus(cmPolicies::CMP0149) != cmPolicies::NEW) {
+ // Look for a SDK exactly matching the target Windows version.
+ for (std::string const& i : sdks) {
+ if (cmSystemTools::VersionCompareEqual(i, this->SystemVersion)) {
+ return i;
+ }
}
}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 37d697f..fe88382 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -447,6 +447,9 @@ class cmMakefile;
27, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0148, \
"The FindPythonInterp and FindPythonLibs modules are removed.", 3, \
+ 27, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0149, \
+ "Visual Studio generators select latest Windows SDK by default.", 3, \
27, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)