Преглед изворни кода

Merge topic 'vs2017-skip-2019'

d44f81c217 VS: Exclude VS 2019 instances when using VS 2017 generator

Acked-by: Kitware Robot <[email protected]>
Merge-request: !2775
Brad King пре 6 година
родитељ
комит
90b08fc27b
1 измењених фајлова са 9 додато и 0 уклоњено
  1. 9 0
      Source/cmVSSetupHelper.cxx

+ 9 - 0
Source/cmVSSetupHelper.cxx

@@ -328,6 +328,9 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
     return false;
   }
 
+  // FIXME: Add a way for caller to specify other versions.
+  std::wstring wantVersion = std::to_wstring(15) + L'.';
+
   SmartCOMPtr<ISetupInstance> instance;
   while (SUCCEEDED(enumInstances->Next(1, &instance, NULL)) && instance) {
     SmartCOMPtr<ISetupInstance2> instance2 = NULL;
@@ -343,6 +346,12 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
     instance = instance2 = NULL;
 
     if (isInstalled) {
+      // We are looking for a specific major version.
+      if (instanceInfo.Version.size() < wantVersion.size() ||
+          instanceInfo.Version.substr(0, wantVersion.size()) != wantVersion) {
+        continue;
+      }
+
       if (!this->SpecifiedVSInstallLocation.empty()) {
         // We are looking for a specific instance.
         std::string currentVSLocation = instanceInfo.GetInstallLocation();