diff options
author | Brad King <brad.king@kitware.com> | 2023-04-03 15:12:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-04-05 16:06:22 (GMT) |
commit | f90c8ab54ebd751600f525a3e548841e6aa16049 (patch) | |
tree | 2cd8954fd3362418f46407b8f43df4d26ffa4ab7 /Source/cmGlobalVisualStudio14Generator.cxx | |
parent | b512c53d43b6078c97e06231ccbfa8599a66a4f4 (diff) | |
download | CMake-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/cmGlobalVisualStudio14Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio14Generator.cxx | 11 |
1 files changed, 7 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; + } } } |