cmGlobalVisualStudioVersionedGenerator: Fix repeating SetGeneratorInstance

Fix logic added by commit 8917b8512f
(cmGlobalVisualStudioVersionedGenerator: Allow repeating
SetGeneratorInstance, 2021-10-20) to avoid repeating work.
This commit is contained in:
Brad King
2021-10-26 13:45:51 -04:00
parent fb6ab54076
commit 9eaf0932af
2 changed files with 6 additions and 2 deletions

View File

@@ -436,9 +436,11 @@ bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName(
bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
std::string const& i, cmMakefile* mf)
{
if (this->GeneratorInstance && i == *(this->GeneratorInstance)) {
if (this->LastGeneratorInstanceString &&
i == *(this->LastGeneratorInstanceString)) {
return true;
}
if (!i.empty()) {
if (!this->vsSetupAPIHelper.SetVSInstance(i)) {
std::ostringstream e;
@@ -478,6 +480,8 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
// The selected instance may have a different MSBuild than previously found.
this->MSBuildCommandInitialized = false;
this->LastGeneratorInstanceString = i;
return true;
}

View File

@@ -76,5 +76,5 @@ private:
class Factory17;
friend class Factory17;
mutable cmVSSetupAPIHelper vsSetupAPIHelper;
cm::optional<std::string> GeneratorInstance;
cm::optional<std::string> LastGeneratorInstanceString;
};