summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBasil Fierz <basil.fierz@hotmail.com>2018-06-20 22:34:54 +0200
committerBrad King <brad.king@kitware.com>2018-06-22 10:07:09 -0400
commitb759f7068f4e263917ab029f9e9a518dfd386ddb (patch)
tree93b55090a09b54786a8c03eb8adfd527d1c0d583
parentd548994afcfccbff17fcba5698ed10f083142059 (diff)
downloadcmake-b759f7068f4e263917ab029f9e9a518dfd386ddb.tar.gz
cmVSSetupHelper: Expose default toolset version
We already detect the VS toolset version. Expose it to clients.
-rw-r--r--Source/cmVSSetupHelper.cxx13
-rw-r--r--Source/cmVSSetupHelper.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx
index 4ca847e16e..22fe007bae 100644
--- a/Source/cmVSSetupHelper.cxx
+++ b/Source/cmVSSetupHelper.cxx
@@ -199,6 +199,7 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(
if (!cmSystemTools::FileIsDirectory(vcToolsDir)) {
return false;
}
+ vsInstanceInfo.VCToolsetVersion = vcToolsVersion;
}
// Reboot may have been required before the product package was registered
@@ -254,6 +255,18 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(std::string& vsInstallLocation)
return isInstalled;
}
+bool cmVSSetupAPIHelper::GetVCToolsetVersion(std::string& vsToolsetVersion)
+{
+ vsToolsetVersion.clear();
+ bool isInstalled = this->EnumerateAndChooseVSInstance();
+
+ if (isInstalled) {
+ vsToolsetVersion = chosenInstanceInfo.VCToolsetVersion;
+ }
+
+ return isInstalled && !vsToolsetVersion.empty();
+}
+
bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
{
bool isVSInstanceExists = false;
diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h
index 8ce36de4af..4144c15415 100644
--- a/Source/cmVSSetupHelper.h
+++ b/Source/cmVSSetupHelper.h
@@ -107,6 +107,7 @@ struct VSInstanceInfo
std::wstring InstanceId;
std::wstring VSInstallLocation;
std::wstring Version;
+ std::string VCToolsetVersion;
ULONGLONG ullVersion = 0;
bool IsWin10SDKInstalled = false;
bool IsWin81SDKInstalled = false;
@@ -126,6 +127,7 @@ public:
bool IsVS2017Installed();
bool GetVSInstanceInfo(std::string& vsInstallLocation);
+ bool GetVCToolsetVersion(std::string& vsToolsetVersion);
bool IsWin10SDKInstalled();
bool IsWin81SDKInstalled();