diff options
author | Brad King <brad.king@kitware.com> | 2021-06-16 14:53:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-06-16 17:22:32 (GMT) |
commit | aabc3ca47d51731e247300e4a6159f41e9dcb17c (patch) | |
tree | dfbc626fa1439840d88dbefb92b59e47d4d97dc8 | |
parent | e66a7fe07b117362120ae62826eb51c189f39c40 (diff) | |
download | CMake-aabc3ca47d51731e247300e4a6159f41e9dcb17c.zip CMake-aabc3ca47d51731e247300e4a6159f41e9dcb17c.tar.gz CMake-aabc3ca47d51731e247300e4a6159f41e9dcb17c.tar.bz2 |
cmGlobalVisualStudio10Generator: Adopt GetVSInstanceVersion method
Port from `cmGlobalVisualStudioVersionedGenerator`.
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.h | 5 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.cxx | 17 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.h | 2 |
3 files changed, 17 insertions, 7 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 2596720..48fe465 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -128,6 +128,11 @@ public: std::string Encoding() override; const char* GetToolsVersion() const; + virtual cm::optional<unsigned long long> GetVSInstanceVersion() const + { + return {}; + } + bool GetSupportsUnityBuilds() const { return this->SupportsUnityBuilds; } bool FindMakeProgram(cmMakefile* mf) override; diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index c11ab1b..50dc30b 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -391,10 +391,15 @@ bool cmGlobalVisualStudioVersionedGenerator::GetVSInstance( return vsSetupAPIHelper.GetVSInstanceInfo(dir); } -bool cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion( - unsigned long long& vsInstanceVersion) const +cm::optional<unsigned long long> +cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion() const { - return vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion); + cm::optional<unsigned long long> result; + unsigned long long vsInstanceVersion; + if (vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion)) { + result = vsInstanceVersion; + } + return result; } bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const @@ -407,9 +412,9 @@ bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const return false; } unsigned long long const vsInstanceVersion16_7_P2 = 4503631666610212; - unsigned long long vsInstanceVersion; - return (this->GetVSInstanceVersion(vsInstanceVersion) && - vsInstanceVersion > vsInstanceVersion16_7_P2); + cm::optional<unsigned long long> vsInstanceVersion = + this->GetVSInstanceVersion(); + return (vsInstanceVersion && *vsInstanceVersion > vsInstanceVersion16_7_P2); } const char* diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index cee129e..105e495 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -28,7 +28,7 @@ public: bool GetVSInstance(std::string& dir) const; - bool GetVSInstanceVersion(unsigned long long& vsInstanceVersion) const; + cm::optional<unsigned long long> GetVSInstanceVersion() const override; AuxToolset FindAuxToolset(std::string& version, std::string& props) const override; |