summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-12-12 16:22:00 (GMT)
committerBrad King <brad.king@kitware.com>2019-12-12 16:25:42 (GMT)
commit07612646fe28d86330cbd4db9cfd27be1d8fb90f (patch)
tree22fa196a5e9b46810bacb27bab524fca59b7ba91 /Source
parent2a5e5b25ba4d6eb68dbee29381774562c98e228f (diff)
downloadCMake-07612646fe28d86330cbd4db9cfd27be1d8fb90f.zip
CMake-07612646fe28d86330cbd4db9cfd27be1d8fb90f.tar.gz
CMake-07612646fe28d86330cbd4db9cfd27be1d8fb90f.tar.bz2
VS: Fix support for v142 toolset minor versions in VS 16.5+
The fix in commit 5117389931 (VS: Fix support for v142 toolset minor versions, 2019-10-01, v3.15.5~6^2) worked around a bug in VS's placement of toolset files. VS 16.5 will fix that bug and restore the original pattern for locations of toolset files. Update our logic to look for both possibilities. Issue: #19779
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx20
1 files changed, 11 insertions, 9 deletions
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 1eca1f6..66a57eb 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -388,15 +388,17 @@ std::string cmGlobalVisualStudioVersionedGenerator::GetAuxiliaryToolset() const
if (version) {
std::string instancePath;
GetVSInstance(instancePath);
- std::stringstream path;
- path << instancePath;
- path << "/VC/Auxiliary/Build";
- path << (cmSystemTools::VersionCompareGreaterEq(version, "14.20") ? '.'
- : '/');
- path << version;
- path << "/Microsoft.VCToolsVersion." << version << ".props";
-
- std::string toolsetPath = path.str();
+ std::string toolsetDir = instancePath + "/VC/Auxiliary/Build";
+ char sep = '/';
+ if (cmSystemTools::VersionCompareGreaterEq(version, "14.20")) {
+ std::string toolsetDot = toolsetDir + "." + version +
+ "/Microsoft.VCToolsVersion." + version + ".props";
+ if (cmSystemTools::PathExists(toolsetDot)) {
+ sep = '.';
+ }
+ }
+ std::string toolsetPath = toolsetDir + sep + version +
+ "/Microsoft.VCToolsVersion." + version + ".props";
cmSystemTools::ConvertToUnixSlashes(toolsetPath);
return toolsetPath;
}