From 8917b8512f20147b22ac8a7bf78245ab0162acaf Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 20 Oct 2021 11:58:39 -0400 Subject: cmGlobalVisualStudioVersionedGenerator: Allow repeating SetGeneratorInstance --- Source/cmGlobalVisualStudioVersionedGenerator.cxx | 6 ++++++ Source/cmGlobalVisualStudioVersionedGenerator.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 3ecf32e..b6219a6 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -436,6 +436,9 @@ bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName( bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance( std::string const& i, cmMakefile* mf) { + if (this->GeneratorInstance && i == *(this->GeneratorInstance)) { + return true; + } if (!i.empty()) { if (!this->vsSetupAPIHelper.SetVSInstance(i)) { std::ostringstream e; @@ -472,6 +475,9 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance( cmStateEnums::INTERNAL); } + // The selected instance may have a different MSBuild than previously found. + this->MSBuildCommandInitialized = false; + return true; } diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index f07492d..691651f 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -8,6 +8,8 @@ #include #include +#include + #include "cmGlobalVisualStudio14Generator.h" #include "cmVSSetupHelper.h" @@ -72,4 +74,5 @@ private: class Factory17; friend class Factory17; mutable cmVSSetupAPIHelper vsSetupAPIHelper; + cm::optional GeneratorInstance; }; -- cgit v0.12