diff options
author | Justin Goshi <jgoshi@microsoft.com> | 2020-06-02 19:46:07 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-06-03 12:58:29 (GMT) |
commit | 8a7ad923a89030e63e60fb333169abd258732615 (patch) | |
tree | b8c62fad79ab772ab0715aef561abcf18ac8799e /Source | |
parent | 35a192788f3a32c56fb5f9b66e097d698e4d03da (diff) | |
download | CMake-8a7ad923a89030e63e60fb333169abd258732615.zip CMake-8a7ad923a89030e63e60fb333169abd258732615.tar.gz CMake-8a7ad923a89030e63e60fb333169abd258732615.tar.bz2 |
VS: Extract instance version from VS Installer
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmVSSetupHelper.cxx | 14 | ||||
-rw-r--r-- | Source/cmVSSetupHelper.h | 1 |
4 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 13ae32a..d44433b 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 abb6095..bcf8546 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 dd9f058..9626599 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 a2fd3d5..a926eee 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(); |