summaryrefslogtreecommitdiffstats
path: root/Source/cmVSSetupHelper.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-10-26 19:22:41 (GMT)
committerBrad King <brad.king@kitware.com>2021-10-29 15:52:58 (GMT)
commitec8d37b3b1ca10535e219b37cf4889d59b1dfedb (patch)
tree34b6c70c6de5805b9d0ae51d3966e7d1195799f1 /Source/cmVSSetupHelper.cxx
parent8e6d930e8c3fb951e3c4388cc6a9a96dedcb412b (diff)
downloadCMake-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.cxx13
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;
}