diff options
author | Brad King <brad.king@kitware.com> | 2021-10-26 19:22:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-10-29 15:52:58 (GMT) |
commit | ec8d37b3b1ca10535e219b37cf4889d59b1dfedb (patch) | |
tree | 34b6c70c6de5805b9d0ae51d3966e7d1195799f1 /Source/cmVSSetupHelper.cxx | |
parent | 8e6d930e8c3fb951e3c4388cc6a9a96dedcb412b (diff) | |
download | CMake-ec8d37b3b1ca10535e219b37cf4889d59b1dfedb.zip CMake-ec8d37b3b1ca10535e219b37cf4889d59b1dfedb.tar.gz CMake-ec8d37b3b1ca10535e219b37cf4889d59b1dfedb.tar.bz2 |
VS: Support version specification in CMAKE_GENERATOR_INSTANCE
Diffstat (limited to 'Source/cmVSSetupHelper.cxx')
-rw-r--r-- | Source/cmVSSetupHelper.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx index b9443d6..39ddce3 100644 --- a/Source/cmVSSetupHelper.cxx +++ b/Source/cmVSSetupHelper.cxx @@ -102,10 +102,12 @@ cmVSSetupAPIHelper::~cmVSSetupAPIHelper() CoUninitialize(); } -bool cmVSSetupAPIHelper::SetVSInstance(std::string const& vsInstallLocation) +bool cmVSSetupAPIHelper::SetVSInstance(std::string const& vsInstallLocation, + std::string const& vsInstallVersion) { this->SpecifiedVSInstallLocation = vsInstallLocation; cmSystemTools::ConvertToUnixSlashes(this->SpecifiedVSInstallLocation); + this->SpecifiedVSInstallVersion = vsInstallVersion; chosenInstanceInfo = VSInstanceInfo(); return this->EnumerateAndChooseVSInstance(); } @@ -366,6 +368,15 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance() std::string currentVSLocation = instanceInfo.GetInstallLocation(); if (cmSystemTools::ComparePath(currentVSLocation, this->SpecifiedVSInstallLocation)) { + if (this->SpecifiedVSInstallVersion.empty() || + instanceInfo.Version == this->SpecifiedVSInstallVersion) { + chosenInstanceInfo = instanceInfo; + return true; + } + } + } else if (!this->SpecifiedVSInstallVersion.empty()) { + // We are looking for a specific version. + if (instanceInfo.Version == this->SpecifiedVSInstallVersion) { chosenInstanceInfo = instanceInfo; return true; } |