cmMakefile: Move IsRoot API from cmLocalGenerator.
This commit is contained in:
parent
217c243db0
commit
8bfaadfa39
|
@ -529,7 +529,7 @@ cmGlobalUnixMakefileGenerator3
|
|||
cmLocalUnixMakefileGenerator3* lg)
|
||||
{
|
||||
// Only subdirectories need these rules.
|
||||
if(lg->IsRootMakefile())
|
||||
if(lg->GetMakefile()->IsRootMakefile())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1034,7 +1034,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
|
|||
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
|
||||
// for the passed in makefile or if this is the top Makefile wripte out
|
||||
// the targets
|
||||
if (lg2 == lg || lg->IsRootMakefile())
|
||||
if (lg2 == lg || lg->GetMakefile()->IsRootMakefile())
|
||||
{
|
||||
// for each target Generate the rule files for each target.
|
||||
cmTargets& targets = lg2->GetMakefile()->GetTargets();
|
||||
|
|
|
@ -68,11 +68,6 @@ cmLocalGenerator::~cmLocalGenerator()
|
|||
delete this->Makefile;
|
||||
}
|
||||
|
||||
bool cmLocalGenerator::IsRootMakefile() const
|
||||
{
|
||||
return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid();
|
||||
}
|
||||
|
||||
void cmLocalGenerator::IssueMessage(cmake::MessageType t,
|
||||
std::string const& text) const
|
||||
{
|
||||
|
|
|
@ -40,9 +40,6 @@ public:
|
|||
cmState::Snapshot snapshot);
|
||||
virtual ~cmLocalGenerator();
|
||||
|
||||
/// @return whether we are processing the top CMakeLists.txt file.
|
||||
bool IsRootMakefile() const;
|
||||
|
||||
/**
|
||||
* Generate the makefile for this directory.
|
||||
*/
|
||||
|
|
|
@ -58,7 +58,7 @@ void cmLocalNinjaGenerator::Generate()
|
|||
#endif
|
||||
|
||||
// We do that only once for the top CMakeLists.txt file.
|
||||
if(this->IsRootMakefile())
|
||||
if(this->Makefile->IsRootMakefile())
|
||||
{
|
||||
this->WriteBuildFileTop();
|
||||
|
||||
|
@ -298,7 +298,7 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
|
|||
<< "# Write statements declared in CMakeLists.txt:" << std::endl
|
||||
<< "# "
|
||||
<< this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE") << std::endl;
|
||||
if(this->IsRootMakefile())
|
||||
if(this->Makefile->IsRootMakefile())
|
||||
os << "# Which is the root file." << std::endl;
|
||||
cmGlobalNinjaGenerator::WriteDivider(os);
|
||||
os << std::endl;
|
||||
|
|
|
@ -1608,6 +1608,11 @@ void cmMakefile::PopMacroScope(bool reportError)
|
|||
this->PopFunctionBlockerBarrier(reportError);
|
||||
}
|
||||
|
||||
bool cmMakefile::IsRootMakefile() const
|
||||
{
|
||||
return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class cmMakefileCurrent
|
||||
{
|
||||
|
|
|
@ -90,6 +90,9 @@ public:
|
|||
*/
|
||||
void AddFunctionBlocker(cmFunctionBlocker* fb);
|
||||
|
||||
/// @return whether we are processing the top CMakeLists.txt file.
|
||||
bool IsRootMakefile() const;
|
||||
|
||||
/**
|
||||
* Remove the function blocker whose scope ends with the given command.
|
||||
* This returns ownership of the function blocker object.
|
||||
|
|
|
@ -53,7 +53,7 @@ bool cmProjectCommand
|
|||
// CMAKE_PROJECT_NAME will match PROJECT_NAME, and cmake --build
|
||||
// will work.
|
||||
if(!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME")
|
||||
|| (this->Makefile->GetLocalGenerator()->IsRootMakefile()))
|
||||
|| (this->Makefile->IsRootMakefile()))
|
||||
{
|
||||
this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str());
|
||||
this->Makefile->AddCacheDefinition
|
||||
|
|
Loading…
Reference in New Issue