cmLocalGenerator: Add abstraction to check if top-level.

Move from the cmLocalNinjaGenerator.  Fix the case of the name.
This commit is contained in:
Stephen Kelly 2015-05-14 20:40:40 +02:00
parent b17686d2bb
commit c5059c9000
4 changed files with 10 additions and 10 deletions

View File

@ -77,6 +77,11 @@ cmLocalGenerator::~cmLocalGenerator()
delete this->Makefile; delete this->Makefile;
} }
bool cmLocalGenerator::IsRootMakefile() const
{
return !this->GetParent();
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class cmLocalGeneratorCurrent class cmLocalGeneratorCurrent
{ {

View File

@ -37,6 +37,9 @@ public:
cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent); cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
virtual ~cmLocalGenerator(); virtual ~cmLocalGenerator();
/// @return whether we are processing the top CMakeLists.txt file.
bool IsRootMakefile() const;
/** /**
* Generate the makefile for this directory. * Generate the makefile for this directory.
*/ */

View File

@ -48,7 +48,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->isRootMakefile()) if(this->IsRootMakefile())
{ {
this->WriteBuildFileTop(); this->WriteBuildFileTop();
@ -179,11 +179,6 @@ cmake* cmLocalNinjaGenerator::GetCMakeInstance()
return this->GetGlobalGenerator()->GetCMakeInstance(); return this->GetGlobalGenerator()->GetCMakeInstance();
} }
bool cmLocalNinjaGenerator::isRootMakefile() const
{
return !this->GetParent();
}
void cmLocalNinjaGenerator::WriteBuildFileTop() void cmLocalNinjaGenerator::WriteBuildFileTop()
{ {
// For the build file. // For the build file.
@ -312,7 +307,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->GetCurrentListFile() << std::endl << "# " << this->Makefile->GetCurrentListFile() << std::endl
; ;
if(this->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;

View File

@ -59,9 +59,6 @@ public:
std::string const& GetConfigName() const std::string const& GetConfigName() const
{ return this->ConfigName; } { return this->ConfigName; }
/// @return whether we are processing the top CMakeLists.txt file.
bool isRootMakefile() const;
/// @returns the relative path between the HomeOutputDirectory and this /// @returns the relative path between the HomeOutputDirectory and this
/// local generators StartOutputDirectory. /// local generators StartOutputDirectory.
std::string GetHomeRelativeOutputPath() const std::string GetHomeRelativeOutputPath() const