[Cmake-commits] CMake branch, next, updated. v3.4.0-rc1-536-gb824a0a

Brad King brad.king at kitware.com
Wed Oct 14 13:32:31 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  b824a0a146246ec959b7a40f72a8557d163ab090 (commit)
       via  2293d43d00ddcff86c70f0b06014223f3b01e36c (commit)
       via  488723f5cd9bec3f7b35b26c89ce2d92ad7d4db4 (commit)
      from  d2d09aece23f023f3e81586811a31abac0e3292f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b824a0a146246ec959b7a40f72a8557d163ab090
commit b824a0a146246ec959b7a40f72a8557d163ab090
Merge: d2d09ae 2293d43
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Oct 14 13:32:30 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Oct 14 13:32:30 2015 -0400

    Merge topic 'genex-generator-objects' into next
    
    2293d43d cmLocalGenerator: Store cmGeneratorTargets.
    488723f5 cmMakefile: Store container of cmExportBuildFileGenerators.


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2293d43d00ddcff86c70f0b06014223f3b01e36c
commit 2293d43d00ddcff86c70f0b06014223f3b01e36c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Sep 16 05:21:07 2015 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 14 13:32:09 2015 -0400

    cmLocalGenerator: Store cmGeneratorTargets.
    
    Relieve cmMakefile of this responsibility.

diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 7f02afe..618f09f 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -43,7 +43,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
 {
   std::string const& argv0 = this->CC.GetCommandLines()[c][0];
   cmGeneratorTarget* target =
-      this->LG->GetMakefile()->FindGeneratorTargetToUse(argv0);
+      this->LG->FindGeneratorTargetToUse(argv0);
   if(target && target->GetType() == cmTarget::EXECUTABLE &&
      (target->Target->IsImported()
       || !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING")))
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 560cfc5..6c3cccd 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -42,7 +42,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
         tei = targets.begin();
       tei != targets.end(); ++tei)
     {
-    cmGeneratorTarget *te = this->LG->GetMakefile()
+    cmGeneratorTarget *te = this->LG
                                 ->FindGeneratorTargetToUse(*tei);
     expectedTargets += sep + this->Namespace + te->Target->GetExportName();
     sep = " ";
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index fdfa35e..b7aeb02 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -965,8 +965,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
        it != this->GlobalGenerator->GetLocalGenerators().end();
        ++it)
     {
-    cmGeneratorTargetsType targets = (*it)->GetMakefile()
-                                        ->GetGeneratorTargets();
+    cmGeneratorTargetsType targets = (*it)->GetGeneratorTargets();
     for (cmGeneratorTargetsType::iterator l = targets.begin();
          l != targets.end(); ++l)
       {
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 2797d10..fe83b08 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1275,7 +1275,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
 
     std::string tgtName = parameters.front();
     cmGeneratorTarget* gt =
-                context->LG->GetMakefile()->FindGeneratorTargetToUse(tgtName);
+                context->LG->FindGeneratorTargetToUse(tgtName);
     if (!gt)
       {
       std::ostringstream e;
@@ -1739,7 +1739,7 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
       return std::string();
       }
     cmGeneratorTarget* target =
-        context->LG->GetMakefile()->FindGeneratorTargetToUse(name);
+        context->LG->FindGeneratorTargetToUse(name);
     if(!target)
       {
       ::reportError(context, content->GetOriginalExpression(),
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 6033efe..6bebc2b 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2305,7 +2305,8 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
 
   // Check for a target with this name.
   if(cmGeneratorTarget* t
-                    = this->Makefile->FindGeneratorTargetToUse(util))
+                    = this->GeneratorTarget->
+                    GetLocalGenerator()->FindGeneratorTargetToUse(util))
     {
     // If we find the target and the dep was given as a full path,
     // then make sure it was not a full path to something else, and
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 9ac0019..e8be2d6 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1578,7 +1578,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
     this->GeneratorTargets[*j] = gt;
     generatorTargets[*j] = gt;
     }
-  mf->SetGeneratorTargets(generatorTargets);
+  lg->SetGeneratorTargets(generatorTargets);
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 87cf58f..45a1509 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -287,7 +287,7 @@ void cmGlobalGhsMultiGenerator::Generate()
       {
       cmLocalGhsMultiGenerator *lg =
         static_cast<cmLocalGhsMultiGenerator *>(this->LocalGenerators[i]);
-      cmGeneratorTargetsType tgts = lg->GetMakefile()->GetGeneratorTargets();
+      cmGeneratorTargetsType tgts = lg->GetGeneratorTargets();
       this->UpdateBuildFiles(&tgts);
       }
     }
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index f955ef7..ed36634 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -68,8 +68,7 @@ void cmGlobalKdevelopGenerator::Generate()
     for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
          lg!=lgs.end(); lg++)
       {
-      cmMakefile* makefile=(*lg)->GetMakefile();
-      cmGeneratorTargetsType const& targets = makefile->GetGeneratorTargets();
+      cmGeneratorTargetsType const& targets = (*lg)->GetGeneratorTargets();
       for (cmGeneratorTargetsType::const_iterator ti = targets.begin();
            ti != targets.end(); ti++)
         {
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 218e702..f9740e5 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -461,7 +461,7 @@ cmGlobalUnixMakefileGenerator3
   // The directory-level rule should depend on the target-level rules
   // for all targets in the directory.
   std::vector<std::string> depends;
-  cmGeneratorTargetsType targets = lg->GetMakefile()->GetGeneratorTargets();
+  cmGeneratorTargetsType targets = lg->GetGeneratorTargets();
   for(cmGeneratorTargetsType::iterator l = targets.begin();
       l != targets.end(); ++l)
     {
@@ -627,7 +627,7 @@ cmGlobalUnixMakefileGenerator3
     lg = static_cast<cmLocalUnixMakefileGenerator3 *>
       (this->LocalGenerators[i]);
     // for each target Generate the rule files for each target.
-    cmGeneratorTargetsType targets = lg->GetMakefile()->GetGeneratorTargets();
+    cmGeneratorTargetsType targets = lg->GetGeneratorTargets();
     for(cmGeneratorTargetsType::iterator t = targets.begin();
         t != targets.end(); ++t)
       {
@@ -728,7 +728,7 @@ cmGlobalUnixMakefileGenerator3
   depends.push_back("cmake_check_build_system");
 
   // for each target Generate the rule files for each target.
-  cmGeneratorTargetsType targets = lg->GetMakefile()->GetGeneratorTargets();
+  cmGeneratorTargetsType targets = lg->GetGeneratorTargets();
   for(cmGeneratorTargetsType::iterator t = targets.begin();
       t != targets.end(); ++t)
     {
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 0bdb008..8cb7d24 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -256,7 +256,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
                           noCommandLines);
 
   cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
-  mf->AddGeneratorTarget(tgt, gt);
+  lg->AddGeneratorTarget(tgt, gt);
 
   // Organize in the "predefined targets" folder:
   //
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 6a25ed0..fa9c606 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -87,7 +87,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
                           "Build all projects");
 
       cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
-      allBuild->GetMakefile()->AddGeneratorTarget(allBuild, gt);
+      gen[0]->AddGeneratorTarget(allBuild, gt);
 
 #if 0
       // Can't activate this code because we want ALL_BUILD
@@ -108,7 +108,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
           i != gen.end(); ++i)
         {
         cmGeneratorTargetsType targets =
-            (*i)->GetMakefile()->GetGeneratorTargets();
+            (*i)->GetGeneratorTargets();
         for(cmGeneratorTargetsType::iterator t = targets.begin();
             t != targets.end(); ++t)
           {
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index bc67833..6291796 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -459,7 +459,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
                         "echo", "Build all projects");
 
   cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
-  mf->AddGeneratorTarget(allbuild, allBuildGt);
+  root->AddGeneratorTarget(allbuild, allBuildGt);
 
   // Refer to the main build configuration file for easy editing.
   std::string listfile = root->GetCurrentSourceDirectory();
@@ -494,7 +494,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
                           "make", "-f", file.c_str());
 
     cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
-    mf->AddGeneratorTarget(check, checkGt);
+    root->AddGeneratorTarget(check, checkGt);
     }
 
   // now make the allbuild depend on all the non-utility targets
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index f19d551..3691b41 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -132,7 +132,7 @@ void cmLocalGenerator::TraceDependencies()
     this->GlobalGenerator->CreateEvaluationSourceFiles(*ci);
     }
   // Generate the rule files for each target.
-  cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
+  cmGeneratorTargetsType targets = this->GetGeneratorTargets();
   for(cmGeneratorTargetsType::iterator t = targets.begin();
       t != targets.end(); ++t)
     {
@@ -448,6 +448,13 @@ void cmLocalGenerator::GenerateInstallRules()
     }
 }
 
+
+void cmLocalGenerator::AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt)
+{
+  this->GeneratorTargets[t] = gt;
+  this->GetGlobalGenerator()->AddGeneratorTarget(t, gt);
+}
+
 //----------------------------------------------------------------------------
 void cmLocalGenerator::ComputeTargetManifest()
 {
@@ -460,7 +467,7 @@ void cmLocalGenerator::ComputeTargetManifest()
     }
 
   // Add our targets to the manifest for each configuration.
-  cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
+  cmGeneratorTargetsType targets = this->GetGeneratorTargets();
   for(cmGeneratorTargetsType::iterator t = targets.begin();
       t != targets.end(); ++t)
     {
@@ -1767,6 +1774,17 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
 }
 
 //----------------------------------------------------------------------------
+cmGeneratorTarget*
+cmLocalGenerator::FindGeneratorTargetToUse(const std::string& name) const
+{
+  if (cmTarget *t = this->Makefile->FindTargetToUse(name))
+    {
+    return this->GetGlobalGenerator()->GetGeneratorTarget(t);
+    }
+  return 0;
+}
+
+//----------------------------------------------------------------------------
 bool cmLocalGenerator::GetRealDependency(const std::string& inName,
                                          const std::string& config,
                                          std::string& dep)
@@ -1792,7 +1810,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
 
   // Look for a CMake target with the given name.
   if(cmGeneratorTarget* target =
-     this->Makefile->FindGeneratorTargetToUse(name))
+     this->FindGeneratorTargetToUse(name))
     {
     // make sure it is not just a coincidence that the target name
     // found is part of the inName
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 758709a..97e3f88 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -112,6 +112,19 @@ public:
                               bool forResponseFile = false,
                               const std::string& config = "");
 
