summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Goshi <jgoshi@microsoft.com>2020-06-02 12:46:07 -0700
committerBrad King <brad.king@kitware.com>2020-06-03 08:58:29 -0400
commit8a7ad923a89030e63e60fb333169abd258732615 (patch)
treeb8c62fad79ab772ab0715aef561abcf18ac8799e
parent35a192788f3a32c56fb5f9b66e097d698e4d03da (diff)
downloadcmake-8a7ad923a89030e63e60fb333169abd258732615.tar.gz
VS: Extract instance version from VS Installer
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx6
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.h2
-rw-r--r--Source/cmVSSetupHelper.cxx14
-rw-r--r--Source/cmVSSetupHelper.h1
4 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 13ae32a554..d44433b339 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -366,6 +366,12 @@ bool cmGlobalVisualStudioVersionedGenerator::GetVSInstance(
return vsSetupAPIHelper.GetVSInstanceInfo(dir);
}
+bool cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion(
+ unsigned long long& vsInstanceVersion) const
+{
+ return vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion);
+}
+
bool cmGlobalVisualStudioVersionedGenerator::IsDefaultToolset(
const std::string& version) const
{
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h
index abb609536e..bcf8546131 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.h
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.h
@@ -29,6 +29,8 @@ public:
bool GetVSInstance(std::string& dir) const;
+ bool GetVSInstanceVersion(unsigned long long& vsInstanceVersion) const;
+
bool IsDefaultToolset(const std::string& version) const override;
std::string GetAuxiliaryToolset() const override;
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx
index dd9f058b89..9626599a30 100644
--- a/Source/cmVSSetupHelper.cxx
+++ b/Source/cmVSSetupHelper.cxx
@@ -258,6 +258,20 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(std::string& vsInstallLocation)
return isInstalled;
}
+bool cmVSSetupAPIHelper::GetVSInstanceVersion(
+ unsigned long long& vsInstanceVersion)
+{
+ vsInstanceVersion = 0;
+ bool isInstalled = this->EnumerateAndChooseVSInstance();
+
+ if (isInstalled) {
+ vsInstanceVersion =
+ static_cast<unsigned long long>(chosenInstanceInfo.ullVersion);
+ }
+
+ return isInstalled;
+}
+
bool cmVSSetupAPIHelper::GetVCToolsetVersion(std::string& vsToolsetVersion)
{
vsToolsetVersion.clear();
diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h
index a2fd3d5548..a926eee924 100644
--- a/Source/cmVSSetupHelper.h
+++ b/Source/cmVSSetupHelper.h
@@ -106,6 +106,7 @@ public:
bool IsVSInstalled();
bool GetVSInstanceInfo(std::string& vsInstallLocation);
+ bool GetVSInstanceVersion(unsigned long long& vsInstanceVersion);
bool GetVCToolsetVersion(std::string& vsToolsetVersion);
bool IsWin10SDKInstalled();
bool IsWin81SDKInstalled();