[Cmake-commits] CMake branch, next, updated. v3.0.0-rc1-959-gde1fa74

Stephen Kelly steveire at gmail.com
Thu Mar 13 08:05:25 EDT 2014


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  de1fa74f1e35ae1e788c559d652aa615ead1e7b7 (commit)
       via  9be2b428e532b5d48f652d7b2acaa6bd717f22a6 (commit)
      from  14830b39d5042619927b1476aabf9c2a9c091907 (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=de1fa74f1e35ae1e788c559d652aa615ead1e7b7
commit de1fa74f1e35ae1e788c559d652aa615ead1e7b7
Merge: 14830b3 9be2b42
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Mar 13 08:05:23 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Mar 13 08:05:23 2014 -0400

    Merge topic 'target-objects-refactor' into next
    
    9be2b428 Revert topic

diff --cc Source/cmLocalUnixMakefileGenerator3.h
index 5041345,7987c96..e75103c
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@@ -310,21 -313,9 +314,17 @@@ protected
  
  private:
    std::string ConvertShellCommand(std::string const& cmd, RelativeRoot root);
 -  std::string MakeLauncher(const cmCustomCommand& cc, cmTarget* target,
 -                           RelativeRoot relative);
 +  std::string MakeLauncher(cmCustomCommandGenerator const& ccg,
 +                           cmTarget* target, RelativeRoot relative);
 +
 +  virtual void ComputeObjectFilenames(
 +                        std::map<cmSourceFile const*, std::string>& mapping,
 +                        cmGeneratorTarget const* gt = 0);
 +
 +  virtual void ComputeObjectFilenames(
 +                        std::map<cmSourceFile const*, std::string>& mapping,
 +                        cmGeneratorTarget const* gt = 0);
  
-   virtual void ComputeObjectFilenames(
-                         std::map<cmSourceFile const*, std::string>& mapping,
-                         cmGeneratorTarget const* gt = 0);
- 
    friend class cmMakefileTargetGenerator;
    friend class cmMakefileExecutableTargetGenerator;
    friend class cmMakefileLibraryTargetGenerator;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9be2b428e532b5d48f652d7b2acaa6bd717f22a6
commit 9be2b428e532b5d48f652d7b2acaa6bd717f22a6
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Mar 13 13:04:15 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Mar 13 13:04:44 2014 +0100

    Revert topic

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 63e479b..db88749 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -97,7 +97,7 @@ struct DoAccept
 template<>
 struct DoAccept<true>
 {
-  static void Do(std::vector<cmSourceFile const*>& files, cmSourceFile* f)
+  static void Do(std::vector<cmSourceFile*>& files, cmSourceFile* f)
     {
     files.push_back(f);
     }
@@ -120,7 +120,7 @@ struct DoAccept<true>
 };
 
 //----------------------------------------------------------------------------
-template<typename Tag, typename DataType = std::vector<cmSourceFile const*> >
+template<typename Tag, typename DataType = std::vector<cmSourceFile*> >
 struct TagVisitor
 {
   DataType& Data;
@@ -241,7 +241,7 @@ const char *cmGeneratorTarget::GetProperty(const std::string& prop) const
 
 //----------------------------------------------------------------------------
 std::vector<cmSourceFile*> const*
-cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const
+cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const
 {
   SourceEntriesType::const_iterator i = this->SourceEntries.find(sf);
   if(i != this->SourceEntries.end())
@@ -306,21 +306,28 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt,
 
 //----------------------------------------------------------------------------
 void
-cmGeneratorTarget
-::GetObjectSources(std::vector<cmSourceFile const*> &data) const
+cmGeneratorTarget::GetObjectSources(std::vector<cmSourceFile*> &data) const
 {
   IMPLEMENT_VISIT(ObjectSources);
+  if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY)
+    {
+    this->ObjectSources = data;
+    }
 }
 
 //----------------------------------------------------------------------------
 const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
 {
-  this->ComputeTargetObjects(this->Objects);
   return this->Objects[file];
 }
 
+void cmGeneratorTarget::AddObject(cmSourceFile *sf, std::string const&name)
+{
+    this->Objects[sf] = name;
+}
+
 //----------------------------------------------------------------------------
-void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile const* sf)
+void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile* sf)
 {
   this->ExplicitObjectName.insert(sf);
 }
@@ -334,39 +341,34 @@ bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const
 }
 
 //----------------------------------------------------------------------------
-void cmGeneratorTarget
-::GetIDLSources(std::vector<cmSourceFile const*>& data) const
+void cmGeneratorTarget::GetIDLSources(std::vector<cmSourceFile*>& data) const
 {
   IMPLEMENT_VISIT(IDLSources);
 }
 
 //----------------------------------------------------------------------------
 void
-cmGeneratorTarget
-::GetHeaderSources(std::vector<cmSourceFile const*>& data) const
+cmGeneratorTarget::GetHeaderSources(std::vector<cmSourceFile*>& data) const
 {
   IMPLEMENT_VISIT(HeaderSources);
 }
 
 //----------------------------------------------------------------------------
-void cmGeneratorTarget
-::GetExtraSources(std::vector<cmSourceFile const*>& data) const
+void cmGeneratorTarget::GetExtraSources(std::vector<cmSourceFile*>& data) const
 {
   IMPLEMENT_VISIT(ExtraSources);
 }
 
 //----------------------------------------------------------------------------
 void
-cmGeneratorTarget
-::GetCustomCommands(std::vector<cmSourceFile const*>& data) const
+cmGeneratorTarget::GetCustomCommands(std::vector<cmSourceFile*>& data) const
 {
   IMPLEMENT_VISIT(CustomCommands);
 }
 
 //----------------------------------------------------------------------------
 void
-cmGeneratorTarget
-::GetExternalObjects(std::vector<cmSourceFile const*>& data) const
+cmGeneratorTarget::GetExternalObjects(std::vector<cmSourceFile*>& data) const
 {
   IMPLEMENT_VISIT(ExternalObjects);
 }
@@ -381,8 +383,7 @@ cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& srcs) const
 }
 
 //----------------------------------------------------------------------------
-void cmGeneratorTarget
-::GetResxSources(std::vector<cmSourceFile const*>& srcs) const
+void cmGeneratorTarget::GetResxSources(std::vector<cmSourceFile*>& srcs) const
 {
   ResxData data;
   IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData)
@@ -568,45 +569,18 @@ cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) const
     cmTarget* objLib = *ti;
     cmGeneratorTarget* ogt =
       this->GlobalGenerator->GetGeneratorTarget(objLib);
-
-    ogt->ComputeTargetObjects(ogt->Objects);
-
-    for(std::map<cmSourceFile const*, std::string>::const_iterator
-        objIt = ogt->Objects.begin();
-        objIt != ogt->Objects.end(); ++objIt)
+    for(std::vector<cmSourceFile*>::const_iterator
+          si = ogt->ObjectSources.begin();
+        si != ogt->ObjectSources.end(); ++si)
       {
-      assert(!objIt->second.empty());
       std::string obj = ogt->ObjectDirectory;
-      obj += objIt->second;
+      obj += ogt->Objects[*si];
       objs.push_back(obj);
       }
     }
 }
 
 //----------------------------------------------------------------------------
