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  14830b39d5042619927b1476aabf9c2a9c091907 (commit)
       via  f7cf3b489331de41799ba8c4acbf86663a59f912 (commit)
       via  fb5bc12610d7412d461bd4bd353f5471b634111f (commit)
      from  672709e6052f051cd677f7c5c527b41d5bdb618d (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=14830b39d5042619927b1476aabf9c2a9c091907
commit 14830b39d5042619927b1476aabf9c2a9c091907
Merge: 672709e f7cf3b4
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Thu Mar 13 08:01:15 2014 -0400
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Thu Mar 13 08:01:15 2014 -0400

    Merge topic 'target-objects-refactor' into next
    
    f7cf3b48 cmGeneratorTarget: Compute target objects on demand
    fb5bc126 cmLocalGenerator: Add ComputeObjectFilenames method.

diff --cc Source/cmLocalUnixMakefileGenerator3.h
index 465e94d,8d1acb0..5041345
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@@ -310,17 -309,13 +310,21 @@@ 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=f7cf3b489331de41799ba8c4acbf86663a59f912
commit f7cf3b489331de41799ba8c4acbf86663a59f912
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Tue Mar 11 20:39:01 2014 +0100
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Thu Mar 13 13:00:35 2014 +0100

    cmGeneratorTarget: Compute target objects on demand
    
    Add a ComputeTargetObjects method to compute the object
    names.  It takes a non-const reference to a mapping so
    that it can be extended in the future with parameters
    relevant to generator expression evaluation.
    
    Remove the old method from the generators which are now all
    functionally identical.
    
    Remove the supporting cmGeneratorTarget::AddObject method. It is
    no longer needed as the container member is populated directly.
    
    In a follow-up, the UseObjectLibraries usage may be replaced by a
    true generator expression evaluator for TARGET_OBJECTS. That
    will require generators to use cmGeneratorTarget::GetExternalObjects
    which is not currently the case for Xcode and VS generators.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 8efd7bb..63e479b 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -310,24 +310,15 @@ cmGeneratorTarget
 ::GetObjectSources(std::vector<cmSourceFile const*> &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 const* sf,
-                                  std::string const&name)
-{
-    this->Objects[sf] = name;
-}
-
 //----------------------------------------------------------------------------
 void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile const* sf)
 {
@@ -577,18 +568,45 @@ 
cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) const
     cmTarget* objLib = *ti;
     cmGeneratorTarget* ogt =
       this->GlobalGenerator->GetGeneratorTarget(objLib);
-    for(std::vector<cmSourceFile const*>::const_iterator
-          si = ogt->ObjectSources.begin();
-        si != ogt->ObjectSources.end(); ++si)
+
+    ogt->ComputeTargetObjects(ogt->Objects);
+
+    for(std::map<cmSourceFile const*, std::string>::const_iterator
+        objIt = ogt->Objects.begin();
+        objIt != ogt->Objects.end(); ++objIt)
       {
+      assert(!objIt->second.empty());
       std::string obj = ogt->ObjectDirectory;
-      obj += ogt->Objects[*si];
+      obj += objIt->second;
       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 139e736..3eca156 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -125,9 +125,8 @@ private:
   typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType;
   SourceEntriesType SourceEntries;
 
-  std::map<cmSourceFile const*, std::string> Objects;
+  mutable std::map<cmSourceFile const*, std::string> Objects;
   std::set<cmSourceFile const*> ExplicitObjectName;
-  mutable std::vector<cmSourceFile const*> ObjectSources;
   std::vector<cmTarget*> ObjectLibraries;
   mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
 
@@ -135,6 +134,9 @@ 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 c9ae799..4945e89 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1449,9 +1449,7 @@ void cmGlobalGenerator::ComputeGeneratorTargetObjects()
         continue;
         }
       cmGeneratorTarget* gt = ti->second;
-      this->ComputeTargetObjectDirectory(gt);
       gt->LookupObjectLibraries();
