浏览代码

cmGlobalGenerator: Create cmGeneratorTargets before QtAutomoc.

Add cmGeneratorTargets as needed in the QtAutomoc processing.
Stephen Kelly 10 年之前
父节点
当前提交
496f4cd07d
共有 5 个文件被更改,包括 21 次插入4 次删除
  1. 4 2
      Source/cmGlobalGenerator.cxx
  2. 5 0
      Source/cmGlobalGenerator.h
  3. 4 0
      Source/cmMakefile.h
  4. 6 1
      Source/cmQtAutoGenerators.cxx
  5. 2 1
      Source/cmQtAutoGenerators.h

+ 4 - 2
Source/cmGlobalGenerator.cxx

@@ -1234,13 +1234,14 @@ void cmGlobalGenerator::Generate()
 
   this->FinalizeTargetCompileInfo();
 
+  this->CreateGenerationObjects();
+
 #ifdef CMAKE_BUILD_WITH_CMAKE
   // Iterate through all targets and set up automoc for those which have
   // the AUTOMOC, AUTOUIC or AUTORCC property set
   AutogensType autogens;
   this->CreateQtAutoGeneratorsTargets(autogens);
 #endif
-  this->CreateGenerationObjects();
 
   unsigned int i;
 
@@ -1414,7 +1415,8 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens)
             && !target.IsImported())
           {
           cmQtAutoGenerators autogen;
-          if(autogen.InitializeAutogenTarget(&target))
+          if(autogen.InitializeAutogenTarget(this->LocalGenerators[i],
+                                             &target))
             {
             autogens.push_back(std::make_pair(autogen, &target));
             }

+ 5 - 0
Source/cmGlobalGenerator.h

@@ -300,6 +300,11 @@ public:
   /** Get per-target generator information.  */
   cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const;
 
+  void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt)
+  {
+    this->GeneratorTargets[t] = gt;
+  }
+
   const std::map<std::string, std::vector<cmLocalGenerator*> >& GetProjectMap()
                                                const {return this->ProjectMap;}
 

+ 4 - 0
Source/cmMakefile.h

@@ -415,6 +415,10 @@ public:
     {
       this->GeneratorTargets = targets;
     }
+  void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt)
+  {
+    this->GeneratorTargets[t] = gt;
+  }
 
   cmTarget* FindTarget(const std::string& name,
                        bool excludeAliases = false) const;

+ 6 - 1
Source/cmQtAutoGenerators.cxx

@@ -287,7 +287,8 @@ std::string cmQtAutoGenerators::ListQt4RccInputs(cmSourceFile* sf,
   return entriesList;
 }
 
-bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
+bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg,
+                                                 cmTarget* target)
 {
   cmMakefile* makefile = target->GetMakefile();
   // don't do anything if there is no Qt4 or Qt5Core (which contains moc):
@@ -474,6 +475,10 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
                                 /*byproducts=*/rcc_output, depends,
                                 commandLines, false, autogenComment.c_str());
 
+    cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
+    lg->GetGlobalGenerator()->AddGeneratorTarget(autogenTarget, gt);
+    makefile->AddGeneratorTarget(autogenTarget, gt);
+
     // Set target folder
     const char* autogenFolder = makefile->GetState()
                                 ->GetGlobalProperty("AUTOMOC_TARGETS_FOLDER");

+ 2 - 1
Source/cmQtAutoGenerators.h

@@ -18,6 +18,7 @@
 
 class cmGlobalGenerator;
 class cmMakefile;
+class cmLocalGenerator;
 
 class cmQtAutoGenerators
 {
@@ -25,7 +26,7 @@ public:
   cmQtAutoGenerators();
   bool Run(const std::string& targetDirectory, const std::string& config);
 
-  bool InitializeAutogenTarget(cmTarget* target);
+  bool InitializeAutogenTarget(cmLocalGenerator* lg, cmTarget* target);
   void SetupAutoGenerateTarget(cmTarget const* target);
   void SetupSourceFiles(cmTarget const* target);