瀏覽代碼

cmMakefile: Move IsRoot API from cmLocalGenerator.

Stephen Kelly 10 年之前
父節點
當前提交
8bfaadfa39

+ 2 - 2
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();

+ 0 - 5
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
 {

+ 0 - 3
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.
    */

+ 2 - 2
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;

+ 5 - 0
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
 {

+ 3 - 0
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.

+ 1 - 1
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