-void cmGeneratorTarget::ComputeTargetObjects(
-                    std::map<cmSourceFile const*, std::string>& objects) const
-{
-  if(!objects.empty())
-    {
-    return;
-    }
-  this->LocalGenerator->GetGlobalGenerator()
-      ->ComputeTargetObjectDirectory(const_cast<cmGeneratorTarget*>(this));
-  std::vector<cmSourceFile const*> objectSources;
-  this->GetObjectSources(objectSources);
-
-  for(std::vector<cmSourceFile const*>::const_iterator it
-      = objectSources.begin(); it != objectSources.end(); ++it)
-    {
-    objects[*it];
-    }
-
-  this->LocalGenerator->ComputeObjectFilenames(objects, this);
-  assert(objects.size() == objectSources.size());
-}
-
-//----------------------------------------------------------------------------
 class cmTargetTraceDependencies
 {
 public:
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 3eca156..81a447f 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -32,19 +32,19 @@ public:
   bool GetPropertyAsBool(const std::string& prop) const;
   void GetSourceFiles(std::vector<cmSourceFile*>& files) const;
 
-  void GetObjectSources(std::vector<cmSourceFile const*> &) const;
+  void GetObjectSources(std::vector<cmSourceFile*> &) const;
   const std::string& GetObjectName(cmSourceFile const* file);
 
-  void AddObject(cmSourceFile const* sf, std::string const&name);
+  void AddObject(cmSourceFile *sf, std::string const&name);
   bool HasExplicitObjectName(cmSourceFile const* file) const;
-  void AddExplicitObjectName(cmSourceFile const* sf);
-
-  void GetResxSources(std::vector<cmSourceFile const*>&) const;
-  void GetIDLSources(std::vector<cmSourceFile const*>&) const;
-  void GetExternalObjects(std::vector<cmSourceFile const*>&) const;
-  void GetHeaderSources(std::vector<cmSourceFile const*>&) const;
-  void GetExtraSources(std::vector<cmSourceFile const*>&) const;
-  void GetCustomCommands(std::vector<cmSourceFile const*>&) const;
+  void AddExplicitObjectName(cmSourceFile* sf);
+
+  void GetResxSources(std::vector<cmSourceFile*>&) const;
+  void GetIDLSources(std::vector<cmSourceFile*>&) const;
+  void GetExternalObjects(std::vector<cmSourceFile*>&) const;
+  void GetHeaderSources(std::vector<cmSourceFile*>&) const;
+  void GetExtraSources(std::vector<cmSourceFile*>&) const;
+  void GetCustomCommands(std::vector<cmSourceFile*>&) const;
   void GetExpectedResxHeaders(std::set<std::string>&) const;
 
   cmTarget* Target;
@@ -87,8 +87,7 @@ public:
   void LookupObjectLibraries();
 
   /** Get sources that must be built before the given source.  */
-  std::vector<cmSourceFile*> const*
-  GetSourceDepends(cmSourceFile const* sf) const;
+  std::vector<cmSourceFile*> const* GetSourceDepends(cmSourceFile* sf) const;
 
   /**
    * Flags for a given source file as used in this target. Typically assigned
@@ -117,16 +116,17 @@ public:
 
   struct ResxData {
     mutable std::set<std::string> ExpectedResxHeaders;
-    mutable std::vector<cmSourceFile const*> ResxSources;
+    mutable std::vector<cmSourceFile*> ResxSources;
   };
 private:
   friend class cmTargetTraceDependencies;
   struct SourceEntry { std::vector<cmSourceFile*> Depends; };
-  typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType;
+  typedef std::map<cmSourceFile*, SourceEntry> SourceEntriesType;
   SourceEntriesType SourceEntries;
 
-  mutable std::map<cmSourceFile const*, std::string> Objects;
+  std::map<cmSourceFile const*, std::string> Objects;
   std::set<cmSourceFile const*> ExplicitObjectName;
+  mutable std::vector<cmSourceFile*> ObjectSources;
   std::vector<cmTarget*> ObjectLibraries;
   mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
 
@@ -134,9 +134,6 @@ private:
   mutable bool SourceFileFlagsConstructed;
   mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
 
-  void ComputeTargetObjects(
-                  std::map<cmSourceFile const*, std::string>& objects) const;
-
   cmGeneratorTarget(cmGeneratorTarget const&);
   void operator=(cmGeneratorTarget const&);
 };
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 4945e89..b95ff81 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1450,6 +1450,7 @@ void cmGlobalGenerator::ComputeGeneratorTargetObjects()
         }
       cmGeneratorTarget* gt = ti->second;
       gt->LookupObjectLibraries();
+      this->ComputeTargetObjects(gt);
       }
     }
 }
@@ -1514,8 +1515,9 @@ cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const
 }
 
 //----------------------------------------------------------------------------
-void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
+void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const
 {
+  // Implemented in generator subclasses that need this.
 }
 
 void cmGlobalGenerator::CheckLocalGenerators()
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 5366733..91e71a8 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -323,8 +323,6 @@ public:
   GetExportedTargetsFile(const std::string &filename) const;
   void AddCMP0042WarnTarget(const std::string& target);
 
-  virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
-
 protected:
   typedef std::vector<cmLocalGenerator*> GeneratorVector;
   // for a project collect all its targets by following depend
@@ -443,6 +441,7 @@ private:
   void CreateGeneratorTargets(cmMakefile* mf);
   void CreateGeneratorTargets();
   void ComputeGeneratorTargetObjects();
+  virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
 
   void ClearGeneratorMembers();
 
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 49ce1b5..0a05f5a 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -19,7 +19,6 @@
 #include "cmVersion.h"
 
 #include <algorithm>
-#include <assert.h>
 
 const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja";
 const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja";
@@ -632,9 +631,8 @@ std::string cmGlobalNinjaGenerator::GetEditCacheCommand() const
   return cmSystemTools::GetCMakeGUICommand();
 }
 
-//----------------------------------------------------------------------------
-void cmGlobalNinjaGenerator
-::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
+// TODO: Refactor to combine with cmGlobalUnixMakefileGenerator3 impl.
+void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
 {
   cmTarget* target = gt->Target;
 
@@ -645,6 +643,19 @@ void cmGlobalNinjaGenerator
   dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
   dir_max += "/";
   gt->ObjectDirectory = dir_max;
+
+  std::vector<cmSourceFile*> objectSources;
+  gt->GetObjectSources(objectSources);
+  // Compute the name of each object file.
+  for(std::vector<cmSourceFile*>::iterator
+        si = objectSources.begin();
+      si != objectSources.end(); ++si)
+    {
+    cmSourceFile* sf = *si;
+    std::string objectName = gt->LocalGenerator
+      ->GetObjectFileNameWithoutTarget(*sf, dir_max);
+    gt->AddObject(sf, objectName);
+    }
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index f2643af..7725cf3 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -299,7 +299,7 @@ public:
 
   void AddTargetAlias(const std::string& alias, cmTarget* target);
 
-  virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
+
 protected:
 
   /// Overloaded methods.
@@ -310,6 +310,8 @@ protected:
 private:
   virtual std::string GetEditCacheCommand() const;
 
+  /// @see cmGlobalGenerator::ComputeTargetObjects
+  virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
 
   void OpenBuildFileStream();
   void CloseBuildFileStream();
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 4632071..f5c56a9 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -106,9 +106,11 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const
 //----------------------------------------------------------------------------
 void
 cmGlobalUnixMakefileGenerator3
-::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
+::ComputeTargetObjects(cmGeneratorTarget* gt) const
 {
   cmTarget* target = gt->Target;
+  cmLocalUnixMakefileGenerator3* lg =
+    static_cast<cmLocalUnixMakefileGenerator3*>(gt->LocalGenerator);
 
   // Compute full path to object file directory for this target.
   std::string dir_max;
@@ -117,6 +119,22 @@ cmGlobalUnixMakefileGenerator3
   dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
   dir_max += "/";
   gt->ObjectDirectory = dir_max;
+
+  std::vector<cmSourceFile*> objectSources;
+  gt->GetObjectSources(objectSources);
+  // Compute the name of each object file.
+  for(std::vector<cmSourceFile*>::iterator
+        si = objectSources.begin();
+      si != objectSources.end(); ++si)
+    {
+    cmSourceFile* sf = *si;
+    bool hasSourceExtension = true;
+    std::string objectName = gt->LocalGenerator
+      ->GetObjectFileNameWithoutTarget(*sf, dir_max,
+                                       &hasSourceExtension);
+    gt->AddObject(sf, objectName);
+    lg->AddLocalObjectFile(target, sf, objectName, hasSourceExtension);
+    }
 }
 
 void cmGlobalUnixMakefileGenerator3::Configure()
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index d003789..8115176 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -128,7 +128,6 @@ public:
   /** Does the make tool tolerate .NOTPARALLEL? */
   virtual bool AllowNotParallel() const { return true; }
 
-  virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
 protected:
   void WriteMainMakefile2();
   void WriteMainCMakefile();
@@ -199,6 +198,7 @@ protected:
 private:
   virtual const char* GetBuildIgnoreErrorsFlag() const { return "-i"; }
   virtual std::string GetEditCacheCommand() const;
+  virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
 };
 
 #endif
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 37a416b..840e888 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -470,7 +470,7 @@ cmGlobalVisualStudio10Generator
 
 //----------------------------------------------------------------------------
 void cmGlobalVisualStudio10Generator::PathTooLong(
-  cmTarget* target, cmSourceFile const* sf, std::string const& sfRel)
+  cmTarget* target, cmSourceFile* sf, std::string const& sfRel)
 {
   size_t len = (strlen(target->GetMakefile()->GetCurrentOutputDirectory()) +
                 1 + sfRel.length());
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index ede6b1b..999a9d5 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -87,7 +87,7 @@ public:
   /** Generate an <output>.rule file path for a given command output.  */
   virtual std::string GenerateRuleFile(std::string const& output) const;
 
-  void PathTooLong(cmTarget* target, cmSourceFile const* sf,
+  void PathTooLong(cmTarget* target, cmSourceFile* sf,
                    std::string const& sfRel);
 
   virtual const char* GetToolsVersion() { return "4.0"; }
@@ -112,7 +112,7 @@ private:
     LongestSourcePath(): Length(0), Target(0), SourceFile(0) {}
     size_t Length;
     cmTarget* Target;
-    cmSourceFile const* SourceFile;
+    cmSourceFile* SourceFile;
     std::string SourceRel;
   };
   LongestSourcePath LongestSource;
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 749517c..69c893c 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -118,12 +118,51 @@ void cmGlobalVisualStudioGenerator::Generate()
 }
 
 //----------------------------------------------------------------------------
