diff options
author | Brad King <brad.king@kitware.com> | 2021-10-20 12:01:53 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-10-20 13:00:25 -0400 |
commit | 6999b871335c26d9d39b05023559254b1437bcf5 (patch) | |
tree | 0840adbe902564d85f75cbf92d4fe5a29124bb1c | |
parent | 7f730464be485862ba89c85248306c893117a595 (diff) | |
download | cmake-6999b871335c26d9d39b05023559254b1437bcf5.tar.gz |
cmGlobalVisualStudio10Generator: Add method to find MSBuild early
Add a way to find MSBuild before the main `FindMakeProgram` code path
has executed.
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 6 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.h | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.h | 2 |
4 files changed, 21 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 499efbbf41..c11516ddb5 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -856,6 +856,12 @@ std::string const& cmGlobalVisualStudio10Generator::GetMSBuildCommand() return this->MSBuildCommand; } +cm::optional<std::string> +cmGlobalVisualStudio10Generator::FindMSBuildCommandEarly(cmMakefile*) +{ + return this->GetMSBuildCommand(); +} + std::string cmGlobalVisualStudio10Generator::FindMSBuildCommand() { std::string msbuild; diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index a5ee284465..6e6239065b 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -134,6 +134,8 @@ public: bool GetSupportsUnityBuilds() const { return this->SupportsUnityBuilds; } + virtual cm::optional<std::string> FindMSBuildCommandEarly(cmMakefile* mf); + bool FindMakeProgram(cmMakefile* mf) override; bool IsIPOSupported() const override { return true; } diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index b6219a6958..ec2e74fd93 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -718,6 +718,17 @@ cmGlobalVisualStudioVersionedGenerator::GetWindows10SDKMaxVersionDefault( return std::string(); } +cm::optional<std::string> +cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommandEarly(cmMakefile* mf) +{ + std::string instance = mf->GetSafeDefinition("CMAKE_GENERATOR_INSTANCE"); + if (!this->SetGeneratorInstance(instance, mf)) { + cmSystemTools::SetFatalErrorOccured(); + return {}; + } + return this->cmGlobalVisualStudio14Generator::FindMSBuildCommandEarly(mf); +} + std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand() { std::string msbuild; diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index 691651fe2c..b7760ac72b 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -31,6 +31,8 @@ public: bool GetVSInstance(std::string& dir) const; + cm::optional<std::string> FindMSBuildCommandEarly(cmMakefile* mf) override; + cm::optional<std::string> GetVSInstanceVersion() const override; AuxToolset FindAuxToolset(std::string& version, |