-      this->ComputeTargetObjects(gt);
       }
     }
 }
@@ -1516,12 +1514,6 @@ cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) 
const
 }
 
 //----------------------------------------------------------------------------
-void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const
-{
-  // Implemented in generator subclasses that need this.
-}
-
-//----------------------------------------------------------------------------
 void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
 {
 }
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index ed07b10..5366733 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -443,7 +443,6 @@ 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 08507eb..49ce1b5 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -632,29 +632,6 @@ std::string cmGlobalNinjaGenerator::GetEditCacheCommand() 
const
   return cmSystemTools::GetCMakeGUICommand();
 }
 
-// TODO: Refactor to combine with cmGlobalUnixMakefileGenerator3 impl.
-void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
-{
-  std::vector<cmSourceFile const*> objectSources;
-  gt->GetObjectSources(objectSources);
-
-  std::map<cmSourceFile const*, std::string> mapping;
-  for(std::vector<cmSourceFile const*>::const_iterator it
-      = objectSources.begin(); it != objectSources.end(); ++it)
-    {
-    mapping[*it];
-    }
-
-  gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
-
-  for(std::map<cmSourceFile const*, std::string>::const_iterator it
-      = mapping.begin(); it != mapping.end(); ++it)
-    {
-    assert(!it->second.empty());
-    gt->AddObject(it->first, it->second);
-    }
-}
-
 //----------------------------------------------------------------------------
 void cmGlobalNinjaGenerator
 ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index e3a22e5..f2643af 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -310,8 +310,6 @@ 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 91258ed0..4632071 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -106,30 +106,6 @@ std::string 
cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const
 //----------------------------------------------------------------------------
 void
 cmGlobalUnixMakefileGenerator3
-::ComputeTargetObjects(cmGeneratorTarget* gt) const
-{
-  std::vector<cmSourceFile const*> objectSources;
-  gt->GetObjectSources(objectSources);
-
-  std::map<cmSourceFile const*, std::string> mapping;
-  for(std::vector<cmSourceFile const*>::const_iterator it
-      = objectSources.begin(); it != objectSources.end(); ++it)
-    {
-    mapping[*it];
-    }
-
-  gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
-
-  for(std::map<cmSourceFile const*, std::string>::const_iterator it
-      = mapping.begin(); it != mapping.end(); ++it)
-    {
-    gt->AddObject(it->first, it->second);
-    }
-}
-
-//----------------------------------------------------------------------------
-void
-cmGlobalUnixMakefileGenerator3
 ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
 {
   cmTarget* target = gt->Target;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h 
b/Source/cmGlobalUnixMakefileGenerator3.h
index 42453f2..d003789 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -199,7 +199,6 @@ 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/cmGlobalVisualStudioGenerator.cxx 
b/Source/cmGlobalVisualStudioGenerator.cxx
index 9740fbf..749517c 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -118,30 +118,6 @@ void cmGlobalVisualStudioGenerator::Generate()
 }
 
 //----------------------------------------------------------------------------
-void
-cmGlobalVisualStudioGenerator
-::ComputeTargetObjects(cmGeneratorTarget* gt) const
-{
-  std::vector<cmSourceFile const*> objectSources;
-  gt->GetObjectSources(objectSources);
-
-  std::map<cmSourceFile const*, std::string> mapping;
-  for(std::vector<cmSourceFile const*>::const_iterator it
-      = objectSources.begin(); it != objectSources.end(); ++it)
-    {
-    mapping[*it];
-    }
-
-  gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
-
-  for(std::map<cmSourceFile const*, std::string>::const_iterator it
-      = mapping.begin(); it != mapping.end(); ++it)
-    {
-    gt->AddObject(it->first, it->second);
-    }
-}
-
-//----------------------------------------------------------------------------
 void cmGlobalVisualStudioGenerator
 ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
 {
diff --git a/Source/cmGlobalVisualStudioGenerator.h 
b/Source/cmGlobalVisualStudioGenerator.h
index f957056..1ab8990 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -117,7 +117,6 @@ 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 3ab804c..75e9083 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3947,30 +3947,6 @@ bool cmGlobalXCodeGenerator::IsMultiConfig()
   return true;
 }
 