-void cmGlobalVisualStudioGenerator
-::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
+void
+cmGlobalVisualStudioGenerator
+::ComputeTargetObjects(cmGeneratorTarget* gt) const
 {
+  cmLocalVisualStudioGenerator* lg =
+    static_cast<cmLocalVisualStudioGenerator*>(gt->LocalGenerator);
+  std::string dir_max = lg->ComputeLongestObjectDirectory(*gt->Target);
+
+  // Count the number of object files with each name.  Note that
+  // windows file names are not case sensitive.
+  std::map<std::string, int> counts;
+  std::vector<cmSourceFile*> objectSources;
+  gt->GetObjectSources(objectSources);
+  for(std::vector<cmSourceFile*>::const_iterator
+        si = objectSources.begin();
+      si != objectSources.end(); ++si)
+    {
+    cmSourceFile* sf = *si;
+    std::string objectNameLower = cmSystemTools::LowerCase(
+      cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()));
+    objectNameLower += ".obj";
+    counts[objectNameLower] += 1;
+    }
+
+  // For all source files producing duplicate names we need unique
+  // object name computation.
+  for(std::vector<cmSourceFile*>::const_iterator
+        si = objectSources.begin();
+      si != objectSources.end(); ++si)
+    {
+    cmSourceFile* sf = *si;
+    std::string objectName =
+      cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
+    objectName += ".obj";
+    if(counts[cmSystemTools::LowerCase(objectName)] > 1)
+      {
+      gt->AddExplicitObjectName(sf);
+      objectName = lg->GetObjectFileNameWithoutTarget(*sf, dir_max);
+      }
+    gt->AddObject(sf, objectName);
+    }
+
   std::string dir = gt->Makefile->GetCurrentOutputDirectory();
   dir += "/";
-  std::string tgtDir = gt->LocalGenerator->GetTargetDirectory(*gt->Target);
+  std::string tgtDir = lg->GetTargetDirectory(*gt->Target);
   if(!tgtDir.empty())
     {
     dir += tgtDir;
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 1ab8990..7e8dcf8 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -88,7 +88,6 @@ public:
   virtual std::string ExpandCFGIntDir(const std::string& str,
                                       const std::string& config) const;
 
-  void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
 protected:
   // Does this VS version link targets to each other if there are
   // dependencies in the SLN file?  This was done for VS versions
@@ -117,6 +116,7 @@ private:
   virtual std::string GetVSMakeProgram() = 0;
   void PrintCompilerAdvice(std::ostream&, std::string const&,
                            const char*) const {}
+  void ComputeTargetObjects(cmGeneratorTarget* gt) const;
 
   void FollowLinkDepends(cmTarget const* target,
                          std::set<cmTarget const*>& linked);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 75e9083..30a2a1e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3947,10 +3947,37 @@ bool cmGlobalXCodeGenerator::IsMultiConfig()
   return true;
 }
 
-//----------------------------------------------------------------------------
-void cmGlobalXCodeGenerator
-::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
+ //----------------------------------------------------------------------------
+void
+cmGlobalXCodeGenerator
+::ComputeTargetObjects(cmGeneratorTarget* gt) const
 {
+  // Count the number of object files with each name. Warn about duplicate
+  // names since Xcode names them uniquely automatically with a numeric suffix
+  // to avoid exact duplicate file names. Note that Mac file names are not
+  // typically case sensitive, hence the LowerCase.
+  std::map<std::string, int> counts;
+  std::vector<cmSourceFile*> objectSources;
+  gt->GetObjectSources(objectSources);
+  for(std::vector<cmSourceFile*>::const_iterator
+      si = objectSources.begin();
+      si != objectSources.end(); ++si)
+    {
+    cmSourceFile* sf = *si;
+    std::string objectName =
+      cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
+    objectName += ".o";
+
+    std::string objectNameLower = cmSystemTools::LowerCase(objectName);
+    counts[objectNameLower] += 1;
+    if (2 == counts[objectNameLower])
+      {
+      // TODO: emit warning about duplicate name?
+      }
+
+    gt->AddObject(sf, objectName);
+    }
+
   const char* configName = this->GetCMakeCFGIntDir();
   std::string dir = this->GetObjectsNormalDirectory(
     "$(PROJECT_NAME)", configName, gt->Target);
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 3d2cf8c..93315ba 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -206,7 +206,6 @@ private:
                      std::vector<std::string> const& defines,
                      bool dflag = false);
 
