diff options
author | Brad King <brad.king@kitware.com> | 2019-01-08 18:45:08 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-08 19:10:16 (GMT) |
commit | d44f81c2173d56cba662bc414f7cd2dc030b74fe (patch) | |
tree | e17688823d066f672b92fdc464ef01eb072be89f /Source/cmVSSetupHelper.cxx | |
parent | 9bbfbd54ba04e07b0bf2eb8bb1056bca53d639c5 (diff) | |
download | CMake-d44f81c2173d56cba662bc414f7cd2dc030b74fe.zip CMake-d44f81c2173d56cba662bc414f7cd2dc030b74fe.tar.gz CMake-d44f81c2173d56cba662bc414f7cd2dc030b74fe.tar.bz2 |
VS: Exclude VS 2019 instances when using VS 2017 generator
Filter instances reported by the VS Installer to consider only VS 2017
instances for the "Visual Studio 15 2017" generator.
Fixes: #18721
Diffstat (limited to 'Source/cmVSSetupHelper.cxx')
-rw-r--r-- | Source/cmVSSetupHelper.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx index 22fe007..19c96b3 100644 --- a/Source/cmVSSetupHelper.cxx +++ b/Source/cmVSSetupHelper.cxx @@ -295,6 +295,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; @@ -310,6 +313,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(); |