- //----------------------------------------------------------------------------
-void
-cmGlobalXCodeGenerator
-::ComputeTargetObjects(cmGeneratorTarget* gt) const
-{
-  std::vector<cmSourceFile*> objectSources;
-  gt->GetObjectSources(objectSources);
-
-  std::map<cmSourceFile const*, std::string> mapping;
-  for(std::vector<cmSourceFile const*>::const_iterator it
-      = objectSources.begin(); it != objectSources.end(); ++it)
-    {
-    mapping[*it];
-    }
-
-  gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
-
-  for(std::map<cmSourceFile const*, std::string>::const_iterator it
-      = mapping.begin(); it != mapping.end(); ++it)
-    {
-    gt->AddObject(it->first, it->second);
-    }
-}
-
 //----------------------------------------------------------------------------
 void cmGlobalXCodeGenerator
 ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 64f40b3..3d2cf8c 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -219,7 +219,6 @@ protected:
 private:
   void PrintCompilerAdvice(std::ostream&, std::string const&,
                            const char*) const {}
-  void ComputeTargetObjects(cmGeneratorTarget* gt) const;
 
   std::string GetObjectsNormalDirectory(
     const std::string &projName,

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fb5bc12610d7412d461bd4bd353f5471b634111f
commit fb5bc12610d7412d461bd4bd353f5471b634111f
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Tue Mar 11 17:37:26 2014 +0100
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Thu Mar 13 12:59:39 2014 +0100

    cmLocalGenerator: Add ComputeObjectFilenames method.

diff --git a/Source/cmGlobalNinjaGenerator.cxx 
b/Source/cmGlobalNinjaGenerator.cxx
index e9c31e9..08507eb 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -19,6 +19,7 @@
 #include "cmVersion.h"
 
 #include <algorithm>
+#include <assert.h>
 
 const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja";
 const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja";
@@ -636,15 +637,21 @@ void 
cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
 {
   std::vector<cmSourceFile const*> objectSources;
   gt->GetObjectSources(objectSources);
-  // Compute the name of each object file.
-  for(std::vector<cmSourceFile const*>::iterator
-        si = objectSources.begin();
-      si != objectSources.end(); ++si)
+
+  std::map<cmSourceFile const*, std::string> mapping;
+  for(std::vector<cmSourceFile const*>::const_iterator it
+      = objectSources.begin(); it != objectSources.end(); ++it)
+    {
+    mapping[*it];
+    }
+
+  gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
+
+  for(std::map<cmSourceFile const*, std::string>::const_iterator it
+      = mapping.begin(); it != mapping.end(); ++it)
     {
-    cmSourceFile const* sf = *si;
-    std::string objectName = gt->LocalGenerator
-      ->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory);
-    gt->AddObject(sf, objectName);
+    assert(!it->second.empty());
+    gt->AddObject(it->first, it->second);
     }
 }
 
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx 
b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 6ce8678..91258ed0 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -110,15 +110,20 @@ cmGlobalUnixMakefileGenerator3
 {
   std::vector<cmSourceFile const*> objectSources;
   gt->GetObjectSources(objectSources);
-  // Compute the name of each object file.
-  for(std::vector<cmSourceFile const*>::iterator
-        si = objectSources.begin();
-      si != objectSources.end(); ++si)
+
+  std::map<cmSourceFile const*, std::string> mapping;
+  for(std::vector<cmSourceFile const*>::const_iterator it
+      = objectSources.begin(); it != objectSources.end(); ++it)
+    {
+    mapping[*it];
+    }
+
+  gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
+
+  for(std::map<cmSourceFile const*, std::string>::const_iterator it
+      = mapping.begin(); it != mapping.end(); ++it)
     {
-    cmSourceFile const* sf = *si;
-    std::string objectName = gt->LocalGenerator
-      ->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory);
-    gt->AddObject(sf, objectName);
+    gt->AddObject(it->first, it->second);
     }
 }
 
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx 
b/Source/cmGlobalVisualStudioGenerator.cxx
index bd57d0c..9740fbf 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -122,42 +122,22 @@ 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 const*> objectSources;
   gt->GetObjectSources(objectSources);
