summaryrefslogtreecommitdiff
path: root/Source/cmVSSetupHelper.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-09 09:40:53 -0500
committerBrad King <brad.king@kitware.com>2019-01-11 10:37:38 -0500
commitd8ed309d0529d9a7b28da561c3640290a8041b68 (patch)
tree04d6dccc332623769b0b6ccf3bb0c1f0da73e08e /Source/cmVSSetupHelper.cxx
parent5a283b79e5fe1739142cc513a9a701855849b2f8 (diff)
downloadcmake-d8ed309d0529d9a7b28da561c3640290a8041b68.tar.gz
VS: Parameterize cmVSSetupAPIHelper instances with VS version
Diffstat (limited to 'Source/cmVSSetupHelper.cxx')
-rw-r--r--Source/cmVSSetupHelper.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx
index d80b5a2b42..9187c29b9f 100644
--- a/Source/cmVSSetupHelper.cxx
+++ b/Source/cmVSSetupHelper.cxx
@@ -57,8 +57,9 @@ std::string VSInstanceInfo::GetInstallLocation() const
return loc;
}
-cmVSSetupAPIHelper::cmVSSetupAPIHelper()
- : setupConfig(NULL)
+cmVSSetupAPIHelper::cmVSSetupAPIHelper(unsigned int version)
+ : Version(version)
+ , setupConfig(NULL)
, setupConfig2(NULL)
, setupHelper(NULL)
, initializationFailure(false)
@@ -88,7 +89,7 @@ bool cmVSSetupAPIHelper::SetVSInstance(std::string const& vsInstallLocation)
return this->EnumerateAndChooseVSInstance();
}
-bool cmVSSetupAPIHelper::IsVS2017Installed()
+bool cmVSSetupAPIHelper::IsVSInstalled()
{
return this->EnumerateAndChooseVSInstance();
}
@@ -312,11 +313,11 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
return false;
std::string envVSCommonToolsDir;
+ std::string envVSCommonToolsDirEnvName =
+ "VS" + std::to_string(this->Version) + "0COMNTOOLS";
- // FIXME: When we support VS versions beyond 2017, the version
- // to choose will be passed in by the caller. We need to map that
- // to a per-version name of this environment variable.
- if (cmSystemTools::GetEnv("VS150COMNTOOLS", envVSCommonToolsDir)) {
+ if (cmSystemTools::GetEnv(envVSCommonToolsDirEnvName.c_str(),
+ envVSCommonToolsDir)) {
cmSystemTools::ConvertToUnixSlashes(envVSCommonToolsDir);
}
@@ -328,8 +329,7 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
return false;
}
- // FIXME: Add a way for caller to specify other versions.
- std::wstring wantVersion = std::to_wstring(15) + L'.';
+ std::wstring const wantVersion = std::to_wstring(this->Version) + L'.';
SmartCOMPtr<ISetupInstance> instance;
while (SUCCEEDED(enumInstances->Next(1, &instance, NULL)) && instance) {