+  const cmGeneratorTargetsType &GetGeneratorTargets() const
+    {
+      return this->GeneratorTargets;
+    }
+
+  void SetGeneratorTargets(const cmGeneratorTargetsType &targets)
+    {
+      this->GeneratorTargets = targets;
+    }
+  void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt);
+
+  cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const;
+
   /**
    * Encode a list of preprocessor definitions for the compiler
    * command line.
@@ -354,6 +367,7 @@ protected:
   std::set<std::string> ObjectMaxPathViolations;
 
   std::set<cmTarget const*> WarnCMP0063;
+  cmGeneratorTargetsType GeneratorTargets;
 
   bool EmitUniversalBinaryFlags;
 
diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx
index bac989f..721f239 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -26,7 +26,7 @@ cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator() {}
 
 void cmLocalGhsMultiGenerator::Generate()
 {
-  cmGeneratorTargetsType tgts = this->GetMakefile()->GetGeneratorTargets();
+  cmGeneratorTargetsType tgts = this->GetGeneratorTargets();
 
   for (cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end();
        ++l)
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 6319f0e..8d71469 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -73,7 +73,7 @@ void cmLocalNinjaGenerator::Generate()
       }
     }
 
-  cmGeneratorTargetsType targets = this->GetMakefile()->GetGeneratorTargets();
+  cmGeneratorTargetsType targets = this->GetGeneratorTargets();
   for(cmGeneratorTargetsType::iterator t = targets.begin();
       t != targets.end(); ++t)
     {
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index bf5afc1..91c7acd 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -113,7 +113,7 @@ void cmLocalUnixMakefileGenerator3::Generate()
     this->Makefile->IsOn("CMAKE_SKIP_ASSEMBLY_SOURCE_RULES");
 
   // Generate the rule files for each target.
-  cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
+  cmGeneratorTargetsType targets = this->GetGeneratorTargets();
   cmGlobalUnixMakefileGenerator3* gg =
     static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
   for(cmGeneratorTargetsType::iterator t = targets.begin();
@@ -175,7 +175,7 @@ void cmLocalUnixMakefileGenerator3::
 GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
 {
   std::set<std::string> emitted;
-  cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
+  cmGeneratorTargetsType targets = this->GetGeneratorTargets();
   for(cmGeneratorTargetsType::iterator ti = targets.begin();
       ti != targets.end(); ++ti)
     {
@@ -418,7 +418,7 @@ void cmLocalUnixMakefileGenerator3
 
   // for each target we just provide a rule to cd up to the top and do a make
   // on the target
-  cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
+  cmGeneratorTargetsType targets = this->GetGeneratorTargets();
   std::string localName;
   for(cmGeneratorTargetsType::iterator t = targets.begin();
       t != targets.end(); ++t)
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index f2f7ee7..8ac6358 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1812,12 +1812,6 @@ const char* cmMakefile::GetCurrentBinaryDirectory() const
   return this->StateSnapshot.GetDirectory().GetCurrentBinary();
 }
 
-void cmMakefile::AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt)
-{
-  this->GeneratorTargets[t] = gt;
-  this->GetGlobalGenerator()->AddGeneratorTarget(t, gt);
-}
-
 //----------------------------------------------------------------------------
 void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
                                        bool before)
@@ -4321,17 +4315,6 @@ bool cmMakefile::IsAlias(const std::string& name) const
 }
 
 //----------------------------------------------------------------------------
-cmGeneratorTarget*
-cmMakefile::FindGeneratorTargetToUse(const std::string& name) const
-{
-  if (cmTarget *t = this->FindTargetToUse(name))
-    {
-    return this->GetGlobalGenerator()->GetGeneratorTarget(t);
-    }
-  return 0;
-}
-
-//----------------------------------------------------------------------------
 bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
                                    bool isCustom) const
 {
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 46fdc94..8fe0bda 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -17,7 +17,6 @@
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmNewLineStyle.h"
-#include "cmGeneratorTarget.h"
 #include "cmExpandedCommandArgument.h"
 #include "cmake.h"
 #include "cmState.h"
@@ -393,17 +392,6 @@ public:
       return this->ImportedTargetsOwned;
     }
 
-  const cmGeneratorTargetsType &GetGeneratorTargets() const
-    {
-      return this->GeneratorTargets;
-    }
-
-  void SetGeneratorTargets(const cmGeneratorTargetsType &targets)
-    {
-      this->GeneratorTargets = targets;
-    }
-  void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt);
-
   cmTarget* FindTarget(const std::string& name,
                        bool excludeAliases = false) const;
 
@@ -412,7 +400,6 @@ public:
   cmTarget* FindTargetToUse(const std::string& name,
                             bool excludeAliases = false) const;
   bool IsAlias(const std::string& name) const;
-  cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const;
 
   /**
    * Mark include directories as system directories.
@@ -816,7 +803,6 @@ protected:
   typedef std::map<std::string, cmTarget*> TargetMap;
 #endif
   TargetMap AliasTargets;
-  cmGeneratorTargetsType GeneratorTargets;
   std::vector<cmSourceFile*> SourceFiles;
 
   // Tests
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 6e3f65f..f9875b3 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -886,7 +886,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
                                 commandLines, false, autogenComment.c_str());
 
     cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
-    makefile->AddGeneratorTarget(autogenTarget, gt);
+    lg->AddGeneratorTarget(autogenTarget, gt);
 
     // Set target folder
     const char* autogenFolder = makefile->GetState()
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 7dec50b..85fb405 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -89,7 +89,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
   // be translated.
   std::string exe = command[0];
   cmGeneratorTarget* target =
-      this->LG->GetMakefile()->FindGeneratorTargetToUse(exe);
+      this->LG->FindGeneratorTargetToUse(exe);
   if(target && target->GetType() == cmTarget::EXECUTABLE)
     {
     // Use the target file on disk.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=488723f5cd9bec3f7b35b26c89ce2d92ad7d4db4
commit 488723f5cd9bec3f7b35b26c89ce2d92ad7d4db4
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Sep 16 22:08:22 2015 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 14 13:32:09 2015 -0400

    cmMakefile: Store container of cmExportBuildFileGenerators.
    
    Set a cmLocalGenerator on each instance at compute time.  That will
    soon be needed to access cmGeneratorTarget instances.
    
    If a cmExportBuildFileGenerator is processed early during configure time as a
    result of CMP0024 it must be removed from the list to process later at generate
    time.

diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 400fa17..560cfc5 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -18,13 +18,18 @@
 
 //----------------------------------------------------------------------------
 cmExportBuildFileGenerator::cmExportBuildFileGenerator()
-  : Backtrace()
 {
-  this->Makefile = 0;
+  this->LG = 0;
   this->ExportSet = 0;
 }
 
 //----------------------------------------------------------------------------
+void cmExportBuildFileGenerator::Compute(cmLocalGenerator* lg)
+{
+  this->LG = lg;
+}
+
+//----------------------------------------------------------------------------
 bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
 {
   std::vector<cmGeneratorTarget*> allTargets;
@@ -37,7 +42,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
         tei = targets.begin();
       tei != targets.end(); ++tei)
     {
-    cmGeneratorTarget *te = this->Makefile
+    cmGeneratorTarget *te = this->LG->GetMakefile()
                                 ->FindGeneratorTargetToUse(*tei);
     expectedTargets += sep + this->Namespace + te->Target->GetExportName();
     sep = " ";
@@ -49,8 +54,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
       {
       std::ostringstream e;
       e << "given target \"" << te->GetName() << "\" more than once.";
-      this->Makefile->GetCMakeInstance()
-          ->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Backtrace);
+      this->LG->GetGlobalGenerator()->GetCMakeInstance()
+          ->IssueMessage(cmake::FATAL_ERROR, e.str(),
+                         this->LG->GetMakefile()->GetBacktrace());
       return false;
       }
     if (te->GetType() == cmTarget::INTERFACE_LIBRARY)
@@ -328,8 +334,9 @@ cmExportBuildFileGenerator
   e << "If the required target is not easy to reference in this call, "
     << "consider using the APPEND option with multiple separate calls.";
 
-  this->Makefile->GetCMakeInstance()
-      ->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Backtrace);
+  this->LG->GetGlobalGenerator()->GetCMakeInstance()
+      ->IssueMessage(cmake::FATAL_ERROR, e.str(),
+                     this->LG->GetMakefile()->GetBacktrace());
 }
 
 std::string
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index ff3d2e1..16695f1 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -43,10 +43,7 @@ public:
   /** Set whether to append generated code to the output file.  */
   void SetAppendMode(bool append) { this->AppendMode = append; }
 
