diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 4fe52dde7fc403ba32f4b9b82d0d9d5223a7b96f..0f61225f5d8f3a65d3849dedfb913a1a7919a810 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -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();
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a42d5a7557996ab23f35a8e9f17e4f20c074bc50..119cba9d8f52bf018dc52a961b8126985c7f48ef 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -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
 {
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 4452eef6586750cf8017495dbde8dcf73ad49f63..a3f95886e83392e9394c5831ca1fae7c84755a98 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -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.
    */
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 427ae106cafc3f9ae20f53aa01d802ce61e7b8bb..4db36fc5bfeb17a40971e82f6b63e24cb79ba987 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -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;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 03380623b7ad77832f0403ceac543e9e5fd95f99..cf7897e4b9f504e654128f4e7e23bce283309057 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1608,6 +1608,11 @@ void cmMakefile::PopMacroScope(bool reportError)
   this->PopFunctionBlockerBarrier(reportError);
 }
 
+bool cmMakefile::IsRootMakefile() const
+{
+  return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid();
+}
+
 //----------------------------------------------------------------------------
 class cmMakefileCurrent
 {
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 86bde0ca7b190958175d72672dd5d20c3d14b0f5..44bd8c61c6479197382b0777eae127a1e44b3d49 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -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.
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 90bc1115ee6431de36b8a55fba977bd073a2eee9..46d7e011327c0238dfca59bfd0fa365f496a0799 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -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