-  void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
 protected:
   virtual const char* GetInstallTargetName() const { return "install"; }
   virtual const char* GetPackageTargetName() const { return "package"; }
@@ -219,6 +218,7 @@ protected:
 private:
   void PrintCompilerAdvice(std::ostream&, std::string const&,
                            const char*) const {}
+  void ComputeTargetObjects(cmGeneratorTarget* gt) const;
 
   std::string GetObjectsNormalDirectory(
     const std::string &projName,
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 8c610de..de8dd51 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3080,14 +3080,6 @@ cmLocalGenerator
 }
 
 //----------------------------------------------------------------------------
-void cmLocalGenerator::ComputeObjectFilenames(
-                            std::map<cmSourceFile const*, std::string>&,
-                            cmGeneratorTarget const*)
-{
-
-}
-
-//----------------------------------------------------------------------------
 std::string
 cmLocalGenerator
 ::GetObjectFileNameWithoutTarget(const cmSourceFile& source,
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 8865288..4d62833 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -371,10 +371,6 @@ public:
                       std::string& linkPath,
                       cmGeneratorTarget* target);
 
-  virtual void ComputeObjectFilenames(
-                        std::map<cmSourceFile const*, std::string>& mapping,
-                        cmGeneratorTarget const* gt = 0);
-
 protected:
   ///! put all the libraries for a target on into the given stream
   virtual void OutputLinkLibraries(std::string& linkLibraries,
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index adeea3c..acaacdd 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -267,20 +267,6 @@ void cmLocalNinjaGenerator::SetConfigName()
     }
 }
 
-//----------------------------------------------------------------------------
-void cmLocalNinjaGenerator::ComputeObjectFilenames(
-                        std::map<cmSourceFile const*, std::string>& mapping,
-                        cmGeneratorTarget const* gt)
-{
-  for(std::map<cmSourceFile const*, std::string>::iterator
-      si = mapping.begin(); si != mapping.end(); ++si)
-    {
-    cmSourceFile const* sf = si->first;
-    si->second = this->GetObjectFileNameWithoutTarget(*sf,
-                                                      gt->ObjectDirectory);
-    }
-}
-
 void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
 {
   cmGlobalNinjaGenerator::WriteDivider(os);
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index fe1cdd6..2d870fb 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -100,10 +100,6 @@ public:
   virtual std::string ConvertToLinkReference(std::string const& lib,
                                              OutputFormat format = SHELL);
 
-  virtual void ComputeObjectFilenames(
-                        std::map<cmSourceFile const*, std::string>& mapping,
-                        cmGeneratorTarget const* gt = 0);
-
 
 protected:
   virtual std::string ConvertToIncludeReference(std::string const& path,
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 1d3878e..3681e0e 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -172,71 +172,26 @@ void cmLocalUnixMakefileGenerator3::Generate()
 }
 
 //----------------------------------------------------------------------------
-void cmLocalUnixMakefileGenerator3::ComputeObjectFilenames(
-                        std::map<cmSourceFile const*, std::string>& mapping,
-                        cmGeneratorTarget const* gt)
+void cmLocalUnixMakefileGenerator3::AddLocalObjectFile(
+  cmTarget* target, cmSourceFile* sf, std::string objNoTargetDir,
+  bool hasSourceExtension)
 {
-  for(std::map<cmSourceFile const*, std::string>::iterator
-      si = mapping.begin(); si != mapping.end(); ++si)
+  if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str()))
     {
-    cmSourceFile const* sf = si->first;
-    si->second = this->GetObjectFileNameWithoutTarget(*sf,
-                                                      gt->ObjectDirectory);
-    }
-}
-
-//----------------------------------------------------------------------------
-void cmLocalUnixMakefileGenerator3::
-GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
-{
-  std::set<std::string> emitted;
-  cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
-  for(cmGeneratorTargetsType::iterator ti = targets.begin();
-      ti != targets.end(); ++ti)
-    {
-    cmGeneratorTarget* gt = ti->second;
-    if (gt->GetType() == cmTarget::INTERFACE_LIBRARY)
-      {
-      continue;
-      }
-    std::vector<cmSourceFile const*> objectSources;
-    gt->GetObjectSources(objectSources);
-    // Compute full path to object file directory for this target.
-    std::string dir_max;
-    dir_max += gt->Makefile->GetCurrentOutputDirectory();
-    dir_max += "/";
-    dir_max += this->GetTargetDirectory(*gt->Target);
-    dir_max += "/";
-    // Compute the name of each object file.
-    for(std::vector<cmSourceFile const*>::iterator
-          si = objectSources.begin();
-        si != objectSources.end(); ++si)
-      {
-      cmSourceFile const* sf = *si;
-      bool hasSourceExtension = true;
-      std::string objectName = this->GetObjectFileNameWithoutTarget(*sf,
-                                                                    dir_max,
-                                                        &hasSourceExtension);
-      if(cmSystemTools::FileIsFullPath(objectName.c_str()))
-        {
-        objectName = cmSystemTools::GetFilenameName(objectName);
-        }
-      LocalObjectInfo& info = localObjectFiles[objectName];
-      info.HasSourceExtension = hasSourceExtension;
-      info.push_back(LocalObjectEntry(gt->Target, sf->GetLanguage()));
-      }
+    objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir);
     }
