summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-10-20 11:58:39 -0400
committerBrad King <brad.king@kitware.com>2021-10-20 13:00:25 -0400
commit8917b8512f20147b22ac8a7bf78245ab0162acaf (patch)
tree02fe725839ff6f2fa51dad09d441a8549a4dde9e
parent6511654164dd483b4ff0c3eb5775d5fdb2c53564 (diff)
downloadcmake-8917b8512f20147b22ac8a7bf78245ab0162acaf.tar.gz
cmGlobalVisualStudioVersionedGenerator: Allow repeating SetGeneratorInstance
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx6
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 3ecf32e245..b6219a6958 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 f07492dff5..691651fe2c 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.h
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.h
@@ -8,6 +8,8 @@
#include <memory>
#include <string>
+#include <cm/optional>
+
#include "cmGlobalVisualStudio14Generator.h"
#include "cmVSSetupHelper.h"
@@ -72,4 +74,5 @@ private:
class Factory17;
friend class Factory17;
mutable cmVSSetupAPIHelper vsSetupAPIHelper;
+ cm::optional<std::string> GeneratorInstance;
};