Ninja: Improve internal check for generating at the top-level (#15436)

Simply check for whether the local generator has a parent instead of
depending on a string comparison of directory names.
This commit is contained in:
Brad King 2015-03-09 09:25:16 -04:00
parent 99575c9ac1
commit a6b0908571
2 changed files with 2 additions and 3 deletions

View File

@ -130,7 +130,7 @@ public:
std::string ConvertToOptionallyRelativeOutputPath(const std::string& remote);
///! set/get the parent generator
cmLocalGenerator* GetParent(){return this->Parent;}
cmLocalGenerator* GetParent() const {return this->Parent;}
void SetParent(cmLocalGenerator* g) { this->Parent = g; g->AddChild(this); }
///! set/get the children

View File

@ -182,8 +182,7 @@ cmake* cmLocalNinjaGenerator::GetCMakeInstance()
bool cmLocalNinjaGenerator::isRootMakefile() const
{
return (strcmp(this->Makefile->GetCurrentDirectory(),
this->GetCMakeInstance()->GetHomeDirectory()) == 0);
return !this->GetParent();
}
void cmLocalNinjaGenerator::WriteBuildFileTop()