[Cmake-commits] CMake branch, next, updated. v2.8.12-4580-g7445d23

Stephen Kelly steveire at gmail.com
Mon Oct 28 10:59:20 EDT 2013


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  7445d237e6d647f6b1c9fb0eae493d589f380b40 (commit)
       via  5886d9829735f38cd3482d33bca1b856cfe9d9ae (commit)
       via  90ef1cfe4882139d9fe525352bc8e2e86b69f1db (commit)
       via  25f1df3e816b62a518206cb88f69fdb15b2eebc9 (commit)
      from  0f1db5f07dfa0bac940459581428f8bd011792bc (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7445d237e6d647f6b1c9fb0eae493d589f380b40
commit 7445d237e6d647f6b1c9fb0eae493d589f380b40
Merge: 0f1db5f 5886d98
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Oct 28 10:59:00 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Oct 28 10:59:00 2013 -0400

    Merge topic 'use-generator-target' into next
    
    5886d98 Move TraceDependencies to cmGeneratorTarget.
    90ef1cf Move GenerateTargetManifest to cmGeneratorTarget.
    25f1df3 Split CreateGeneratorTargets into two methods.

diff --cc Source/cmTarget.cxx
index 18579f0,b5730bc..0be587c
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@@ -156,9 -150,13 +153,14 @@@ public
    std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
    std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
    std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone;
 +  std::map<std::string, bool> CacheLinkInterfaceCompilerFeaturesDone;
  };
  
+ cmTarget::SourceEntriesType cmTarget::GetSourceEntries() const
+ {
+   return this->Internal.Get()->SourceEntries;
+ }
+ 
  //----------------------------------------------------------------------------
  void deleteAndClear(
        std::vector<cmTargetInternals::TargetPropertyEntry*> &entries)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5886d9829735f38cd3482d33bca1b856cfe9d9ae
commit 5886d9829735f38cd3482d33bca1b856cfe9d9ae
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Oct 11 00:57:11 2012 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Oct 27 20:29:45 2013 +0100

    Move TraceDependencies to cmGeneratorTarget.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 5ceec91..692b9ff 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -19,6 +19,8 @@
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorExpressionDAGChecker.h"
 
+#include <queue>
+
 //----------------------------------------------------------------------------
 cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
 {
@@ -270,6 +272,287 @@ void cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs)
 }
 
 //----------------------------------------------------------------------------