-  for(std::vector<cmSourceFile const*>::const_iterator
-        si = objectSources.begin();
-      si != objectSources.end(); ++si)
-    {
-    cmSourceFile const* 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*>::const_iterator
-        si = objectSources.begin();
-      si != objectSources.end(); ++si)
-    {
-    cmSourceFile const* 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::map<cmSourceFile const*, std::string> mapping;
+  for(std::vector<cmSourceFile const*>::const_iterator it
+      = objectSources.begin(); it != objectSources.end(); ++it)
+    {
+    mapping[*it];
+    }
+
+  gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
+
+  for(std::map<cmSourceFile const*, std::string>::const_iterator it
+      = mapping.begin(); it != mapping.end(); ++it)
+    {
+    gt->AddObject(it->first, it->second);
     }
 }
 
diff --git a/Source/cmGlobalXCodeGenerator.cxx 
b/Source/cmGlobalXCodeGenerator.cxx
index bd5ed58..3ab804c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3952,30 +3952,22 @@ 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)
+
+  std::map<cmSourceFile const*, std::string> mapping;
+  for(std::vector<cmSourceFile const*>::const_iterator it
+      = objectSources.begin(); it != objectSources.end(); ++it)
     {
-    cmSourceFile* sf = *si;
-    std::string objectName =
-      cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
-    objectName += ".o";
+    mapping[*it];
+    }
 
-    std::string objectNameLower = cmSystemTools::LowerCase(objectName);
-    counts[objectNameLower] += 1;
-    if (2 == counts[objectNameLower])
-      {
-      // TODO: emit warning about duplicate name?
-      }
+  gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
 
-    gt->AddObject(sf, objectName);
+  for(std::map<cmSourceFile const*, std::string>::const_iterator it
+      = mapping.begin(); it != mapping.end(); ++it)
+    {
+    gt->AddObject(it->first, it->second);
     }
 }
 
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index de8dd51..8c610de 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3080,6 +3080,14 @@ 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 4d62833..8865288 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -371,6 +371,10 @@ 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 acaacdd..adeea3c 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -267,6 +267,20 @@ 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 2d870fb..fe1cdd6 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -100,6 +100,10 @@ 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 76263f9..1d3878e 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -172,6 +172,20 @@ void cmLocalUnixMakefileGenerator3::Generate()
 }
 
 //----------------------------------------------------------------------------
+void cmLocalUnixMakefileGenerator3::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 cmLocalUnixMakefileGenerator3::
 GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
 {
diff --git a/Source/cmLocalUnixMakefileGenerator3.h 
b/Source/cmLocalUnixMakefileGenerator3.h
index 73b425e..8d1acb0 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -312,6 +312,10 @@ 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;
diff --git a/Source/cmLocalVisualStudioGenerator.cxx 
b/Source/cmLocalVisualStudioGenerator.cxx
index 6e93d22..bfd9223 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -31,6 +31,46 @@ 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 94a6293..1f9dfae 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -61,6 +61,10 @@ 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 5857aef..8ff6c87 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -71,3 +71,31 @@ 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 3bfe3a3..f553a17 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -32,6 +32,9 @@ 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:
 
 };

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

Summary of changes:
 Source/cmLocalUnixMakefileGenerator3.h |    4 ++++
 1 file changed, 4 insertions(+)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits

Reply via email to