-  void SetMakefile(cmMakefile *mf) {
-    this->Makefile = mf;
-    this->Backtrace = this->Makefile->GetBacktrace();
-  }
+  void Compute(cmLocalGenerator* lg);
 
 protected:
   // Implement virtual methods from the superclass.
@@ -80,8 +77,7 @@ protected:
   std::vector<std::string> Targets;
   cmExportSet *ExportSet;
   std::vector<cmGeneratorTarget*> Exports;
-  cmMakefile* Makefile;
-  cmListFileBacktrace Backtrace;
+  cmLocalGenerator* LG;
 };
 
 #endif
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 6a1d7f3..c2d9cc4 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -221,7 +221,7 @@ bool cmExportCommand
     {
     ebfg->SetTargets(targets);
     }
-  ebfg->SetMakefile(this->Makefile);
+  this->Makefile->AddExportBuildFileGenerator(ebfg);
   ebfg->SetExportOld(this->ExportOld.IsEnabled());
 
   // Compute the set of configurations exported.
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 6750611..9ac0019 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -73,7 +73,7 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
   this->CurrentMakefile = 0;
   this->TryCompileOuterMakefile = 0;
 
-  this->ConfigureDoneCMP0026 = false;
+  this->ConfigureDoneCMP0026AndCMP0024 = false;
 }
 
 cmGlobalGenerator::~cmGlobalGenerator()
