Browse Source

Merge topic 'vs-17.10' into release-3.29

d256581bb0 VS: Fix '-T version=14.40' under VS 17.10 preview 1
3a7fbd04c8 VS: Verify toolset version= field format more strictly

Acked-by: Kitware Robot <[email protected]>
Merge-request: !9271
Brad King 1 year ago
parent
commit
d2df2e94e5
1 changed files with 13 additions and 3 deletions
  1. 13 3
      Source/cmGlobalVisualStudio10Generator.cxx

+ 13 - 3
Source/cmGlobalVisualStudio10Generator.cxx

@@ -218,15 +218,25 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
     if (vcPlatformToolsetRegex.find(platformToolset) ||
         platformToolset == "Test Toolset"_s) {
       std::string versionToolset = this->GeneratorToolsetVersion;
-      cmsys::RegularExpression versionToolsetRegex("^[0-9][0-9]\\.[0-9][0-9]");
+      cmsys::RegularExpression versionToolsetRegex(
+        "^([0-9][0-9])\\.([0-9])[0-9](\\.|$)");
       if (versionToolsetRegex.find(versionToolset)) {
-        versionToolset = cmStrCat('v', versionToolset.erase(2, 1));
+        versionToolset = cmStrCat('v', versionToolsetRegex.match(1),
+                                  versionToolsetRegex.match(2));
+        // Hard-code special cases for toolset versions whose first
+        // three digits do not match their toolset name.
+        if (platformToolset == "v143"_s && versionToolset == "v144"_s &&
+            // VS 17.10 toolset v143 version 14.40.
+            (this->GeneratorToolsetVersion == "14.40"_s ||
+             cmHasLiteralPrefix(this->GeneratorToolsetVersion, "14.40."))) {
+          versionToolset = "v143";
+        }
       } else {
         // Version not recognized. Clear it.
         versionToolset.clear();
       }
 
-      if (!cmHasPrefix(versionToolset, platformToolset)) {
+      if (versionToolset != platformToolset) {
         mf->IssueMessage(
           MessageType::FATAL_ERROR,
           cmStrCat("Generator\n"