+class cmTargetTraceDependencies
+{
+public:
+  cmTargetTraceDependencies(cmGeneratorTarget* target);
+  void Trace();
+private:
+  cmTarget* Target;
+  cmGeneratorTarget* GeneratorTarget;
+  cmMakefile* Makefile;
+  cmGlobalGenerator* GlobalGenerator;
+  typedef cmTarget::SourceEntry SourceEntry;
+  cmTarget::SourceEntriesType SourceEntries;
+  SourceEntry* CurrentEntry;
+  std::queue<cmSourceFile*> SourceQueue;
+  std::set<cmSourceFile*> SourcesQueued;
+  typedef std::map<cmStdString, cmSourceFile*> NameMapType;
+  NameMapType NameMap;
+
+  void QueueSource(cmSourceFile* sf);
+  void FollowName(std::string const& name);
+  void FollowNames(std::vector<std::string> const& names);
+  bool IsUtility(std::string const& dep);
+  void CheckCustomCommand(cmCustomCommand const& cc);
+  void CheckCustomCommands(const std::vector<cmCustomCommand>& commands);
+};
+
+//----------------------------------------------------------------------------
+cmTargetTraceDependencies
+::cmTargetTraceDependencies(cmGeneratorTarget* target):
+  Target(target->Target), GeneratorTarget(target)
+{
+  // Convenience.
+  this->Makefile = this->Target->GetMakefile();
+  this->GlobalGenerator =
+    this->Makefile->GetLocalGenerator()->GetGlobalGenerator();
+  this->CurrentEntry = 0;
+  this->SourceEntries = this->Target->GetSourceEntries();
+
+  // Queue all the source files already specified for the target.
+  std::vector<cmSourceFile*> const& sources = this->Target->GetSourceFiles();
+  for(std::vector<cmSourceFile*>::const_iterator si = sources.begin();
+      si != sources.end(); ++si)
+    {
+    this->QueueSource(*si);
+    }
+
+  // Queue pre-build, pre-link, and post-build rule dependencies.
+  this->CheckCustomCommands(this->Target->GetPreBuildCommands());
+  this->CheckCustomCommands(this->Target->GetPreLinkCommands());
+  this->CheckCustomCommands(this->Target->GetPostBuildCommands());
+}
+
+//----------------------------------------------------------------------------
+void cmTargetTraceDependencies::Trace()
+{
+  // Process one dependency at a time until the queue is empty.
+  while(!this->SourceQueue.empty())
+    {
+    // Get the next source from the queue.
+    cmSourceFile* sf = this->SourceQueue.front();
+    this->SourceQueue.pop();
+    this->CurrentEntry = &this->SourceEntries[sf];
+
+    // Queue dependencies added explicitly by the user.
+    if(const char* additionalDeps = sf->GetProperty("OBJECT_DEPENDS"))
+      {
+      std::vector<std::string> objDeps;
+      cmSystemTools::ExpandListArgument(additionalDeps, objDeps);
+      this->FollowNames(objDeps);
+      }
+
+    // Queue the source needed to generate this file, if any.
+    this->FollowName(sf->GetFullPath());
+
+    // Queue dependencies added programatically by commands.
+    this->FollowNames(sf->GetDepends());
+
+    // Queue custom command dependencies.
+    if(cmCustomCommand const* cc = sf->GetCustomCommand())
+      {
+      this->CheckCustomCommand(*cc);
+      }
+    }
+  this->CurrentEntry = 0;
+}
+
+//----------------------------------------------------------------------------
+void cmTargetTraceDependencies::QueueSource(cmSourceFile* sf)
+{
+  if(this->SourcesQueued.insert(sf).second)
+    {
+    this->SourceQueue.push(sf);
+
+    // Make sure this file is in the target.
+    this->Target->AddSourceFile(sf);
+    }
+}
+
+//----------------------------------------------------------------------------
+void cmTargetTraceDependencies::FollowName(std::string const& name)
+{
+  NameMapType::iterator i = this->NameMap.find(name);
+  if(i == this->NameMap.end())
+    {
+    // Check if we know how to generate this file.
+    cmSourceFile* sf = this->Makefile->GetSourceFileWithOutput(name.c_str());
+    NameMapType::value_type entry(name, sf);
+    i = this->NameMap.insert(entry).first;
+    }
+  if(cmSourceFile* sf = i->second)
+    {
+    // Record the dependency we just followed.
+    if(this->CurrentEntry)
+      {
+      this->CurrentEntry->Depends.push_back(sf);
+      }
+
+    this->QueueSource(sf);
+    }
+}
+
+//----------------------------------------------------------------------------
+void
+cmTargetTraceDependencies::FollowNames(std::vector<std::string> const& names)
+{
+  for(std::vector<std::string>::const_iterator i = names.begin();
+      i != names.end(); ++i)
+    {
+    this->FollowName(*i);
+    }
+}
+
+//----------------------------------------------------------------------------
+bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
+{
+  // Dependencies on targets (utilities) are supposed to be named by
+  // just the target name.  However for compatibility we support
+  // naming the output file generated by the target (assuming there is
+  // no output-name property which old code would not have set).  In
+  // that case the target name will be the file basename of the
+  // dependency.
+  std::string util = cmSystemTools::GetFilenameName(dep);
+  if(cmSystemTools::GetFilenameLastExtension(util) == ".exe")
+    {
+    util = cmSystemTools::GetFilenameWithoutLastExtension(util);
+    }
+
+  // Check for a target with this name.
+  if(cmTarget* t = this->Makefile->FindTargetToUse(util.c_str()))
+    {
+    // 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
+    // the fact that the name matched a target was just a coincidence.
+    if(cmSystemTools::FileIsFullPath(dep.c_str()))
+      {
+      if(t->GetType() >= cmTarget::EXECUTABLE &&
+         t->GetType() <= cmTarget::MODULE_LIBRARY)
+        {
+        // This is really only for compatibility so we do not need to
+        // worry about configuration names and output names.
+        std::string tLocation = t->GetLocation(0);
+        tLocation = cmSystemTools::GetFilenamePath(tLocation);
+        std::string depLocation = cmSystemTools::GetFilenamePath(dep);
+        depLocation = cmSystemTools::CollapseFullPath(depLocation.c_str());
+        tLocation = cmSystemTools::CollapseFullPath(tLocation.c_str());
+        if(depLocation == tLocation)
+          {
+          this->Target->AddUtility(util.c_str());
+          return true;
+          }
+        }
+      }
+    else
+      {
+      // The original name of the dependency was not a full path.  It
+      // must name a target, so add the target-level dependency.
+      this->Target->AddUtility(util.c_str());
+      return true;
+      }
+    }
+
+  // The dependency does not name a target built in this project.
+  return false;
+}
+
+//----------------------------------------------------------------------------
+void
+cmTargetTraceDependencies
+::CheckCustomCommand(cmCustomCommand const& cc)
+{
+  // Transform command names that reference targets built in this
+  // project to corresponding target-level dependencies.
+  cmGeneratorExpression ge(cc.GetBacktrace());
+
+  // Add target-level dependencies referenced by generator expressions.
+  std::set<cmTarget*> targets;
+
+  for(cmCustomCommandLines::const_iterator cit = cc.GetCommandLines().begin();
+      cit != cc.GetCommandLines().end(); ++cit)
+    {
+    std::string const& command = *cit->begin();
+    // Check for a target with this name.
+    if(cmTarget* t = this->Makefile->FindTargetToUse(command.c_str()))
+      {
+      if(t->GetType() == cmTarget::EXECUTABLE)
+        {
+        // The command refers to an executable target built in
+        // this project.  Add the target-level dependency to make
+        // sure the executable is up to date before this custom
+        // command possibly runs.
+        this->Target->AddUtility(command.c_str());
+        }
+      }
+
+    // Check for target references in generator expressions.
+    for(cmCustomCommandLine::const_iterator cli = cit->begin();
+        cli != cit->end(); ++cli)
+      {
+      const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge
+                                                              = ge.Parse(*cli);
+      cge->Evaluate(this->Makefile, 0, true);
+      std::set<cmTarget*> geTargets = cge->GetTargets();
+      for(std::set<cmTarget*>::const_iterator it = geTargets.begin();
+          it != geTargets.end(); ++it)
+        {
+        targets.insert(*it);
+        }
+      }
+    }
+
+  for(std::set<cmTarget*>::iterator ti = targets.begin();
+      ti != targets.end(); ++ti)
+    {
+    this->Target->AddUtility((*ti)->GetName());
+    }
+
+  // Queue the custom command dependencies.
+  std::vector<std::string> const& depends = cc.GetDepends();
+  for(std::vector<std::string>::const_iterator di = depends.begin();
+      di != depends.end(); ++di)
+    {
+    std::string const& dep = *di;
+    if(!this->IsUtility(dep))
+      {
+      // The dependency does not name a target and may be a file we
+      // know how to generate.  Queue it.
+      this->FollowName(dep);
+      }
+    }
+}
+
+//----------------------------------------------------------------------------
+void
+cmTargetTraceDependencies
+::CheckCustomCommands(const std::vector<cmCustomCommand>& commands)
+{
+  for(std::vector<cmCustomCommand>::const_iterator cli = commands.begin();
+      cli != commands.end(); ++cli)
+    {
+    this->CheckCustomCommand(*cli);
+    }
+}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::TraceDependencies()
+{
+  // CMake-generated targets have no dependencies to trace.  Normally tracing
+  // would find nothing anyway, but when building CMake itself the "install"
+  // target command ends up referencing the "cmake" target but we do not
+  // really want the dependency because "install" depend on "all" anyway.
+  if(this->GetType() == cmTarget::GLOBAL_TARGET)
+    {
+    return;
+    }
+
+  // Use a helper object to trace the dependencies.
+  cmTargetTraceDependencies tracer(this);
+  tracer.Trace();
+}
+
+//----------------------------------------------------------------------------
 void cmGeneratorTarget::GetAppleArchs(const char* config,
                              std::vector<std::string>& archVec)
 {
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 9723f72..8d08543 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -77,6 +77,12 @@ public:
   /** Add the target output files to the global generator manifest.  */
   void GenerateTargetManifest(const char* config);
 
+  /**
+   * Trace through the source files in this target and add al source files
+   * that they depend on, used by all generators
+   */
+  void TraceDependencies();
+
   void ClassifySources();
   void LookupObjectLibraries();
 
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2a29061..63ec576 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -257,10 +257,11 @@ void cmLocalGenerator::ConfigureFinalPass()
 void cmLocalGenerator::TraceDependencies()
 {
   // Generate the rule files for each target.
-  cmTargets& targets = this->Makefile->GetTargets();
-  for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
+  cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
+  for(cmGeneratorTargetsType::iterator t = targets.begin();
+      t != targets.end(); ++t)
     {
-    t->second.TraceDependencies();
+    t->second->TraceDependencies();
     }
 }
 
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 13554dd..b5730bc 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -22,7 +22,6 @@
 #include <cmsys/RegularExpression.hxx>
 #include <map>
 #include <set>
-#include <queue>
 #include <stdlib.h> // required for atof
 #include <assert.h>
 
@@ -125,9 +124,7 @@ public:
                                                           LinkClosureMapType;
   LinkClosureMapType LinkClosureMap;
 
-  struct SourceEntry { std::vector<cmSourceFile*> Depends; };
-  typedef std::map<cmSourceFile*, SourceEntry> SourceEntriesType;
-  SourceEntriesType SourceEntries;
+  cmTarget::SourceEntriesType SourceEntries;
 
   struct TargetPropertyEntry {
     TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge,
@@ -155,6 +152,11 @@ public:
   std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone;
 };
 
+cmTarget::SourceEntriesType cmTarget::GetSourceEntries() const
+{
+  return this->Internal.Get()->SourceEntries;
+}
+
 //----------------------------------------------------------------------------
 void deleteAndClear(
       std::vector<cmTargetInternals::TargetPropertyEntry*> &entries)
@@ -489,285 +491,6 @@ bool cmTarget::IsBundleOnApple()
 }
 
 //----------------------------------------------------------------------------
