1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-13 17:47:49 +08:00

cmGlobalGenerator: FindMakeProgram() at a generator-specific time

d5b5c192 moved FindMakeProgram() to an earlier time, which resulted
in CMAKE_MAKE_PROGRAM not being read from the toolchain file. Change
it to only call FindMakeProgram() early in the specific cases of
Visual Studio and Xcode, and restore the old behavior for all other
generators.

Fixes: #21486
This commit is contained in:
Kyle Edwards
2020-11-23 14:20:08 -05:00
parent d1b6879ece
commit ef91fb02f3
4 changed files with 29 additions and 1 deletions

View File

@@ -584,7 +584,8 @@ void cmGlobalGenerator::EnableLanguage(
// Find the native build tool for this generator.
// This has to be done early so that MSBuild can be used to examine the
// cross-compilation environment.
if (!this->FindMakeProgram(mf)) {
if (this->GetFindMakeProgramStage() == FindMakeProgramStage::Early &&
!this->FindMakeProgram(mf)) {
return;
}
}
@@ -660,6 +661,12 @@ void cmGlobalGenerator::EnableLanguage(
cmSystemTools::SetFatalErrorOccured();
return;
}
// Find the native build tool for this generator.
if (this->GetFindMakeProgramStage() == FindMakeProgramStage::Late &&
!this->FindMakeProgram(mf)) {
return;
}
}
// Check that the languages are supported by the generator and its

View File

@@ -597,6 +597,17 @@ protected:
std::string GetPredefinedTargetsFolder();
enum class FindMakeProgramStage
{
Early,
Late,
};
virtual FindMakeProgramStage GetFindMakeProgramStage() const
{
return FindMakeProgramStage::Late;
}
private:
using TargetMap = std::unordered_map<std::string, cmTarget*>;
using GeneratorTargetMap =

View File

@@ -166,6 +166,11 @@ protected:
void WriteSLNHeader(std::ostream& fout);
FindMakeProgramStage GetFindMakeProgramStage() const override
{
return FindMakeProgramStage::Early;
}
bool ComputeTargetDepends() override;
class VSDependSet : public std::set<std::string>
{

View File

@@ -124,6 +124,11 @@ protected:
void AddExtraIDETargets() override;
void Generate() override;
FindMakeProgramStage GetFindMakeProgramStage() const override
{
return FindMakeProgramStage::Early;
}
private:
bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf);
bool ProcessGeneratorToolsetField(std::string const& key,