@@ -234,6 +234,16 @@ bool cmGlobalGenerator::GenerateImportFile(const std::string &file)
   if (it != this->BuildExportSets.end())
     {
     bool result = it->second->GenerateImportFile();
+
+    if (!this->ConfigureDoneCMP0026AndCMP0024)
+      {
+      for (std::vector<cmMakefile*>::const_iterator mit =
+           this->Makefiles.begin(); mit != this->Makefiles.end(); ++mit)
+        {
+        (*mit)->RemoveExportBuildFileGeneratorCMP0024(it->second);
+        }
+      }
+
     delete it->second;
     it->second = 0;
     this->BuildExportSets.erase(it);
@@ -1122,11 +1132,11 @@ void cmGlobalGenerator::Configure()
       this->CMakeInstance->GetHomeOutputDirectory());
 
   // now do it
-  this->ConfigureDoneCMP0026 = false;
+  this->ConfigureDoneCMP0026AndCMP0024 = false;
   dirMf->Configure();
   dirMf->EnforceDirectoryLevelRules();
 
-  this->ConfigureDoneCMP0026 = true;
+  this->ConfigureDoneCMP0026AndCMP0024 = true;
 
   // Put a copy of each global target in every directory.
   cmTargets globalTargets;
@@ -1226,6 +1236,20 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const
   return false;
 }
 