-class cmTargetTraceDependencies
-{
-public:
-  cmTargetTraceDependencies(cmTarget* target, cmTargetInternals* internal);
-  void Trace();
-private:
-  cmTarget* Target;
-  cmTargetInternals* Internal;
-  cmMakefile* Makefile;
-  cmGlobalGenerator* GlobalGenerator;
-  typedef cmTargetInternals::SourceEntry SourceEntry;
-  SourceEntry* CurrentEntry;
-  std::queue<cmSourceFile*> SourceQueue;
-  std::set<cmSourceFile*> SourcesQueued;
-  typedef std::map<cmStdString, cmSourceFile*> NameMapType;
-  NameMapType NameMap;
-
-  void QueueSource(cmSourceFile* sf);
-  void FollowName(std::string const& name);
-  void FollowNames(std::vector<std::string> const& names);
-  bool IsUtility(std::string const& dep);
-  void CheckCustomCommand(cmCustomCommand const& cc);
-  void CheckCustomCommands(const std::vector<cmCustomCommand>& commands);
-};
-
-//----------------------------------------------------------------------------
-cmTargetTraceDependencies
-::cmTargetTraceDependencies(cmTarget* target, cmTargetInternals* internal):
-  Target(target), Internal(internal)
-{
-  // Convenience.
-  this->Makefile = this->Target->GetMakefile();
-  this->GlobalGenerator =
-    this->Makefile->GetLocalGenerator()->GetGlobalGenerator();
-  this->CurrentEntry = 0;
-
-  // Queue all the source files already specified for the target.
-  std::vector<cmSourceFile*> const& sources = this->Target->GetSourceFiles();
-  for(std::vector<cmSourceFile*>::const_iterator si = sources.begin();
-      si != sources.end(); ++si)
-    {
-    this->QueueSource(*si);
-    }
-
-  // Queue pre-build, pre-link, and post-build rule dependencies.
-  this->CheckCustomCommands(this->Target->GetPreBuildCommands());
-  this->CheckCustomCommands(this->Target->GetPreLinkCommands());
-  this->CheckCustomCommands(this->Target->GetPostBuildCommands());
-}
-
-//----------------------------------------------------------------------------
-void cmTargetTraceDependencies::Trace()
-{
-  // Process one dependency at a time until the queue is empty.
-  while(!this->SourceQueue.empty())
-    {
-    // Get the next source from the queue.
-    cmSourceFile* sf = this->SourceQueue.front();
-    this->SourceQueue.pop();
-    this->CurrentEntry = &this->Internal->SourceEntries[sf];
-
-    // Queue dependencies added explicitly by the user.
-    if(const char* additionalDeps = sf->GetProperty("OBJECT_DEPENDS"))
-      {
-      std::vector<std::string> objDeps;
-      cmSystemTools::ExpandListArgument(additionalDeps, objDeps);
-      this->FollowNames(objDeps);
-      }
-
-    // Queue the source needed to generate this file, if any.
-    this->FollowName(sf->GetFullPath());
-
-    // Queue dependencies added programatically by commands.
-    this->FollowNames(sf->GetDepends());
-
-    // Queue custom command dependencies.
-    if(cmCustomCommand const* cc = sf->GetCustomCommand())
-      {
-      this->CheckCustomCommand(*cc);
-      }
-    }
-  this->CurrentEntry = 0;
-}
-
-//----------------------------------------------------------------------------
-void cmTargetTraceDependencies::QueueSource(cmSourceFile* sf)
-{
-  if(this->SourcesQueued.insert(sf).second)
-    {
-    this->SourceQueue.push(sf);
-
-    // Make sure this file is in the target.
-    this->Target->AddSourceFile(sf);
-    }
-}
-
-//----------------------------------------------------------------------------
-void cmTargetTraceDependencies::FollowName(std::string const& name)
-{
-  NameMapType::iterator i = this->NameMap.find(name);
-  if(i == this->NameMap.end())
-    {
-    // Check if we know how to generate this file.
-    cmSourceFile* sf = this->Makefile->GetSourceFileWithOutput(name.c_str());
-    NameMapType::value_type entry(name, sf);
-    i = this->NameMap.insert(entry).first;
-    }
-  if(cmSourceFile* sf = i->second)
-    {
-    // Record the dependency we just followed.
-    if(this->CurrentEntry)
-      {
-      this->CurrentEntry->Depends.push_back(sf);
-      }
-
-    this->QueueSource(sf);
-    }
-}
-
-//----------------------------------------------------------------------------
-void
-cmTargetTraceDependencies::FollowNames(std::vector<std::string> const& names)
-{
-  for(std::vector<std::string>::const_iterator i = names.begin();
-      i != names.end(); ++i)
-    {
-    this->FollowName(*i);
-    }
-}
-
-//----------------------------------------------------------------------------
-bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
-{
-  // Dependencies on targets (utilities) are supposed to be named by
-  // just the target name.  However for compatibility we support
-  // naming the output file generated by the target (assuming there is
-  // no output-name property which old code would not have set).  In
-  // that case the target name will be the file basename of the
-  // dependency.
-  std::string util = cmSystemTools::GetFilenameName(dep);
-  if(cmSystemTools::GetFilenameLastExtension(util) == ".exe")
-    {
-    util = cmSystemTools::GetFilenameWithoutLastExtension(util);
-    }
-
-  // Check for a target with this name.
-  if(cmTarget* t = this->Makefile->FindTargetToUse(util.c_str()))
-    {
-    // 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
-    // the fact that the name matched a target was just a coincidence.
-    if(cmSystemTools::FileIsFullPath(dep.c_str()))
-      {
-      if(t->GetType() >= cmTarget::EXECUTABLE &&
-         t->GetType() <= cmTarget::MODULE_LIBRARY)
-        {
-        // This is really only for compatibility so we do not need to
-        // worry about configuration names and output names.
-        std::string tLocation = t->GetLocation(0);
-        tLocation = cmSystemTools::GetFilenamePath(tLocation);
-        std::string depLocation = cmSystemTools::GetFilenamePath(dep);
-        depLocation = cmSystemTools::CollapseFullPath(depLocation.c_str());
-        tLocation = cmSystemTools::CollapseFullPath(tLocation.c_str());
-        if(depLocation == tLocation)
-          {
-          this->Target->AddUtility(util.c_str());
-          return true;
-          }
-        }
-      }
-    else
-      {
-      // The original name of the dependency was not a full path.  It
-      // must name a target, so add the target-level dependency.
-      this->Target->AddUtility(util.c_str());
-      return true;
-      }
-    }
-
-  // The dependency does not name a target built in this project.
-  return false;
-}
-
-//----------------------------------------------------------------------------
-void
-cmTargetTraceDependencies
-::CheckCustomCommand(cmCustomCommand const& cc)
-{
-  // Transform command names that reference targets built in this
-  // project to corresponding target-level dependencies.
-  cmGeneratorExpression ge(cc.GetBacktrace());
-
-  // Add target-level dependencies referenced by generator expressions.
-  std::set<cmTarget*> targets;
-
-  for(cmCustomCommandLines::const_iterator cit = cc.GetCommandLines().begin();
-      cit != cc.GetCommandLines().end(); ++cit)
-    {
-    std::string const& command = *cit->begin();
-    // Check for a target with this name.
-    if(cmTarget* t = this->Makefile->FindTargetToUse(command.c_str()))
-      {
-      if(t->GetType() == cmTarget::EXECUTABLE)
-        {
-        // The command refers to an executable target built in
-        // this project.  Add the target-level dependency to make
-        // sure the executable is up to date before this custom
-        // command possibly runs.
-        this->Target->AddUtility(command.c_str());
-        }
-      }
-
-    // Check for target references in generator expressions.
-    for(cmCustomCommandLine::const_iterator cli = cit->begin();
-        cli != cit->end(); ++cli)
-      {
-      const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge
-                                                              = ge.Parse(*cli);
-      cge->Evaluate(this->Makefile, 0, true);
-      std::set<cmTarget*> geTargets = cge->GetTargets();
-      for(std::set<cmTarget*>::const_iterator it = geTargets.begin();
-          it != geTargets.end(); ++it)
-        {
-        targets.insert(*it);
-        }
-      }
-    }
-
-  for(std::set<cmTarget*>::iterator ti = targets.begin();
-      ti != targets.end(); ++ti)
-    {
-    this->Target->AddUtility((*ti)->GetName());
-    }
-
-  // Queue the custom command dependencies.
-  std::vector<std::string> const& depends = cc.GetDepends();
-  for(std::vector<std::string>::const_iterator di = depends.begin();
-      di != depends.end(); ++di)
-    {
-    std::string const& dep = *di;
-    if(!this->IsUtility(dep))
-      {
-      // The dependency does not name a target and may be a file we
-      // know how to generate.  Queue it.
-      this->FollowName(dep);
-      }
-    }
-}
-
-//----------------------------------------------------------------------------
-void
-cmTargetTraceDependencies
-::CheckCustomCommands(const std::vector<cmCustomCommand>& commands)
-{
-  for(std::vector<cmCustomCommand>::const_iterator cli = commands.begin();
-      cli != commands.end(); ++cli)
-    {
-    this->CheckCustomCommand(*cli);
-    }
-}
-
-//----------------------------------------------------------------------------
-void cmTarget::TraceDependencies()
-{
-  // CMake-generated targets have no dependencies to trace.  Normally tracing
-  // would find nothing anyway, but when building CMake itself the "install"
-  // target command ends up referencing the "cmake" target but we do not
-  // really want the dependency because "install" depend on "all" anyway.
-  if(this->GetType() == cmTarget::GLOBAL_TARGET)
-    {
-    return;
-    }
-
-  // Use a helper object to trace the dependencies.
-  cmTargetTraceDependencies tracer(this, this->Internal.Get());
-  tracer.Trace();
-}
-
-//----------------------------------------------------------------------------
 bool cmTarget::FindSourceFiles()
 {
   for(std::vector<cmSourceFile*>::const_iterator
@@ -798,11 +521,9 @@ std::vector<cmSourceFile*> const& cmTarget::GetSourceFiles()
 //----------------------------------------------------------------------------
 void cmTarget::AddSourceFile(cmSourceFile* sf)
 {
-  typedef cmTargetInternals::SourceEntriesType SourceEntriesType;
   SourceEntriesType::iterator i = this->Internal->SourceEntries.find(sf);
   if(i == this->Internal->SourceEntries.end())
     {
-    typedef cmTargetInternals::SourceEntry SourceEntry;
     SourceEntriesType::value_type entry(sf, SourceEntry());
     i = this->Internal->SourceEntries.insert(entry).first;
     this->SourceFiles.push_back(sf);
@@ -813,7 +534,6 @@ void cmTarget::AddSourceFile(cmSourceFile* sf)
 std::vector<cmSourceFile*> const*
 cmTarget::GetSourceDepends(cmSourceFile* sf)
 {
-  typedef cmTargetInternals::SourceEntriesType SourceEntriesType;
   SourceEntriesType::iterator i = this->Internal->SourceEntries.find(sf);
   if(i != this->Internal->SourceEntries.end())
     {
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index dd05d5b..59563c5 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -347,12 +347,6 @@ public:
   void GetTargetVersion(bool soversion, int& major, int& minor, int& patch);
 
   /**
-   * Trace through the source files in this target and add al source files
-   * that they depend on, used by all generators
-   */
-  void TraceDependencies();
-
-  /**
    * Make sure the full path to all source files is known.
    */
   bool FindSourceFiles();
@@ -658,6 +652,11 @@ private:
                                        const char* config,
                                        bool contentOnly);
 
+  struct SourceEntry { std::vector<cmSourceFile*> Depends; };
+  typedef std::map<cmSourceFile*, SourceEntry> SourceEntriesType;
+
+  SourceEntriesType GetSourceEntries() const;
+
 private:
   std::string Name;
   std::vector<cmCustomCommand> PreBuildCommands;
@@ -733,6 +732,8 @@ private:
 
   // Internal representation details.
   friend class cmTargetInternals;
+  friend class cmGeneratorTarget;
+  friend class cmTargetTraceDependencies;
   cmTargetInternalPointer Internal;
 
   void ConstructSourceFileFlags();

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90ef1cfe4882139d9fe525352bc8e2e86b69f1db
commit 90ef1cfe4882139d9fe525352bc8e2e86b69f1db
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Sep 14 19:04:25 2012 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Oct 27 20:29:45 2013 +0100

    Move GenerateTargetManifest to cmGeneratorTarget.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 0cc2e92..5ceec91 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -315,3 +315,79 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
 {
   return this->Target->GetIncludeDirectories(config);
 }
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::GenerateTargetManifest(const char* config)
+{
+  if (this->Target->IsImported())
+    {
+    return;
+    }
+  cmMakefile* mf = this->Target->GetMakefile();
+  cmLocalGenerator* lg = mf->GetLocalGenerator();
+  cmGlobalGenerator* gg = lg->GetGlobalGenerator();
+
+  // Get the names.
+  std::string name;
+  std::string soName;
+  std::string realName;
+  std::string impName;
+  std::string pdbName;
+  if(this->GetType() == cmTarget::EXECUTABLE)
+    {
+    this->Target->GetExecutableNames(name, realName, impName, pdbName,
+                                     config);
+    }
+  else if(this->GetType() == cmTarget::STATIC_LIBRARY ||
+          this->GetType() == cmTarget::SHARED_LIBRARY ||
+          this->GetType() == cmTarget::MODULE_LIBRARY)
+    {
+    this->Target->GetLibraryNames(name, soName, realName, impName, pdbName,
+                                  config);
+    }
+  else
+    {
+    return;
+    }
+
+  // Get the directory.
+  std::string dir = this->Target->GetDirectory(config, false);
+
+  // Add each name.
+  std::string f;
+  if(!name.empty())
+    {
+    f = dir;
+    f += "/";
+    f += name;
+    gg->AddToManifest(config? config:"", f);
+    }
+  if(!soName.empty())
+    {
+    f = dir;
+    f += "/";
+    f += soName;
+    gg->AddToManifest(config? config:"", f);
+    }
+  if(!realName.empty())
+    {
+    f = dir;
+    f += "/";
+    f += realName;
+    gg->AddToManifest(config? config:"", f);
+    }
+  if(!pdbName.empty())
+    {
+    f = dir;
+    f += "/";
+    f += pdbName;
+    gg->AddToManifest(config? config:"", f);
+    }
+  if(!impName.empty())
+    {
+    f = this->Target->GetDirectory(config, true);
+    f += "/";
+    f += impName;
+    gg->AddToManifest(config? config:"", f);
+    }
+}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index e7e7d34..9723f72 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -74,6 +74,9 @@ public:
 
   bool IsSystemIncludeDirectory(const char *dir, const char *config);
 
+  /** Add the target output files to the global generator manifest.  */
+  void GenerateTargetManifest(const char* config);
+
   void ClassifySources();
   void LookupObjectLibraries();
 
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index edf80e6..2a29061 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -530,10 +530,11 @@ void cmLocalGenerator::GenerateTargetManifest()
   this->Makefile->GetConfigurations(configNames);
 
   // Add our targets to the manifest for each configuration.
-  cmTargets& targets = this->Makefile->GetTargets();
-  for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
+  cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
+  for(cmGeneratorTargetsType::iterator t = targets.begin();
+      t != targets.end(); ++t)
     {
-    cmTarget& target = t->second;
+    cmGeneratorTarget& target = *t->second;
     if(configNames.empty())
       {
       target.GenerateTargetManifest(0);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ea0b504..13554dd 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -3913,76 +3913,6 @@ bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName,
 }
 
 //----------------------------------------------------------------------------
-void cmTarget::GenerateTargetManifest(const char* config)
-{
-  cmMakefile* mf = this->Makefile;
-  cmLocalGenerator* lg = mf->GetLocalGenerator();
-  cmGlobalGenerator* gg = lg->GetGlobalGenerator();
-
-  // Get the names.
-  std::string name;
-  std::string soName;
-  std::string realName;
-  std::string impName;
-  std::string pdbName;
-  if(this->GetType() == cmTarget::EXECUTABLE)
-    {
-    this->GetExecutableNames(name, realName, impName, pdbName, config);
-    }
-  else if(this->GetType() == cmTarget::STATIC_LIBRARY ||
-          this->GetType() == cmTarget::SHARED_LIBRARY ||
-          this->GetType() == cmTarget::MODULE_LIBRARY)
-    {
-    this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
-    }
-  else
-    {
-    return;
-    }
-
-  // Get the directory.
-  std::string dir = this->GetDirectory(config, false);
-
-  // Add each name.
-  std::string f;
-  if(!name.empty())
-    {
-    f = dir;
-    f += "/";
-    f += name;
-    gg->AddToManifest(config? config:"", f);
-    }
-  if(!soName.empty())
-    {
-    f = dir;
-    f += "/";
-    f += soName;
-    gg->AddToManifest(config? config:"", f);
-    }
-  if(!realName.empty())
-    {
-    f = dir;
-    f += "/";
-    f += realName;
-    gg->AddToManifest(config? config:"", f);
-    }
-  if(!pdbName.empty())
-    {
-    f = this->GetPDBDirectory(config);
-    f += "/";
-    f += pdbName;
-    gg->AddToManifest(config? config:"", f);
-    }
-  if(!impName.empty())
-    {
-    f = this->GetDirectory(config, true);
-    f += "/";
-    f += impName;
-    gg->AddToManifest(config? config:"", f);
-    }
-}
-
-//----------------------------------------------------------------------------
 void cmTarget::SetPropertyDefault(const char* property,
                                   const char* default_value)
 {
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 9d62f5f..dd05d5b 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -410,9 +410,6 @@ public:
   bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
                         const char* newExt = 0);
 
-  /** Add the target output files to the global generator manifest.  */
-  void GenerateTargetManifest(const char* config);
-
   /**
    * Compute whether this target must be relinked before installing.
    */

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=25f1df3e816b62a518206cb88f69fdb15b2eebc9
commit 25f1df3e816b62a518206cb88f69fdb15b2eebc9
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Oct 6 18:35:37 2012 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Oct 27 20:29:34 2013 +0100

    Split CreateGeneratorTargets into two methods.
    
    As the generate-time-related API is moving to cmGeneratorTarget, almost
    all of generation code needs to be able to access instances of it.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 62ac263..0cc2e92 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -25,8 +25,6 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
   this->Makefile = this->Target->GetMakefile();
   this->LocalGenerator = this->Makefile->GetLocalGenerator();
   this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
-  this->ClassifySources();
-  this->LookupObjectLibraries();
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index dedfa60..e7e7d34 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -74,10 +74,10 @@ public:
 
   bool IsSystemIncludeDirectory(const char *dir, const char *config);
 
-private:
   void ClassifySources();
   void LookupObjectLibraries();
 
+private:
   std::map<std::string, std::vector<std::string> > SystemIncludesCache;
 
   cmGeneratorTarget(cmGeneratorTarget const&);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index e26f59f..1b0ec4d 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1058,6 +1058,9 @@ void cmGlobalGenerator::Generate()
     this->LocalGenerators[i]->AddHelperCommands();
     }
 
+  // Create per-target generator information.
+  this->CreateGeneratorTargets();
+
   // Trace the dependencies, after that no custom commands should be added
   // because their dependencies might not be handled correctly
   for (i = 0; i < this->LocalGenerators.size(); ++i)
@@ -1071,8 +1074,7 @@ void cmGlobalGenerator::Generate()
     this->LocalGenerators[i]->GenerateTargetManifest();
     }
 
-  // Create per-target generator information.
-  this->CreateGeneratorTargets();
+  this->ComputeGeneratorTargetObjects();
 
   this->ProcessEvaluationFiles();
 
@@ -1263,7 +1265,6 @@ void cmGlobalGenerator::CreateGeneratorTargets()
 
       cmGeneratorTarget* gt = new cmGeneratorTarget(t);
       this->GeneratorTargets[t] = gt;
-      this->ComputeTargetObjects(gt);
       generatorTargets[t] = gt;
       }
 
@@ -1281,6 +1282,25 @@ void cmGlobalGenerator::CreateGeneratorTargets()
 }
 
 //----------------------------------------------------------------------------
+void cmGlobalGenerator::ComputeGeneratorTargetObjects()
+{
+  // Construct per-target generator information.
+  for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
+    {
+    cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
+    cmGeneratorTargetsType targets = mf->GetGeneratorTargets();
+    for(cmGeneratorTargetsType::iterator ti = targets.begin();
+        ti != targets.end(); ++ti)
+      {
+      cmGeneratorTarget* gt = ti->second;
+      gt->ClassifySources();
+      gt->LookupObjectLibraries();
+      this->ComputeTargetObjects(gt);
+      }
+    }
+}
+
+//----------------------------------------------------------------------------
 void cmGlobalGenerator::ClearGeneratorTargets()
 {
   for(cmGeneratorTargetsType::iterator i = this->GeneratorTargets.begin();
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index c930b2b..4bd1d40 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -406,6 +406,7 @@ private:
   // Per-target generator information.
   cmGeneratorTargetsType GeneratorTargets;
   void CreateGeneratorTargets();
+  void ComputeGeneratorTargetObjects();
   void ClearGeneratorTargets();
   virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
 

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

Summary of changes:
 Source/cmGeneratorTarget.cxx |  361 +++++++++++++++++++++++++++++++++++++++++-
 Source/cmGeneratorTarget.h   |   11 ++-
 Source/cmGlobalGenerator.cxx |   26 +++-
 Source/cmGlobalGenerator.h   |    1 +
 Source/cmLocalGenerator.cxx  |   14 +-
 Source/cmTarget.cxx          |  362 +-----------------------------------------
 Source/cmTarget.h            |   16 +-
 7 files changed, 414 insertions(+), 377 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list