+  LocalObjectInfo& info = this->LocalObjectFiles[objNoTargetDir];
+  info.HasSourceExtension = hasSourceExtension;
+  info.push_back(LocalObjectEntry(target, sf->GetLanguage()));
 }
 
 //----------------------------------------------------------------------------
 void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets
                                             (std::vector<std::string>& targets)
 {
-  std::map<std::string, LocalObjectInfo> localObjectFiles;
-  this->GetLocalObjectFiles(localObjectFiles);
   for (std::map<std::string, LocalObjectInfo>::iterator lo =
-         localObjectFiles.begin();
-       lo != localObjectFiles.end(); ++lo)
+         this->LocalObjectFiles.begin();
+       lo != this->LocalObjectFiles.end(); ++lo)
     {
     targets.push_back(lo->first);
 
@@ -298,14 +253,11 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
   bool do_assembly_rules =
     this->GetCreateAssemblySourceRules();
 
-  std::map<std::string, LocalObjectInfo> localObjectFiles;
-  this->GetLocalObjectFiles(localObjectFiles);
-
   // now write out the object rules
   // for each object file name
   for (std::map<std::string, LocalObjectInfo>::iterator lo =
-         localObjectFiles.begin();
-       lo != localObjectFiles.end(); ++lo)
+         this->LocalObjectFiles.begin();
+       lo != this->LocalObjectFiles.end(); ++lo)
     {
     // Add a convenience rule for building the object file.
     this->WriteObjectConvenienceRule(ruleFileStream,
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 8d1acb0..7987c96 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -223,6 +223,10 @@ public:
   // write the target rules for the local Makefile into the stream
   void WriteLocalAllRules(std::ostream& ruleFileStream);
 
+  void AddLocalObjectFile(cmTarget* target, cmSourceFile* sf,
+                          std::string objNoTargetDir,
+                          bool hasSourceExtension);
+
   std::vector<std::string> const& GetLocalHelp() { return this->LocalHelp; }
 
   /** Get whether to create rules to generate preprocessed and
@@ -312,10 +316,6 @@ private:
   std::string MakeLauncher(const cmCustomCommand& cc, cmTarget* target,
                            RelativeRoot relative);
 
-  virtual void ComputeObjectFilenames(
-                        std::map<cmSourceFile const*, std::string>& mapping,
-                        cmGeneratorTarget const* gt = 0);
-
   friend class cmMakefileTargetGenerator;
   friend class cmMakefileExecutableTargetGenerator;
   friend class cmMakefileLibraryTargetGenerator;
@@ -365,9 +365,7 @@ private:
     LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false),
                       HasAssembleRule(false) {}
   };
-  void GetLocalObjectFiles(
-                    std::map<std::string, LocalObjectInfo> &localObjectFiles);
-
+  std::map<std::string, LocalObjectInfo> LocalObjectFiles;
   void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
                                   const char* comment, const char* output,
                                   LocalObjectInfo const& info);
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index bfd9223..6e93d22 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -31,46 +31,6 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator()
 }
 
 //----------------------------------------------------------------------------
-void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
-                        std::map<cmSourceFile const*, std::string>& mapping,
-                        cmGeneratorTarget const* gt)
-{
-  std::string dir_max = this->ComputeLongestObjectDirectory(*gt->Target);
-
-  // Count the number of object files with each name.  Note that
-  // windows file names are not case sensitive.
-  std::map<std::string, int> counts;
-
-  for(std::map<cmSourceFile const*, std::string>::iterator
-      si = mapping.begin(); si != mapping.end(); ++si)
-    {
-    cmSourceFile const* sf = si->first;
-    std::string objectNameLower = cmSystemTools::LowerCase(
-      cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()));
-    objectNameLower += ".obj";
-    counts[objectNameLower] += 1;
-    }
-
-  // For all source files producing duplicate names we need unique
-  // object name computation.
-
-  for(std::map<cmSourceFile const*, std::string>::iterator
-      si = mapping.begin(); si != mapping.end(); ++si)
-    {
-    cmSourceFile const* sf = si->first;
-    std::string objectName =
-      cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
-    objectName += ".obj";
-    if(counts[cmSystemTools::LowerCase(objectName)] > 1)
-      {
-      const_cast<cmGeneratorTarget*>(gt)->AddExplicitObjectName(sf);
-      objectName = this->GetObjectFileNameWithoutTarget(*sf, dir_max);
-      }
-    si->second = objectName;
-    }
-}
-
-//----------------------------------------------------------------------------
 cmsys::auto_ptr<cmCustomCommand>
 cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target,
                                                    const std::string& config,
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 1f9dfae..94a6293 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -61,10 +61,6 @@ public:
 
   virtual void AddCMakeListsRules() = 0;
 
-  virtual void ComputeObjectFilenames(
-                        std::map<cmSourceFile const*, std::string>& mapping,
-                        cmGeneratorTarget const* = 0);
-
 protected:
   virtual const char* ReportErrorLabel() const;
   virtual bool CustomCommandUseLocal() const { return false; }
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 8ff6c87..5857aef 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -71,31 +71,3 @@ void cmLocalXCodeGenerator::GenerateInstallRules()
     t->HasMacOSXRpathInstallNameDir("");
     }
 }
-
-//----------------------------------------------------------------------------
-void cmLocalXCodeGenerator::ComputeObjectFilenames(
-                        std::map<cmSourceFile const*, std::string>& mapping,
-                        cmGeneratorTarget const*)
-{
-  // Count the number of object files with each name. Warn about duplicate
-  // names since Xcode names them uniquely automatically with a numeric suffix
-  // to avoid exact duplicate file names. Note that Mac file names are not
-  // typically case sensitive, hence the LowerCase.
-  std::map<std::string, int> counts;
-  for(std::map<cmSourceFile const*, std::string>::iterator
-      si = mapping.begin(); si != mapping.end(); ++si)
-    {
-    cmSourceFile const* sf = si->first;
-    std::string objectName =
-      cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
-    objectName += ".o";
-
-    std::string objectNameLower = cmSystemTools::LowerCase(objectName);
-    counts[objectNameLower] += 1;
-    if (2 == counts[objectNameLower])
-      {
-      // TODO: emit warning about duplicate name?
-      }
-    si->second = objectName;
-    }
-}
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index f553a17..3bfe3a3 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -32,9 +32,6 @@ public:
                                 const std::string& rawFlag);
   virtual void Generate();
   virtual void GenerateInstallRules();
-  virtual void ComputeObjectFilenames(
-                        std::map<cmSourceFile const*, std::string>& mapping,
-                        cmGeneratorTarget const* gt = 0);
 private:
 
 };
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index d69846e..983fd99 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -152,9 +152,9 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
 
   // First generate the object rule files.  Save a list of all object
   // files for this target.
-  std::vector<cmSourceFile const*> customCommands;
+  std::vector<cmSourceFile*> customCommands;
   this->GeneratorTarget->GetCustomCommands(customCommands);
-  for(std::vector<cmSourceFile const*>::const_iterator
+  for(std::vector<cmSourceFile*>::const_iterator
         si = customCommands.begin();
       si != customCommands.end(); ++si)
     {
@@ -173,27 +173,27 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
         }
       }
     }
-  std::vector<cmSourceFile const*> headerSources;
+  std::vector<cmSourceFile*> headerSources;
   this->GeneratorTarget->GetHeaderSources(headerSources);
   this->OSXBundleGenerator->GenerateMacOSXContentStatements(
     headerSources,
     this->MacOSXContentGenerator);
-  std::vector<cmSourceFile const*> extraSources;
+  std::vector<cmSourceFile*> extraSources;
   this->GeneratorTarget->GetExtraSources(extraSources);
   this->OSXBundleGenerator->GenerateMacOSXContentStatements(
     extraSources,
     this->MacOSXContentGenerator);
-  std::vector<cmSourceFile const*> externalObjects;
+  std::vector<cmSourceFile*> externalObjects;
   this->GeneratorTarget->GetExternalObjects(externalObjects);
-  for(std::vector<cmSourceFile const*>::const_iterator
+  for(std::vector<cmSourceFile*>::const_iterator
         si = externalObjects.begin();
       si != externalObjects.end(); ++si)
     {
     this->ExternalObjects.push_back((*si)->GetFullPath());
     }
-  std::vector<cmSourceFile const*> objectSources;
+  std::vector<cmSourceFile*> objectSources;
   this->GeneratorTarget->GetObjectSources(objectSources);
-  for(std::vector<cmSourceFile const*>::const_iterator
+  for(std::vector<cmSourceFile*>::const_iterator
         si = objectSources.begin(); si != objectSources.end(); ++si)
     {
     // Generate this object file's rule file.
@@ -370,7 +370,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
 //----------------------------------------------------------------------------
 void
 cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()
-  (cmSourceFile const& source, const char* pkgloc)
+  (cmSourceFile& source, const char* pkgloc)
 {
   // Skip OS X content when not building a Framework or Bundle.
   if(!this->Generator->GetTarget()->IsBundleOnApple())
@@ -420,8 +420,7 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()
 }
 
 //----------------------------------------------------------------------------
-void cmMakefileTargetGenerator
-::WriteObjectRuleFiles(cmSourceFile const& source)
+void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
 {
   // Identify the language of the source file.
   const std::string& lang =
@@ -496,7 +495,7 @@ void cmMakefileTargetGenerator
 //----------------------------------------------------------------------------
 void
 cmMakefileTargetGenerator
-::AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source)
+::AppendFortranFormatFlags(std::string& flags, cmSourceFile& source)
 {
   const char* srcfmt = source.GetProperty("Fortran_FORMAT");
   cmLocalGenerator::FortranFormat format =
@@ -527,7 +526,7 @@ void
 cmMakefileTargetGenerator
 ::WriteObjectBuildFile(std::string &obj,
                        const std::string& lang,
-                       cmSourceFile const& source,
+                       cmSourceFile& source,
                        std::vector<std::string>& depends)
 {
   this->LocalGenerator->AppendRuleDepend(depends,
@@ -1191,7 +1190,7 @@ cmMakefileTargetGenerator
 
 //----------------------------------------------------------------------------
 void cmMakefileTargetGenerator
-::WriteObjectDependRules(cmSourceFile const& source,
+::WriteObjectDependRules(cmSourceFile& source,
                          std::vector<std::string>& depends)
 {
   // Create the list of dependencies known at cmake time.  These are
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index b8f04e8..bed945b 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -81,7 +81,7 @@ protected:
     MacOSXContentGeneratorType(cmMakefileTargetGenerator* gen) :
       Generator(gen) {}
 
-    void operator()(cmSourceFile const& source, const char* pkgloc);
+    void operator()(cmSourceFile& source, const char* pkgloc);
 
   private:
     cmMakefileTargetGenerator* Generator;
@@ -89,16 +89,16 @@ protected:
   friend struct MacOSXContentGeneratorType;
 
   // write the rules for an object
-  void WriteObjectRuleFiles(cmSourceFile const& source);
+  void WriteObjectRuleFiles(cmSourceFile& source);
 
   // write the build rule for an object
   void WriteObjectBuildFile(std::string &obj,
                             const std::string& lang,
-                            cmSourceFile const& source,
+                            cmSourceFile& source,
                             std::vector<std::string>& depends);
 
   // write the depend.make file for an object
-  void WriteObjectDependRules(cmSourceFile const& source,
+  void WriteObjectDependRules(cmSourceFile& source,
                               std::vector<std::string>& depends);
 
   // write the build rule for a custom command
@@ -126,8 +126,7 @@ protected:
   // Return the a string with -F flags on apple
   std::string GetFrameworkFlags(std::string const& l);
 
-  void AppendFortranFormatFlags(std::string& flags,
-                                cmSourceFile const& source);
+  void AppendFortranFormatFlags(std::string& flags, cmSourceFile& source);
 
   // append intertarget dependencies
   void AppendTargetDepends(std::vector<std::string>& depends);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 33ffc85..d652018 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -126,7 +126,7 @@ void cmNinjaTargetGenerator::AddFeatureFlags(std::string& flags,
 // void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
 // Refactor it.
 std::string
-cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source,
+cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source,
                                               const std::string& language)
 {
   // TODO: Fortran support.
@@ -211,7 +211,7 @@ bool cmNinjaTargetGenerator::needsDepFile(const std::string& lang)
 // void cmMakefileTargetGenerator::WriteTargetLanguageFlags().
 std::string
 cmNinjaTargetGenerator::
-ComputeDefines(cmSourceFile const* source, const std::string& language)
+ComputeDefines(cmSourceFile *source, const std::string& language)
 {
   std::set<std::string> defines;
 
@@ -269,14 +269,14 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
 
 std::string
 cmNinjaTargetGenerator
-::GetSourceFilePath(cmSourceFile const* source) const
+::GetSourceFilePath(cmSourceFile* source) const
 {
   return ConvertToNinjaPath(source->GetFullPath().c_str());
 }
 
 std::string
 cmNinjaTargetGenerator
-::GetObjectFilePath(cmSourceFile const* source) const
+::GetObjectFilePath(cmSourceFile* source) const
 {
   std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
   if(!path.empty())
@@ -480,36 +480,36 @@ cmNinjaTargetGenerator
     << this->GetTargetName()
     << "\n\n";
 
-  std::vector<cmSourceFile const*> customCommands;
+  std::vector<cmSourceFile*> customCommands;
   this->GeneratorTarget->GetCustomCommands(customCommands);
-  for(std::vector<cmSourceFile const*>::const_iterator
+  for(std::vector<cmSourceFile*>::const_iterator
         si = customCommands.begin();
       si != customCommands.end(); ++si)
      {
      cmCustomCommand const* cc = (*si)->GetCustomCommand();
      this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
      }
-  std::vector<cmSourceFile const*> headerSources;
+  std::vector<cmSourceFile*> headerSources;
   this->GeneratorTarget->GetHeaderSources(headerSources);
   this->OSXBundleGenerator->GenerateMacOSXContentStatements(
     headerSources,
     this->MacOSXContentGenerator);
-  std::vector<cmSourceFile const*> extraSources;
+  std::vector<cmSourceFile*> extraSources;
   this->GeneratorTarget->GetExtraSources(extraSources);
   this->OSXBundleGenerator->GenerateMacOSXContentStatements(
     extraSources,
     this->MacOSXContentGenerator);
-  std::vector<cmSourceFile const*> externalObjects;
+  std::vector<cmSourceFile*> externalObjects;
   this->GeneratorTarget->GetExternalObjects(externalObjects);
-  for(std::vector<cmSourceFile const*>::const_iterator
+  for(std::vector<cmSourceFile*>::const_iterator
         si = externalObjects.begin();
       si != externalObjects.end(); ++si)
     {
     this->Objects.push_back(this->GetSourceFilePath(*si));
     }
-  std::vector<cmSourceFile const*> objectSources;
+  std::vector<cmSourceFile*> objectSources;
   this->GeneratorTarget->GetObjectSources(objectSources);
-  for(std::vector<cmSourceFile const*>::const_iterator
+  for(std::vector<cmSourceFile*>::const_iterator
         si = objectSources.begin(); si != objectSources.end(); ++si)
     {
     this->WriteObjectBuildStatement(*si);
@@ -536,7 +536,7 @@ cmNinjaTargetGenerator
 
 void
 cmNinjaTargetGenerator
-::WriteObjectBuildStatement(cmSourceFile const* source)
+::WriteObjectBuildStatement(cmSourceFile* source)
 {
   std::string comment;
   const std::string language = source->GetLanguage();
@@ -570,9 +570,9 @@ cmNinjaTargetGenerator
   }
 
   // Add order-only dependencies on custom command outputs.
-  std::vector<cmSourceFile const*> customCommands;
+  std::vector<cmSourceFile*> customCommands;
   this->GeneratorTarget->GetCustomCommands(customCommands);
-  for(std::vector<cmSourceFile const*>::const_iterator
+  for(std::vector<cmSourceFile*>::const_iterator
         si = customCommands.begin();
       si != customCommands.end(); ++si)
     {
@@ -731,7 +731,7 @@ cmNinjaTargetGenerator
 //----------------------------------------------------------------------------
 void
 cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
-  cmSourceFile const& source, const char* pkgloc)
+  cmSourceFile& source, const char* pkgloc)
 {
   // Skip OS X content when not building a Framework or Bundle.
   if(!this->Generator->GetTarget()->IsBundleOnApple())
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 8669e6e..e66e55f 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -79,10 +79,10 @@ protected:
    * @note Generally it is the value of the variable whose name is computed
    *       by LanguageFlagsVarName().
    */
-  std::string ComputeFlagsForObject(cmSourceFile const* source,
+  std::string ComputeFlagsForObject(cmSourceFile *source,
                                     const std::string& language);
 
-  std::string ComputeDefines(cmSourceFile const* source,
+  std::string ComputeDefines(cmSourceFile *source,
                              const std::string& language);
 
   std::string ConvertToNinjaPath(const char *path) const {
@@ -96,10 +96,10 @@ protected:
   cmNinjaDeps ComputeLinkDeps() const;
 
   /// @return the source file path for the given @a source.
-  std::string GetSourceFilePath(cmSourceFile const* source) const;
+  std::string GetSourceFilePath(cmSourceFile* source) const;
 
   /// @return the object file path for the given @a source.
-  std::string GetObjectFilePath(cmSourceFile const* source) const;
+  std::string GetObjectFilePath(cmSourceFile* source) const;
 
   /// @return the file path where the target named @a name is generated.
   std::string GetTargetFilePath(const std::string& name) const;
@@ -110,7 +110,7 @@ protected:
   void WriteLanguageRules(const std::string& language);
   void WriteCompileRule(const std::string& language);
   void WriteObjectBuildStatements();
-  void WriteObjectBuildStatement(cmSourceFile const* source);
+  void WriteObjectBuildStatement(cmSourceFile* source);
   void WriteCustomCommandBuildStatement(cmCustomCommand *cc);
 
   cmNinjaDeps GetObjects() const
@@ -129,7 +129,7 @@ protected:
     MacOSXContentGeneratorType(cmNinjaTargetGenerator* g) :
       Generator(g)  {}
 
-    void operator()(cmSourceFile const& source, const char* pkgloc);
+    void operator()(cmSourceFile& source, const char* pkgloc);
 
   private:
     cmNinjaTargetGenerator* Generator;
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 6f16913..835f892 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -190,14 +190,13 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
 //----------------------------------------------------------------------------
 void
 cmOSXBundleGenerator::
-GenerateMacOSXContentStatements(
-                              std::vector<cmSourceFile const*> const& sources,
-                              MacOSXContentGeneratorType* generator)
+GenerateMacOSXContentStatements(std::vector<cmSourceFile*> const& sources,
+                                MacOSXContentGeneratorType* generator)
 {
   if (this->MustSkip())
     return;
 
-  for(std::vector<cmSourceFile const*>::const_iterator
+  for(std::vector<cmSourceFile*>::const_iterator
         si = sources.begin(); si != sources.end(); ++si)
     {
     cmGeneratorTarget::SourceFileFlags tsFlags =
diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h
index f945c15..95b4aef 100644
--- a/Source/cmOSXBundleGenerator.h
+++ b/Source/cmOSXBundleGenerator.h
@@ -44,12 +44,11 @@ public:
   struct MacOSXContentGeneratorType
   {
     virtual ~MacOSXContentGeneratorType() {}
-    virtual void operator()(cmSourceFile const& source,
-                            const char* pkgloc) = 0;
+    virtual void operator()(cmSourceFile& source, const char* pkgloc) = 0;
   };
 
   void GenerateMacOSXContentStatements(
-    std::vector<cmSourceFile const*> const& sources,
+    std::vector<cmSourceFile*> const& sources,
     MacOSXContentGeneratorType* generator);
   std::string InitMacOSXContentDirectory(const char* pkgloc);
 
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 8ceeb7d..90155b4 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -376,12 +376,12 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
 
 void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
 {
-  std::vector<cmSourceFile const*> resxObjs;
+  std::vector<cmSourceFile*> resxObjs;
     this->GeneratorTarget->GetResxSources(resxObjs);
   if(!resxObjs.empty())
     {
     this->WriteString("<ItemGroup>\n", 1);
-    for(std::vector<cmSourceFile const*>::const_iterator oi = resxObjs.begin();
+    for(std::vector<cmSourceFile*>::const_iterator oi = resxObjs.begin();
         oi != resxObjs.end(); ++oi)
       {
       std::string obj = (*oi)->GetFullPath();
@@ -550,9 +550,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
 void cmVisualStudio10TargetGenerator::WriteCustomCommands()
 {
   this->SourcesVisited.clear();
-  std::vector<cmSourceFile const*> customCommands;
+  std::vector<cmSourceFile*> customCommands;
   this->GeneratorTarget->GetCustomCommands(customCommands);
-  for(std::vector<cmSourceFile const*>::const_iterator
+  for(std::vector<cmSourceFile*>::const_iterator
         si = customCommands.begin();
       si != customCommands.end(); ++si)
     {
@@ -561,8 +561,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommands()
 }
 
 //----------------------------------------------------------------------------
-void cmVisualStudio10TargetGenerator
-::WriteCustomCommand(cmSourceFile const* sf)
+void cmVisualStudio10TargetGenerator::WriteCustomCommand(cmSourceFile* sf)
 {
   if(this->SourcesVisited.insert(sf).second)
     {
@@ -585,7 +584,7 @@ void cmVisualStudio10TargetGenerator
 }
 
 void
-cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source,
+cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
                                                  cmCustomCommand const &
                                                  command)
 {
@@ -744,12 +743,12 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
     this->WriteGroupSources(ti->first.c_str(), ti->second, sourceGroups);
     }
 
-  std::vector<cmSourceFile const*> resxObjs;
+  std::vector<cmSourceFile*> resxObjs;
     this->GeneratorTarget->GetResxSources(resxObjs);
   if(!resxObjs.empty())
     {
     this->WriteString("<ItemGroup>\n", 1);
-    for(std::vector<cmSourceFile const*>::const_iterator oi = resxObjs.begin();
+    for(std::vector<cmSourceFile*>::const_iterator oi = resxObjs.begin();
         oi != resxObjs.end(); ++oi)
       {
       std::string obj = (*oi)->GetFullPath();
@@ -900,7 +899,7 @@ WriteGroupSources(const char* name,
   for(ToolSources::const_iterator s = sources.begin();
       s != sources.end(); ++s)
     {
-    cmSourceFile const* sf = s->SourceFile;
+    cmSourceFile* sf = s->SourceFile;
     std::string const& source = sf->GetFullPath();
     cmSourceGroup* sourceGroup =
       this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
@@ -927,7 +926,7 @@ WriteGroupSources(const char* name,
 }
 
 void cmVisualStudio10TargetGenerator::WriteSource(
-  const char* tool, cmSourceFile const* sf, const char* end)
+  const char* tool, cmSourceFile* sf, const char* end)
 {
   // Visual Studio tools append relative paths to the current dir, as in:
   //
@@ -983,9 +982,9 @@ void cmVisualStudio10TargetGenerator::WriteSource(
 }
 
 void cmVisualStudio10TargetGenerator::WriteSources(
-  const char* tool, std::vector<cmSourceFile const*> const& sources)
+  const char* tool, std::vector<cmSourceFile*> const& sources)
 {
-  for(std::vector<cmSourceFile const*>::const_iterator
+  for(std::vector<cmSourceFile*>::const_iterator
         si = sources.begin(); si != sources.end(); ++si)
     {
     this->WriteSource(tool, *si);
@@ -1000,16 +999,16 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
     }
   this->WriteString("<ItemGroup>\n", 1);
 
-  std::vector<cmSourceFile const*> headerSources;
+  std::vector<cmSourceFile*> headerSources;
   this->GeneratorTarget->GetHeaderSources(headerSources);
   this->WriteSources("ClInclude", headerSources);
-  std::vector<cmSourceFile const*> idlSources;
+  std::vector<cmSourceFile*> idlSources;
   this->GeneratorTarget->GetIDLSources(idlSources);
   this->WriteSources("Midl", idlSources);
 
-  std::vector<cmSourceFile const*> objectSources;
+  std::vector<cmSourceFile*> objectSources;
   this->GeneratorTarget->GetObjectSources(objectSources);
-  for(std::vector<cmSourceFile const*>::const_iterator
+  for(std::vector<cmSourceFile*>::const_iterator
         si = objectSources.begin();
       si != objectSources.end(); ++si)
     {
@@ -1048,7 +1047,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
       }
     }
 
-  std::vector<cmSourceFile const*> externalObjects;
+  std::vector<cmSourceFile*> externalObjects;
   this->GeneratorTarget->GetExternalObjects(externalObjects);
   if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10)
     {
@@ -1060,7 +1059,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
     {
     // If an object file is generated in this target, then vs10 will use
     // it in the build, and we have to list it as None instead of Object.
-    for(std::vector<cmSourceFile const*>::const_iterator
+    for(std::vector<cmSourceFile*>::const_iterator
           si = externalObjects.begin();
         si != externalObjects.end(); ++si)
       {
@@ -1070,7 +1069,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
       }
     }
 
-  std::vector<cmSourceFile const*> extraSources;
+  std::vector<cmSourceFile*> extraSources;
   this->GeneratorTarget->GetExtraSources(extraSources);
   this->WriteSources("None", extraSources);
 
@@ -1090,9 +1089,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
 }
 
 bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
-  cmSourceFile const* source)
+  cmSourceFile* source)
 {
-  cmSourceFile const& sf = *source;
+  cmSourceFile& sf = *source;
 
   std::string objectName;
   if(this->GeneratorTarget->HasExplicitObjectName(&sf))
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index d72c6fd..02b951c 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -45,7 +45,7 @@ public:
 private:
   struct ToolSource
   {
-    cmSourceFile const* SourceFile;
+    cmSourceFile* SourceFile;
     bool RelativePath;
   };
   struct ToolSources: public std::vector<ToolSource> {};
@@ -55,10 +55,8 @@ private:
   void WriteString(const char* line, int indentLevel);
   void WriteProjectConfigurations();
   void WriteProjectConfigurationValues();
-  void WriteSource(const char* tool, cmSourceFile const* sf,
-                   const char* end = 0);
-  void WriteSources(const char* tool,
-                    std::vector<cmSourceFile const*> const&);
+  void WriteSource(const char* tool, cmSourceFile* sf, const char* end = 0);
+  void WriteSources(const char* tool, std::vector<cmSourceFile*> const&);
   void WriteAllSources();
   void WriteDotNetReferences();
   void WriteEmbeddedResourceGroup();
@@ -79,13 +77,13 @@ private:
                         std::vector<std::string> const & includes);
   void OutputIncludes(std::vector<std::string> const & includes);
   void OutputLinkIncremental(std::string const& configName);
-  void WriteCustomRule(cmSourceFile const* source,
+  void WriteCustomRule(cmSourceFile* source,
                        cmCustomCommand const & command);
   void WriteCustomCommands();
-  void WriteCustomCommand(cmSourceFile const* sf);
+  void WriteCustomCommand(cmSourceFile* sf);
   void WriteGroups();
   void WriteProjectReferences();
-  bool OutputSourceSpecificFlags(cmSourceFile const* source);
+  bool OutputSourceSpecificFlags(cmSourceFile* source);
   void AddLibraries(cmComputeLinkInformation& cli, std::string& libstring);
   void WriteLibOptions(std::string const& config);
   void WriteEvents(std::string const& configName);
@@ -113,7 +111,7 @@ private:
   cmGlobalVisualStudio10Generator* GlobalGenerator;
   cmGeneratedFileStream* BuildFileStream;
   cmLocalVisualStudio7Generator* LocalGenerator;
-  std::set<cmSourceFile const*> SourcesVisited;
+  std::set<cmSourceFile*> SourcesVisited;
 
   typedef std::map<std::string, ToolSources> ToolSourceMap;
   ToolSourceMap Tools;

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

Summary of changes:
 Source/cmGeneratorTarget.cxx               |   74 +++++++++-------------------
 Source/cmGeneratorTarget.h                 |   33 ++++++-------
 Source/cmGlobalGenerator.cxx               |    4 +-
 Source/cmGlobalGenerator.h                 |    3 +-
 Source/cmGlobalNinjaGenerator.cxx          |   19 +++++--
 Source/cmGlobalNinjaGenerator.h            |    4 +-
 Source/cmGlobalUnixMakefileGenerator3.cxx  |   20 +++++++-
 Source/cmGlobalUnixMakefileGenerator3.h    |    2 +-
 Source/cmGlobalVisualStudio10Generator.cxx |    2 +-
 Source/cmGlobalVisualStudio10Generator.h   |    4 +-
 Source/cmGlobalVisualStudioGenerator.cxx   |   45 +++++++++++++++--
 Source/cmGlobalVisualStudioGenerator.h     |    2 +-
 Source/cmGlobalXCodeGenerator.cxx          |   33 +++++++++++--
 Source/cmGlobalXCodeGenerator.h            |    2 +-
 Source/cmLocalGenerator.cxx                |    8 ---
 Source/cmLocalGenerator.h                  |    4 --
 Source/cmLocalNinjaGenerator.cxx           |   14 ------
 Source/cmLocalNinjaGenerator.h             |    4 --
 Source/cmLocalUnixMakefileGenerator3.cxx   |   72 +++++----------------------
 Source/cmLocalUnixMakefileGenerator3.h     |   12 ++---
 Source/cmLocalVisualStudioGenerator.cxx    |   40 ---------------
 Source/cmLocalVisualStudioGenerator.h      |    4 --
 Source/cmLocalXCodeGenerator.cxx           |   28 -----------
 Source/cmLocalXCodeGenerator.h             |    3 --
 Source/cmMakefileTargetGenerator.cxx       |   27 +++++-----
 Source/cmMakefileTargetGenerator.h         |   11 ++---
 Source/cmNinjaTargetGenerator.cxx          |   32 ++++++------
 Source/cmNinjaTargetGenerator.h            |   12 ++---
 Source/cmOSXBundleGenerator.cxx            |    7 ++-
 Source/cmOSXBundleGenerator.h              |    5 +-
 Source/cmVisualStudio10TargetGenerator.cxx |   43 ++++++++--------
 Source/cmVisualStudio10TargetGenerator.h   |   16 +++---
 32 files changed, 248 insertions(+), 341 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list