cmGlobalNinjaGenerator: Save path to 'ninja' tool very early

Keep it in a member variable for convenient reference.  Set the
value as soon as it is known.
This commit is contained in:
Brad King 2015-11-02 16:27:31 -05:00
parent 7748a02c3f
commit ed67f40522
2 changed files with 14 additions and 4 deletions

View File

@ -585,6 +585,15 @@ void cmGlobalNinjaGenerator::Generate()
this->CloseBuildFileStream();
}
void cmGlobalNinjaGenerator::FindMakeProgram(cmMakefile* mf)
{
this->cmGlobalGenerator::FindMakeProgram(mf);
if (const char* ninjaCommand = mf->GetDefinition("CMAKE_MAKE_PROGRAM"))
{
this->NinjaCommand = ninjaCommand;
}
}
void cmGlobalNinjaGenerator
::EnableLanguage(std::vector<std::string>const& langs,
cmMakefile* mf,
@ -1260,8 +1269,7 @@ std::string cmGlobalNinjaGenerator::ninjaCmd() const
{
cmLocalGenerator* lgen = this->LocalGenerators[0];
if (lgen) {
return lgen->ConvertToOutputFormat(
lgen->GetMakefile()->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"),
return lgen->ConvertToOutputFormat(this->NinjaCommand,
cmLocalGenerator::SHELL);
}
return "ninja";

View File

@ -320,7 +320,7 @@ protected:
private:
virtual std::string GetEditCacheCommand() const;
virtual void FindMakeProgram(cmMakefile* mf);
void OpenBuildFileStream();
void CloseBuildFileStream();
@ -392,6 +392,8 @@ private:
typedef std::map<std::string, cmGeneratorTarget*> TargetAliasMap;
TargetAliasMap TargetAliases;
std::string NinjaCommand;
};
#endif // ! cmGlobalNinjaGenerator_h