diff options
author | Brad King <brad.king@kitware.com> | 2022-12-08 13:03:04 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-12-08 13:03:20 (GMT) |
commit | 986fce1fa7c1ec53871eeda5bcabdedab5427bd1 (patch) | |
tree | 61406b7982e0d20ef1b97731e311fb4c6df692f1 /Source | |
parent | 239beca1e3743ec693643869621cd0e41ed10a16 (diff) | |
parent | 5ce0f03cce95fc78af766ca3e54bbab392cbb0d5 (diff) | |
download | CMake-986fce1fa7c1ec53871eeda5bcabdedab5427bd1.zip CMake-986fce1fa7c1ec53871eeda5bcabdedab5427bd1.tar.gz CMake-986fce1fa7c1ec53871eeda5bcabdedab5427bd1.tar.bz2 |
Merge topic 'vs-version-var'
5ce0f03cce VS: Add a variable to report the Visual Studio version build number
55529c5e93 Help: Factor out VS Build Number components document fragment
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8000
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 59f1dc2..415eb7c 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -521,6 +521,7 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance( { if (this->LastGeneratorInstanceString && i == *(this->LastGeneratorInstanceString)) { + this->SetVSVersionVar(mf); return true; } @@ -592,6 +593,8 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance( cmStateEnums::INTERNAL); } + this->SetVSVersionVar(mf); + // The selected instance may have a different MSBuild than previously found. this->MSBuildCommandInitialized = false; @@ -672,6 +675,13 @@ bool cmGlobalVisualStudioVersionedGenerator::ParseGeneratorInstance( return true; } +void cmGlobalVisualStudioVersionedGenerator::SetVSVersionVar(cmMakefile* mf) +{ + if (cm::optional<std::string> vsVer = this->GetVSInstanceVersion()) { + mf->AddDefinition("CMAKE_VS_VERSION_BUILD_NUMBER", *vsVer); + } +} + bool cmGlobalVisualStudioVersionedGenerator::ProcessGeneratorInstanceField( std::string const& key, std::string const& value) { diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index 4c69aeb..45aca74 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -93,6 +93,7 @@ private: mutable cmVSSetupAPIHelper vsSetupAPIHelper; bool ParseGeneratorInstance(std::string const& is, cmMakefile* mf); + void SetVSVersionVar(cmMakefile* mf); std::string GeneratorInstance; std::string GeneratorInstanceVersion; |