+void cmGlobalGenerator::ComputeBuildFileGenerators()
+{
+  for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
+    {
+    std::vector<cmExportBuildFileGenerator*> gens =
+        this->Makefiles[i]->GetExportBuildFileGenerators();
+    for (std::vector<cmExportBuildFileGenerator*>::const_iterator it =
+         gens.begin(); it != gens.end(); ++it)
+      {
+      (*it)->Compute(this->LocalGenerators[i]);
+      }
+    }
+}
+
 bool cmGlobalGenerator::Compute()
 {
   // Some generators track files replaced during the Generate.
@@ -1255,6 +1279,8 @@ bool cmGlobalGenerator::Compute()
       this->CreateQtAutoGeneratorsTargets();
 #endif
 
+  this->ComputeBuildFileGenerators();
+
   unsigned int i;
 
   // Add generator specific helper commands
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 55e3766..fc81708 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -362,7 +362,10 @@ public:
   cmFileLockPool& GetFileLockPool() { return FileLockPool; }
 #endif
 
-  bool GetConfigureDoneCMP0026() const { return this->ConfigureDoneCMP0026; }
+  bool GetConfigureDoneCMP0026() const
+  { return this->ConfigureDoneCMP0026AndCMP0024; }
+
+  void ComputeBuildFileGenerators();
 
   std::string MakeSilentFlag;
 protected:
@@ -520,7 +523,7 @@ protected:
   bool ForceUnixPaths;
   bool ToolSupportsColor;
   bool InstallTargetEnabled;
-  bool ConfigureDoneCMP0026;
+  bool ConfigureDoneCMP0026AndCMP0024;
 };
 
 #endif
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index 8890e2b..97d4d56 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -126,6 +126,7 @@ bool cmIncludeCommand
         }
       }
     gg->CreateGenerationObjects();
+    gg->ComputeBuildFileGenerators();
     gg->GenerateImportFile(fname_abs);
     }
 
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 73d3522..f2f7ee7 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -702,6 +702,29 @@ cmMakefile::GetEvaluationFiles() const
   return this->EvaluationFiles;
 }
 
+std::vector<cmExportBuildFileGenerator*>
+cmMakefile::GetExportBuildFileGenerators() const
+{
+  return this->ExportBuildFileGenerators;
+}
+
+void cmMakefile::RemoveExportBuildFileGeneratorCMP0024(
+    cmExportBuildFileGenerator* gen)
+{
+  std::vector<cmExportBuildFileGenerator*>::iterator it =
+      std::find(this->ExportBuildFileGenerators.begin(),
+                this->ExportBuildFileGenerators.end(), gen);
+  if(it != this->ExportBuildFileGenerators.end())
+    {
+    this->ExportBuildFileGenerators.erase(it);
+    }
+}
+
+void cmMakefile::AddExportBuildFileGenerator(cmExportBuildFileGenerator* gen)
+{
+  this->ExportBuildFileGenerators.push_back(gen);
+}
+
 namespace
 {
   struct file_not_persistent
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 0a8dcd5..46fdc94 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -51,6 +51,7 @@ class cmake;
 class cmMakefileCall;
 class cmCMakePolicyCommand;
 class cmGeneratorExpressionEvaluationFile;
+class cmExportBuildFileGenerator;
 
 /** \class cmMakefile
  * \brief Process the input CMakeLists.txt file.
@@ -789,6 +790,11 @@ public:
                   bool inputIsContent);
   std::vector<cmGeneratorExpressionEvaluationFile*> GetEvaluationFiles() const;
 
+  std::vector<cmExportBuildFileGenerator*>
+  GetExportBuildFileGenerators() const;
+  void RemoveExportBuildFileGeneratorCMP0024(cmExportBuildFileGenerator* gen);
+  void AddExportBuildFileGenerator(cmExportBuildFileGenerator* gen);
+
 protected:
   // add link libraries and directories to the target
   void AddGlobalLinkInformation(const std::string& name, cmTarget& target);
@@ -882,6 +888,7 @@ private:
   mutable cmsys::RegularExpression cmNamedCurly;
 
   std::vector<cmMakefile*> UnConfiguredDirectories;
+  std::vector<cmExportBuildFileGenerator*> ExportBuildFileGenerators;
 
   std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles;
 
diff --git a/bootstrap b/bootstrap
index ca86528..54f7ca6 100755
--- a/bootstrap
+++ b/bootstrap
@@ -261,6 +261,7 @@ CMAKE_CXX_SOURCES="\
   cmPropertyDefinitionMap \
   cmMakeDepend \
   cmMakefile \
+  cmExportBuildFileGenerator \
   cmExportFileGenerator \
   cmExportInstallFileGenerator \
   cmExportTryCompileFileGenerator \

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list