cmLocalGenerator: Add IsRootMakefile API
This commit is contained in:
parent
4c6374bcc5
commit
00b8c0a8d4
@ -523,7 +523,7 @@ cmGlobalUnixMakefileGenerator3
|
|||||||
cmLocalUnixMakefileGenerator3* lg)
|
cmLocalUnixMakefileGenerator3* lg)
|
||||||
{
|
{
|
||||||
// Only subdirectories need these rules.
|
// Only subdirectories need these rules.
|
||||||
if(lg->GetMakefile()->IsRootMakefile())
|
if(lg->IsRootMakefile())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1084,7 +1084,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
|
|||||||
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
|
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
|
||||||
// for the passed in makefile or if this is the top Makefile wripte out
|
// for the passed in makefile or if this is the top Makefile wripte out
|
||||||
// the targets
|
// the targets
|
||||||
if (lg2 == lg || lg->GetMakefile()->IsRootMakefile())
|
if (lg2 == lg || lg->IsRootMakefile())
|
||||||
{
|
{
|
||||||
// for each target Generate the rule files for each target.
|
// for each target Generate the rule files for each target.
|
||||||
std::vector<cmGeneratorTarget*> targets = lg2->GetGeneratorTargets();
|
std::vector<cmGeneratorTarget*> targets = lg2->GetGeneratorTargets();
|
||||||
|
@ -490,6 +490,11 @@ void cmLocalGenerator::ComputeTargetManifest()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmLocalGenerator::IsRootMakefile() const
|
||||||
|
{
|
||||||
|
return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid();
|
||||||
|
}
|
||||||
|
|
||||||
cmState* cmLocalGenerator::GetState() const
|
cmState* cmLocalGenerator::GetState() const
|
||||||
{
|
{
|
||||||
return this->GlobalGenerator->GetCMakeInstance()->GetState();
|
return this->GlobalGenerator->GetCMakeInstance()->GetState();
|
||||||
|
@ -67,6 +67,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
void ComputeTargetManifest();
|
void ComputeTargetManifest();
|
||||||
|
|
||||||
|
bool IsRootMakefile() const;
|
||||||
|
|
||||||
///! Get the makefile for this generator
|
///! Get the makefile for this generator
|
||||||
cmMakefile *GetMakefile() {
|
cmMakefile *GetMakefile() {
|
||||||
return this->Makefile; }
|
return this->Makefile; }
|
||||||
|
@ -56,7 +56,7 @@ void cmLocalNinjaGenerator::Generate()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// We do that only once for the top CMakeLists.txt file.
|
// We do that only once for the top CMakeLists.txt file.
|
||||||
if(this->Makefile->IsRootMakefile())
|
if(this->IsRootMakefile())
|
||||||
{
|
{
|
||||||
this->WriteBuildFileTop();
|
this->WriteBuildFileTop();
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
|
|||||||
<< "# Write statements declared in CMakeLists.txt:" << std::endl
|
<< "# Write statements declared in CMakeLists.txt:" << std::endl
|
||||||
<< "# "
|
<< "# "
|
||||||
<< this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE") << std::endl;
|
<< this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE") << std::endl;
|
||||||
if(this->Makefile->IsRootMakefile())
|
if(this->IsRootMakefile())
|
||||||
os << "# Which is the root file." << std::endl;
|
os << "# Which is the root file." << std::endl;
|
||||||
cmGlobalNinjaGenerator::WriteDivider(os);
|
cmGlobalNinjaGenerator::WriteDivider(os);
|
||||||
os << std::endl;
|
os << std::endl;
|
||||||
|
@ -254,7 +254,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// always write the top makefile
|
// always write the top makefile
|
||||||
if (!this->GetMakefile()->IsRootMakefile())
|
if (!this->IsRootMakefile())
|
||||||
{
|
{
|
||||||
ruleFileStream.SetCopyIfDifferent(true);
|
ruleFileStream.SetCopyIfDifferent(true);
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
|
|||||||
// only write local targets unless at the top Keep track of targets already
|
// only write local targets unless at the top Keep track of targets already
|
||||||
// listed.
|
// listed.
|
||||||
std::set<std::string> emittedTargets;
|
std::set<std::string> emittedTargets;
|
||||||
if (!this->GetMakefile()->IsRootMakefile())
|
if (!this->IsRootMakefile())
|
||||||
{
|
{
|
||||||
// write our targets, and while doing it collect up the object
|
// write our targets, and while doing it collect up the object
|
||||||
// file rules
|
// file rules
|
||||||
@ -880,7 +880,7 @@ void cmLocalUnixMakefileGenerator3
|
|||||||
std::vector<std::string> no_depends;
|
std::vector<std::string> no_depends;
|
||||||
std::vector<std::string> commands;
|
std::vector<std::string> commands;
|
||||||
commands.push_back(runRule);
|
commands.push_back(runRule);
|
||||||
if(!this->GetMakefile()->IsRootMakefile())
|
if(!this->IsRootMakefile())
|
||||||
{
|
{
|
||||||
this->CreateCDCommand(commands,
|
this->CreateCDCommand(commands,
|
||||||
this->GetBinaryDirectory(),
|
this->GetBinaryDirectory(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user