[Cmake-commits] CMake branch, next, updated. v3.0.0-rc1-989-gac4c26c

Stephen Kelly steveire at gmail.com
Thu Mar 13 10:45:18 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  ac4c26ca9cc431e2a7994e35d4a401c0e800eeff (commit)
       via  f6da044080d854b9ad87cef5c2a6f5195722a6da (commit)
       via  9ad804ac7be18efb92040434808f89174586b13d (commit)
       via  c725bb3cbd51edd4043f81d01b7a01bbd42adb2f (commit)
       via  dcfcd23ed53d3bfe8ef299b8a3a38c47c27fa6b6 (commit)
       via  04cf50ff62a022296832cef6b48fb532508eb853 (commit)
       via  6132d979d9d7877f5b116a2a110245adbb89e1b7 (commit)
       via  bc51221164330a24e90cf896300ded637b86d740 (commit)
       via  cd43433de56ab31269a076fb2b2ace8babaa107d (commit)
       via  d5b2e33be2119ad12744ed62920a8f8d9b6d705d (commit)
      from  f818b7107b0a51cec4459047b19ed41f36ebb3d6 (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=ac4c26ca9cc431e2a7994e35d4a401c0e800eeff
commit ac4c26ca9cc431e2a7994e35d4a401c0e800eeff
Merge: f818b71 f6da044
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Mar 13 10:45:16 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Mar 13 10:45:16 2014 -0400

    Merge topic 'target-objects-refactor' into next
    
    f6da0440 cmLocalGenerator: Add ComputeObjectFilenames interface.
    9ad804ac cmGeneratorTarget: Constify cmSourceFile* in containers.
    c725bb3c Constify some APIs in generators.
    dcfcd23e cmGeneratorTarget: Make GetSourceDepends const.
    04cf50ff cmOSXBundleGenerator: Make MacOSXContentGeneratorType arg const.
    6132d979 cmGeneratorTarget: Constify the AddExplicitObjectName API.
    bc512211 cmGeneratorTarget: Constify the AddObject API.
    cd43433d cmGlobalGenerator: Extract a ComputeTargetObjectDirectory interface.
    d5b2e33b Makefiles: Compute local object files on demand.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f6da044080d854b9ad87cef5c2a6f5195722a6da
commit f6da044080d854b9ad87cef5c2a6f5195722a6da
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Mar 11 17:37:26 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Mar 13 15:28:02 2014 +0100

    cmLocalGenerator: Add ComputeObjectFilenames interface.
    
    Implement it in the local generators and use it in the global
    generators.

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 4904d51..0a4b51c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3939,30 +3939,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 const*> objectSources;
   gt->GetObjectSources(objectSources);
-  for(std::vector<cmSourceFile const*>::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 const* 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 ebcfa08..c63de79 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3081,6 +3081,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 afcaee9..61488fe 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -372,6 +372,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 7c4aab8..2f763ce 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 9d0b7b5..e91e60b 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -101,6 +101,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 79240e1..2d36089 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 27070e2..14543fb 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -313,6 +313,10 @@ private:
   std::string MakeLauncher(cmCustomCommandGenerator const& ccg,
                            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 613ee97..9680d43 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 a89e219..3bf4f43 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:
 
 };

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9ad804ac7be18efb92040434808f89174586b13d
commit 9ad804ac7be18efb92040434808f89174586b13d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Mar 12 23:06:05 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Mar 13 15:27:23 2014 +0100

    cmGeneratorTarget: Constify cmSourceFile* in containers.
    
    Some of them will be used with other APIs which require value_type
    to be cmSourceFile const*.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index bde60b8..8efd7bb 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*>& files, cmSourceFile* f)
+  static void Do(std::vector<cmSourceFile const*>& files, cmSourceFile* f)
     {
     files.push_back(f);
     }
@@ -120,7 +120,7 @@ struct DoAccept<true>
 };
 
 //----------------------------------------------------------------------------
-template<typename Tag, typename DataType = std::vector<cmSourceFile*> >
+template<typename Tag, typename DataType = std::vector<cmSourceFile const*> >
 struct TagVisitor
 {
   DataType& Data;
@@ -306,7 +306,8 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt,
 
 //----------------------------------------------------------------------------
 void
-cmGeneratorTarget::GetObjectSources(std::vector<cmSourceFile*> &data) const
+cmGeneratorTarget
+::GetObjectSources(std::vector<cmSourceFile const*> &data) const
 {
   IMPLEMENT_VISIT(ObjectSources);
   if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY)
@@ -342,34 +343,39 @@ bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const
 }
 
 //----------------------------------------------------------------------------
-void cmGeneratorTarget::GetIDLSources(std::vector<cmSourceFile*>& data) const
+void cmGeneratorTarget
+::GetIDLSources(std::vector<cmSourceFile const*>& data) const
 {
   IMPLEMENT_VISIT(IDLSources);
 }
 
 //----------------------------------------------------------------------------
 void
-cmGeneratorTarget::GetHeaderSources(std::vector<cmSourceFile*>& data) const
+cmGeneratorTarget
+::GetHeaderSources(std::vector<cmSourceFile const*>& data) const
 {
   IMPLEMENT_VISIT(HeaderSources);
 }
 
 //----------------------------------------------------------------------------
-void cmGeneratorTarget::GetExtraSources(std::vector<cmSourceFile*>& data) const
+void cmGeneratorTarget
+::GetExtraSources(std::vector<cmSourceFile const*>& data) const
 {
   IMPLEMENT_VISIT(ExtraSources);
 }
 
 //----------------------------------------------------------------------------
 void
-cmGeneratorTarget::GetCustomCommands(std::vector<cmSourceFile*>& data) const
+cmGeneratorTarget
+::GetCustomCommands(std::vector<cmSourceFile const*>& data) const
 {
   IMPLEMENT_VISIT(CustomCommands);
 }
 
 //----------------------------------------------------------------------------
 void
-cmGeneratorTarget::GetExternalObjects(std::vector<cmSourceFile*>& data) const
+cmGeneratorTarget
+::GetExternalObjects(std::vector<cmSourceFile const*>& data) const
 {
   IMPLEMENT_VISIT(ExternalObjects);
 }
@@ -384,7 +390,8 @@ cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& srcs) const
 }
 
 //----------------------------------------------------------------------------
-void cmGeneratorTarget::GetResxSources(std::vector<cmSourceFile*>& srcs) const
+void cmGeneratorTarget
+::GetResxSources(std::vector<cmSourceFile const*>& srcs) const
 {
   ResxData data;
   IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData)
@@ -570,7 +577,7 @@ cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) const
     cmTarget* objLib = *ti;
     cmGeneratorTarget* ogt =
       this->GlobalGenerator->GetGeneratorTarget(objLib);
-    for(std::vector<cmSourceFile*>::const_iterator
+    for(std::vector<cmSourceFile const*>::const_iterator
           si = ogt->ObjectSources.begin();
         si != ogt->ObjectSources.end(); ++si)
       {
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 1c4276c..139e736 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;
+  void GetObjectSources(std::vector<cmSourceFile const*> &) const;
   const std::string& GetObjectName(cmSourceFile const* file);
 
   void AddObject(cmSourceFile const* sf, std::string const&name);
   bool HasExplicitObjectName(cmSourceFile const* file) const;
   void AddExplicitObjectName(cmSourceFile const* 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 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 GetExpectedResxHeaders(std::set<std::string>&) const;
 
   cmTarget* Target;
@@ -117,7 +117,7 @@ public:
 
   struct ResxData {
     mutable std::set<std::string> ExpectedResxHeaders;
-    mutable std::vector<cmSourceFile*> ResxSources;
+    mutable std::vector<cmSourceFile const*> ResxSources;
   };
 private:
   friend class cmTargetTraceDependencies;
@@ -127,7 +127,7 @@ private:
 
   std::map<cmSourceFile const*, std::string> Objects;
   std::set<cmSourceFile const*> ExplicitObjectName;
-  mutable std::vector<cmSourceFile*> ObjectSources;
+  mutable std::vector<cmSourceFile const*> ObjectSources;
   std::vector<cmTarget*> ObjectLibraries;
   mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
 
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 686414d..e9c31e9 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -634,14 +634,14 @@ std::string cmGlobalNinjaGenerator::GetEditCacheCommand() const
 // TODO: Refactor to combine with cmGlobalUnixMakefileGenerator3 impl.
 void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
 {
-  std::vector<cmSourceFile*> objectSources;
+  std::vector<cmSourceFile const*> objectSources;
   gt->GetObjectSources(objectSources);
   // Compute the name of each object file.
-  for(std::vector<cmSourceFile*>::iterator
+  for(std::vector<cmSourceFile const*>::iterator
         si = objectSources.begin();
       si != objectSources.end(); ++si)
     {
-    cmSourceFile* sf = *si;
+    cmSourceFile const* sf = *si;
     std::string objectName = gt->LocalGenerator
       ->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory);
     gt->AddObject(sf, objectName);
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index f9ec0a9..6ce8678 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -108,14 +108,14 @@ void
 cmGlobalUnixMakefileGenerator3
 ::ComputeTargetObjects(cmGeneratorTarget* gt) const
 {
-  std::vector<cmSourceFile*> objectSources;
+  std::vector<cmSourceFile const*> objectSources;
   gt->GetObjectSources(objectSources);
   // Compute the name of each object file.
-  for(std::vector<cmSourceFile*>::iterator
+  for(std::vector<cmSourceFile const*>::iterator
         si = objectSources.begin();
       si != objectSources.end(); ++si)
     {
-    cmSourceFile* sf = *si;
+    cmSourceFile const* sf = *si;
     std::string objectName = gt->LocalGenerator
       ->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory);
     gt->AddObject(sf, objectName);
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index f3cba5a..bd57d0c 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -129,13 +129,13 @@ cmGlobalVisualStudioGenerator
   // 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;
+  std::vector<cmSourceFile const*> objectSources;
   gt->GetObjectSources(objectSources);
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
         si = objectSources.begin();
       si != objectSources.end(); ++si)
     {
-    cmSourceFile* sf = *si;
+    cmSourceFile const* sf = *si;
     std::string objectNameLower = cmSystemTools::LowerCase(
       cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()));
     objectNameLower += ".obj";
@@ -144,11 +144,11 @@ cmGlobalVisualStudioGenerator
 
   // For all source files producing duplicate names we need unique
   // object name computation.
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
         si = objectSources.begin();
       si != objectSources.end(); ++si)
     {
-    cmSourceFile* sf = *si;
+    cmSourceFile const* sf = *si;
     std::string objectName =
       cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
     objectName += ".obj";
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 6c12040..4904d51 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3944,13 +3944,13 @@ cmGlobalXCodeGenerator
   // 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;
+  std::vector<cmSourceFile const*> objectSources;
   gt->GetObjectSources(objectSources);
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
       si = objectSources.begin();
       si != objectSources.end(); ++si)
     {
-    cmSourceFile* sf = *si;
+    cmSourceFile const* sf = *si;
     std::string objectName =
       cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
     objectName += ".o";
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index a838ce3..79240e1 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -185,7 +185,7 @@ GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
       {
       continue;
       }
-    std::vector<cmSourceFile*> objectSources;
+    std::vector<cmSourceFile const*> objectSources;
     gt->GetObjectSources(objectSources);
     // Compute full path to object file directory for this target.
     std::string dir_max;
@@ -194,11 +194,11 @@ GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
     dir_max += this->GetTargetDirectory(*gt->Target);
     dir_max += "/";
     // Compute the name of each object file.
-    for(std::vector<cmSourceFile*>::iterator
+    for(std::vector<cmSourceFile const*>::iterator
           si = objectSources.begin();
         si != objectSources.end(); ++si)
       {
-      cmSourceFile* sf = *si;
+      cmSourceFile const* sf = *si;
       bool hasSourceExtension = true;
       std::string objectName = this->GetObjectFileNameWithoutTarget(*sf,
                                                                     dir_max,
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 32e1c1a..6759d05 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -153,9 +153,9 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
 
   // First generate the object rule files.  Save a list of all object
   // files for this target.
-  std::vector<cmSourceFile*> customCommands;
+  std::vector<cmSourceFile const*> customCommands;
   this->GeneratorTarget->GetCustomCommands(customCommands);
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
         si = customCommands.begin();
       si != customCommands.end(); ++si)
     {
@@ -176,27 +176,27 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
         }
       }
     }
-  std::vector<cmSourceFile*> headerSources;
+  std::vector<cmSourceFile const*> headerSources;
   this->GeneratorTarget->GetHeaderSources(headerSources);
   this->OSXBundleGenerator->GenerateMacOSXContentStatements(
     headerSources,
     this->MacOSXContentGenerator);
-  std::vector<cmSourceFile*> extraSources;
+  std::vector<cmSourceFile const*> extraSources;
   this->GeneratorTarget->GetExtraSources(extraSources);
   this->OSXBundleGenerator->GenerateMacOSXContentStatements(
     extraSources,
     this->MacOSXContentGenerator);
-  std::vector<cmSourceFile*> externalObjects;
+  std::vector<cmSourceFile const*> externalObjects;
   this->GeneratorTarget->GetExternalObjects(externalObjects);
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
         si = externalObjects.begin();
       si != externalObjects.end(); ++si)
     {
     this->ExternalObjects.push_back((*si)->GetFullPath());
     }
-  std::vector<cmSourceFile*> objectSources;
+  std::vector<cmSourceFile const*> objectSources;
   this->GeneratorTarget->GetObjectSources(objectSources);
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
         si = objectSources.begin(); si != objectSources.end(); ++si)
     {
     // Generate this object file's rule file.
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 3738ca7..4319f3c 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -480,36 +480,36 @@ cmNinjaTargetGenerator
     << this->GetTargetName()
     << "\n\n";
 
-  std::vector<cmSourceFile*> customCommands;
+  std::vector<cmSourceFile const*> customCommands;
   this->GeneratorTarget->GetCustomCommands(customCommands);
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
         si = customCommands.begin();
       si != customCommands.end(); ++si)
      {
      cmCustomCommand const* cc = (*si)->GetCustomCommand();
      this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
      }
-  std::vector<cmSourceFile*> headerSources;
+  std::vector<cmSourceFile const*> headerSources;
   this->GeneratorTarget->GetHeaderSources(headerSources);
   this->OSXBundleGenerator->GenerateMacOSXContentStatements(
     headerSources,
     this->MacOSXContentGenerator);
-  std::vector<cmSourceFile*> extraSources;
+  std::vector<cmSourceFile const*> extraSources;
   this->GeneratorTarget->GetExtraSources(extraSources);
   this->OSXBundleGenerator->GenerateMacOSXContentStatements(
     extraSources,
     this->MacOSXContentGenerator);
-  std::vector<cmSourceFile*> externalObjects;
+  std::vector<cmSourceFile const*> externalObjects;
   this->GeneratorTarget->GetExternalObjects(externalObjects);
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
         si = externalObjects.begin();
       si != externalObjects.end(); ++si)
     {
     this->Objects.push_back(this->GetSourceFilePath(*si));
     }
-  std::vector<cmSourceFile*> objectSources;
+  std::vector<cmSourceFile const*> objectSources;
   this->GeneratorTarget->GetObjectSources(objectSources);
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
         si = objectSources.begin(); si != objectSources.end(); ++si)
     {
     this->WriteObjectBuildStatement(*si);
@@ -570,9 +570,9 @@ cmNinjaTargetGenerator
   }
 
   // Add order-only dependencies on custom command outputs.
-  std::vector<cmSourceFile*> customCommands;
+  std::vector<cmSourceFile const*> customCommands;
   this->GeneratorTarget->GetCustomCommands(customCommands);
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
         si = customCommands.begin();
       si != customCommands.end(); ++si)
     {
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 835f892..6f16913 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -190,13 +190,14 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
 //----------------------------------------------------------------------------
 void
 cmOSXBundleGenerator::
-GenerateMacOSXContentStatements(std::vector<cmSourceFile*> const& sources,
-                                MacOSXContentGeneratorType* generator)
+GenerateMacOSXContentStatements(
+                              std::vector<cmSourceFile const*> const& sources,
+                              MacOSXContentGeneratorType* generator)
 {
   if (this->MustSkip())
     return;
 
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
         si = sources.begin(); si != sources.end(); ++si)
     {
     cmGeneratorTarget::SourceFileFlags tsFlags =
diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h
index 5acdd9f..f945c15 100644
--- a/Source/cmOSXBundleGenerator.h
+++ b/Source/cmOSXBundleGenerator.h
@@ -49,7 +49,7 @@ public:
   };
 
   void GenerateMacOSXContentStatements(
-    std::vector<cmSourceFile*> const& sources,
+    std::vector<cmSourceFile const*> const& sources,
     MacOSXContentGeneratorType* generator);
   std::string InitMacOSXContentDirectory(const char* pkgloc);
 
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index cc1fdbc..b8631ca 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -377,12 +377,12 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
 
 void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
 {
-  std::vector<cmSourceFile*> resxObjs;
+  std::vector<cmSourceFile const*> resxObjs;
     this->GeneratorTarget->GetResxSources(resxObjs);
   if(!resxObjs.empty())
     {
     this->WriteString("<ItemGroup>\n", 1);
-    for(std::vector<cmSourceFile*>::const_iterator oi = resxObjs.begin();
+    for(std::vector<cmSourceFile const*>::const_iterator oi = resxObjs.begin();
         oi != resxObjs.end(); ++oi)
       {
       std::string obj = (*oi)->GetFullPath();
@@ -551,9 +551,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
 void cmVisualStudio10TargetGenerator::WriteCustomCommands()
 {
   this->SourcesVisited.clear();
-  std::vector<cmSourceFile*> customCommands;
+  std::vector<cmSourceFile const*> customCommands;
   this->GeneratorTarget->GetCustomCommands(customCommands);
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
         si = customCommands.begin();
       si != customCommands.end(); ++si)
     {
@@ -746,12 +746,12 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
     this->WriteGroupSources(ti->first.c_str(), ti->second, sourceGroups);
     }
 
-  std::vector<cmSourceFile*> resxObjs;
+  std::vector<cmSourceFile const*> resxObjs;
     this->GeneratorTarget->GetResxSources(resxObjs);
   if(!resxObjs.empty())
     {
     this->WriteString("<ItemGroup>\n", 1);
-    for(std::vector<cmSourceFile*>::const_iterator oi = resxObjs.begin();
+    for(std::vector<cmSourceFile const*>::const_iterator oi = resxObjs.begin();
         oi != resxObjs.end(); ++oi)
       {
       std::string obj = (*oi)->GetFullPath();
@@ -902,7 +902,7 @@ WriteGroupSources(const char* name,
   for(ToolSources::const_iterator s = sources.begin();
       s != sources.end(); ++s)
     {
-    cmSourceFile* sf = s->SourceFile;
+    cmSourceFile const* sf = s->SourceFile;
     std::string const& source = sf->GetFullPath();
     cmSourceGroup* sourceGroup =
       this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
@@ -985,9 +985,9 @@ void cmVisualStudio10TargetGenerator::WriteSource(
 }
 
 void cmVisualStudio10TargetGenerator::WriteSources(
-  const char* tool, std::vector<cmSourceFile*> const& sources)
+  const char* tool, std::vector<cmSourceFile const*> const& sources)
 {
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
         si = sources.begin(); si != sources.end(); ++si)
     {
     this->WriteSource(tool, *si);
@@ -1002,16 +1002,16 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
     }
   this->WriteString("<ItemGroup>\n", 1);
 
-  std::vector<cmSourceFile*> headerSources;
+  std::vector<cmSourceFile const*> headerSources;
   this->GeneratorTarget->GetHeaderSources(headerSources);
   this->WriteSources("ClInclude", headerSources);
-  std::vector<cmSourceFile*> idlSources;
+  std::vector<cmSourceFile const*> idlSources;
   this->GeneratorTarget->GetIDLSources(idlSources);
   this->WriteSources("Midl", idlSources);
 
-  std::vector<cmSourceFile*> objectSources;
+  std::vector<cmSourceFile const*> objectSources;
   this->GeneratorTarget->GetObjectSources(objectSources);
-  for(std::vector<cmSourceFile*>::const_iterator
+  for(std::vector<cmSourceFile const*>::const_iterator
         si = objectSources.begin();
       si != objectSources.end(); ++si)
     {
@@ -1050,7 +1050,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
       }
     }
 
-  std::vector<cmSourceFile*> externalObjects;
+  std::vector<cmSourceFile const*> externalObjects;
   this->GeneratorTarget->GetExternalObjects(externalObjects);
   if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10)
     {
@@ -1062,7 +1062,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_iterator
+    for(std::vector<cmSourceFile const*>::const_iterator
           si = externalObjects.begin();
         si != externalObjects.end(); ++si)
       {
@@ -1072,7 +1072,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
       }
     }
 
-  std::vector<cmSourceFile*> extraSources;
+  std::vector<cmSourceFile const*> extraSources;
   this->GeneratorTarget->GetExtraSources(extraSources);
   this->WriteSources("None", extraSources);
 
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 8faeb8e..d72c6fd 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -57,7 +57,8 @@ private:
   void WriteProjectConfigurationValues();
   void WriteSource(const char* tool, cmSourceFile const* sf,
                    const char* end = 0);
-  void WriteSources(const char* tool, std::vector<cmSourceFile*> const&);
+  void WriteSources(const char* tool,
+                    std::vector<cmSourceFile const*> const&);
   void WriteAllSources();
   void WriteDotNetReferences();
   void WriteEmbeddedResourceGroup();

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c725bb3cbd51edd4043f81d01b7a01bbd42adb2f
commit c725bb3cbd51edd4043f81d01b7a01bbd42adb2f
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Mar 12 23:50:42 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Mar 13 15:27:23 2014 +0100

    Constify some APIs in generators.

diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 840e888..37a416b 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -470,7 +470,7 @@ cmGlobalVisualStudio10Generator
 
 //----------------------------------------------------------------------------
 void cmGlobalVisualStudio10Generator::PathTooLong(
-  cmTarget* target, cmSourceFile* sf, std::string const& sfRel)
+  cmTarget* target, cmSourceFile const* 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 999a9d5..ede6b1b 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* sf,
+  void PathTooLong(cmTarget* target, cmSourceFile const* 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* SourceFile;
+    cmSourceFile const* SourceFile;
     std::string SourceRel;
   };
   LongestSourcePath LongestSource;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index fdca7f7..32e1c1a 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -423,7 +423,8 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()
 }
 
 //----------------------------------------------------------------------------
-void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
+void cmMakefileTargetGenerator
+::WriteObjectRuleFiles(cmSourceFile const& source)
 {
   // Identify the language of the source file.
   const std::string& lang =
@@ -498,7 +499,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
 //----------------------------------------------------------------------------
 void
 cmMakefileTargetGenerator
-::AppendFortranFormatFlags(std::string& flags, cmSourceFile& source)
+::AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source)
 {
   const char* srcfmt = source.GetProperty("Fortran_FORMAT");
   cmLocalGenerator::FortranFormat format =
@@ -529,7 +530,7 @@ void
 cmMakefileTargetGenerator
 ::WriteObjectBuildFile(std::string &obj,
                        const std::string& lang,
-                       cmSourceFile& source,
+                       cmSourceFile const& source,
                        std::vector<std::string>& depends)
 {
   this->LocalGenerator->AppendRuleDepend(depends,
@@ -1194,7 +1195,7 @@ cmMakefileTargetGenerator
 
 //----------------------------------------------------------------------------
 void cmMakefileTargetGenerator
-::WriteObjectDependRules(cmSourceFile& source,
+::WriteObjectDependRules(cmSourceFile const& 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 f59bd9b..7ff6da9 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -89,16 +89,16 @@ protected:
   friend struct MacOSXContentGeneratorType;
 
   // write the rules for an object
-  void WriteObjectRuleFiles(cmSourceFile& source);
+  void WriteObjectRuleFiles(cmSourceFile const& source);
 
   // write the build rule for an object
   void WriteObjectBuildFile(std::string &obj,
                             const std::string& lang,
-                            cmSourceFile& source,
+                            cmSourceFile const& source,
                             std::vector<std::string>& depends);
 
   // write the depend.make file for an object
-  void WriteObjectDependRules(cmSourceFile& source,
+  void WriteObjectDependRules(cmSourceFile const& source,
                               std::vector<std::string>& depends);
 
   // write the build rule for a custom command
@@ -126,7 +126,8 @@ protected:
   // Return the a string with -F flags on apple
   std::string GetFrameworkFlags(std::string const& l);
 
-  void AppendFortranFormatFlags(std::string& flags, cmSourceFile& source);
+  void AppendFortranFormatFlags(std::string& flags,
+                                cmSourceFile const& source);
 
   // append intertarget dependencies
   void AppendTargetDepends(std::vector<std::string>& depends);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 149b129..3738ca7 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 *source,
+cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* 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 *source, const std::string& language)
+ComputeDefines(cmSourceFile const* source, const std::string& language)
 {
   std::set<std::string> defines;
 
@@ -269,14 +269,14 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
 
 std::string
 cmNinjaTargetGenerator
-::GetSourceFilePath(cmSourceFile* source) const
+::GetSourceFilePath(cmSourceFile const* source) const
 {
   return ConvertToNinjaPath(source->GetFullPath().c_str());
 }
 
 std::string
 cmNinjaTargetGenerator
-::GetObjectFilePath(cmSourceFile* source) const
+::GetObjectFilePath(cmSourceFile const* source) const
 {
   std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
   if(!path.empty())
@@ -536,7 +536,7 @@ cmNinjaTargetGenerator
 
 void
 cmNinjaTargetGenerator
-::WriteObjectBuildStatement(cmSourceFile* source)
+::WriteObjectBuildStatement(cmSourceFile const* source)
 {
   std::string comment;
   const std::string language = source->GetLanguage();
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 900e2bd..8669e6e 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 *source,
+  std::string ComputeFlagsForObject(cmSourceFile const* source,
                                     const std::string& language);
 
-  std::string ComputeDefines(cmSourceFile *source,
+  std::string ComputeDefines(cmSourceFile const* 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* source) const;
+  std::string GetSourceFilePath(cmSourceFile const* source) const;
 
   /// @return the object file path for the given @a source.
-  std::string GetObjectFilePath(cmSourceFile* source) const;
+  std::string GetObjectFilePath(cmSourceFile const* 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* source);
+  void WriteObjectBuildStatement(cmSourceFile const* source);
   void WriteCustomCommandBuildStatement(cmCustomCommand *cc);
 
   cmNinjaDeps GetObjects() const
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 7c55f64..cc1fdbc 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -562,7 +562,8 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommands()
 }
 
 //----------------------------------------------------------------------------
-void cmVisualStudio10TargetGenerator::WriteCustomCommand(cmSourceFile* sf)
+void cmVisualStudio10TargetGenerator
+::WriteCustomCommand(cmSourceFile const* sf)
 {
   if(this->SourcesVisited.insert(sf).second)
     {
@@ -585,7 +586,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommand(cmSourceFile* sf)
 }
 
 void
-cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
+cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source,
                                                  cmCustomCommand const &
                                                  command)
 {
@@ -928,7 +929,7 @@ WriteGroupSources(const char* name,
 }
 
 void cmVisualStudio10TargetGenerator::WriteSource(
-  const char* tool, cmSourceFile* sf, const char* end)
+  const char* tool, cmSourceFile const* sf, const char* end)
 {
   // Visual Studio tools append relative paths to the current dir, as in:
   //
@@ -1091,9 +1092,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
 }
 
 bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
-  cmSourceFile* source)
+  cmSourceFile const* source)
 {
-  cmSourceFile& sf = *source;
+  cmSourceFile const& sf = *source;
 
   std::string objectName;
   if(this->GeneratorTarget->HasExplicitObjectName(&sf))
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 02b951c..8faeb8e 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -45,7 +45,7 @@ public:
 private:
   struct ToolSource
   {
-    cmSourceFile* SourceFile;
+    cmSourceFile const* SourceFile;
     bool RelativePath;
   };
   struct ToolSources: public std::vector<ToolSource> {};
@@ -55,7 +55,8 @@ private:
   void WriteString(const char* line, int indentLevel);
   void WriteProjectConfigurations();
   void WriteProjectConfigurationValues();
-  void WriteSource(const char* tool, cmSourceFile* sf, const char* end = 0);
+  void WriteSource(const char* tool, cmSourceFile const* sf,
+                   const char* end = 0);
   void WriteSources(const char* tool, std::vector<cmSourceFile*> const&);
   void WriteAllSources();
   void WriteDotNetReferences();
@@ -77,13 +78,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* source,
+  void WriteCustomRule(cmSourceFile const* source,
                        cmCustomCommand const & command);
   void WriteCustomCommands();
-  void WriteCustomCommand(cmSourceFile* sf);
+  void WriteCustomCommand(cmSourceFile const* sf);
   void WriteGroups();
   void WriteProjectReferences();
-  bool OutputSourceSpecificFlags(cmSourceFile* source);
+  bool OutputSourceSpecificFlags(cmSourceFile const* source);
   void AddLibraries(cmComputeLinkInformation& cli, std::string& libstring);
   void WriteLibOptions(std::string const& config);
   void WriteEvents(std::string const& configName);
@@ -111,7 +112,7 @@ private:
   cmGlobalVisualStudio10Generator* GlobalGenerator;
   cmGeneratedFileStream* BuildFileStream;
   cmLocalVisualStudio7Generator* LocalGenerator;
-  std::set<cmSourceFile*> SourcesVisited;
+  std::set<cmSourceFile const*> SourcesVisited;
 
   typedef std::map<std::string, ToolSources> ToolSourceMap;
   ToolSourceMap Tools;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dcfcd23ed53d3bfe8ef299b8a3a38c47c27fa6b6
commit dcfcd23ed53d3bfe8ef299b8a3a38c47c27fa6b6
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Mar 13 00:19:50 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Mar 13 15:27:23 2014 +0100

    cmGeneratorTarget: Make GetSourceDepends const.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 4d335cd..bde60b8 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -241,7 +241,7 @@ const char *cmGeneratorTarget::GetProperty(const std::string& prop) const
 
 //----------------------------------------------------------------------------
 std::vector<cmSourceFile*> const*
-cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const
+cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const
 {
   SourceEntriesType::const_iterator i = this->SourceEntries.find(sf);
   if(i != this->SourceEntries.end())
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index d1a0e06..1c4276c 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -87,7 +87,8 @@ public:
   void LookupObjectLibraries();
 
   /** Get sources that must be built before the given source.  */
-  std::vector<cmSourceFile*> const* GetSourceDepends(cmSourceFile* sf) const;
+  std::vector<cmSourceFile*> const*
+  GetSourceDepends(cmSourceFile const* sf) const;
 
   /**
    * Flags for a given source file as used in this target. Typically assigned
@@ -121,7 +122,7 @@ public:
 private:
   friend class cmTargetTraceDependencies;
   struct SourceEntry { std::vector<cmSourceFile*> Depends; };
-  typedef std::map<cmSourceFile*, SourceEntry> SourceEntriesType;
+  typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType;
   SourceEntriesType SourceEntries;
 
   std::map<cmSourceFile const*, std::string> Objects;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=04cf50ff62a022296832cef6b48fb532508eb853
commit 04cf50ff62a022296832cef6b48fb532508eb853
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Mar 12 23:45:43 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Mar 13 15:27:23 2014 +0100

    cmOSXBundleGenerator: Make MacOSXContentGeneratorType arg const.

diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 3161aba..fdca7f7 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -373,7 +373,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
 //----------------------------------------------------------------------------
 void
 cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()
-  (cmSourceFile& source, const char* pkgloc)
+  (cmSourceFile const& source, const char* pkgloc)
 {
   // Skip OS X content when not building a Framework or Bundle.
   if(!this->Generator->GetTarget()->IsBundleOnApple())
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 97c58b9..f59bd9b 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -81,7 +81,7 @@ protected:
     MacOSXContentGeneratorType(cmMakefileTargetGenerator* gen) :
       Generator(gen) {}
 
-    void operator()(cmSourceFile& source, const char* pkgloc);
+    void operator()(cmSourceFile const& source, const char* pkgloc);
 
   private:
     cmMakefileTargetGenerator* Generator;
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index ed3782c..149b129 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -733,7 +733,7 @@ cmNinjaTargetGenerator
 //----------------------------------------------------------------------------
 void
 cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
-  cmSourceFile& source, const char* pkgloc)
+  cmSourceFile const& 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 e66e55f..900e2bd 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -129,7 +129,7 @@ protected:
     MacOSXContentGeneratorType(cmNinjaTargetGenerator* g) :
       Generator(g)  {}
 
-    void operator()(cmSourceFile& source, const char* pkgloc);
+    void operator()(cmSourceFile const& source, const char* pkgloc);
 
   private:
     cmNinjaTargetGenerator* Generator;
diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h
index 95b4aef..5acdd9f 100644
--- a/Source/cmOSXBundleGenerator.h
+++ b/Source/cmOSXBundleGenerator.h
@@ -44,7 +44,8 @@ public:
   struct MacOSXContentGeneratorType
   {
     virtual ~MacOSXContentGeneratorType() {}
-    virtual void operator()(cmSourceFile& source, const char* pkgloc) = 0;
+    virtual void operator()(cmSourceFile const& source,
+                            const char* pkgloc) = 0;
   };
 
   void GenerateMacOSXContentStatements(

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6132d979d9d7877f5b116a2a110245adbb89e1b7
commit 6132d979d9d7877f5b116a2a110245adbb89e1b7
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Mar 13 12:28:32 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Mar 13 15:27:23 2014 +0100

    cmGeneratorTarget: Constify the AddExplicitObjectName API.
    
    The storage is already const.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 1d8d2dd..4d335cd 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -328,7 +328,7 @@ void cmGeneratorTarget::AddObject(cmSourceFile const* sf,
 }
 
 //----------------------------------------------------------------------------
-void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile* sf)
+void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile const* sf)
 {
   this->ExplicitObjectName.insert(sf);
 }
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index e5ed271..d1a0e06 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -37,7 +37,7 @@ public:
 
   void AddObject(cmSourceFile const* sf, std::string const&name);
   bool HasExplicitObjectName(cmSourceFile const* file) const;
-  void AddExplicitObjectName(cmSourceFile* sf);
+  void AddExplicitObjectName(cmSourceFile const* sf);
 
   void GetResxSources(std::vector<cmSourceFile*>&) const;
   void GetIDLSources(std::vector<cmSourceFile*>&) const;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bc51221164330a24e90cf896300ded637b86d740
commit bc51221164330a24e90cf896300ded637b86d740
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Mar 12 23:43:43 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Mar 13 15:27:23 2014 +0100

    cmGeneratorTarget: Constify the AddObject API.
    
    The storage is already const.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index db88749..1d8d2dd 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -321,7 +321,8 @@ const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
   return this->Objects[file];
 }
 
-void cmGeneratorTarget::AddObject(cmSourceFile *sf, std::string const&name)
+void cmGeneratorTarget::AddObject(cmSourceFile const* sf,
+                                  std::string const&name)
 {
     this->Objects[sf] = name;
 }
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 81a447f..e5ed271 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -35,7 +35,7 @@ public:
   void GetObjectSources(std::vector<cmSourceFile*> &) const;
   const std::string& GetObjectName(cmSourceFile const* file);
 
-  void AddObject(cmSourceFile *sf, std::string const&name);
+  void AddObject(cmSourceFile const* sf, std::string const&name);
   bool HasExplicitObjectName(cmSourceFile const* file) const;
   void AddExplicitObjectName(cmSourceFile* sf);
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cd43433de56ab31269a076fb2b2ace8babaa107d
commit cd43433de56ab31269a076fb2b2ace8babaa107d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Mar 12 21:09:20 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Mar 13 15:27:23 2014 +0100

    cmGlobalGenerator: Extract a ComputeTargetObjectDirectory interface.
    
    Make it public for future external calls.

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index b95ff81..c9ae799 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1449,6 +1449,7 @@ void cmGlobalGenerator::ComputeGeneratorTargetObjects()
         continue;
         }
       cmGeneratorTarget* gt = ti->second;
+      this->ComputeTargetObjectDirectory(gt);
       gt->LookupObjectLibraries();
       this->ComputeTargetObjects(gt);
       }
@@ -1520,6 +1521,11 @@ void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const
   // Implemented in generator subclasses that need this.
 }
 
+//----------------------------------------------------------------------------
+void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
+{
+}
+
 void cmGlobalGenerator::CheckLocalGenerators()
 {
   std::map<std::string, std::string> notFoundMap;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 91e71a8..ed07b10 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -323,6 +323,8 @@ 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
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 0a05f5a..686414d 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -634,16 +634,6 @@ std::string cmGlobalNinjaGenerator::GetEditCacheCommand() const
 // TODO: Refactor to combine with cmGlobalUnixMakefileGenerator3 impl.
 void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
 {
-  cmTarget* target = gt->Target;
-
-  // Compute full path to object file directory for this target.
-  std::string dir_max;
-  dir_max += gt->Makefile->GetCurrentOutputDirectory();
-  dir_max += "/";
-  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.
@@ -653,12 +643,27 @@ void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
     {
     cmSourceFile* sf = *si;
     std::string objectName = gt->LocalGenerator
-      ->GetObjectFileNameWithoutTarget(*sf, dir_max);
+      ->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory);
     gt->AddObject(sf, objectName);
     }
 }
 
 //----------------------------------------------------------------------------
+void cmGlobalNinjaGenerator
+::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
+{
+  cmTarget* target = gt->Target;
+
+  // Compute full path to object file directory for this target.
+  std::string dir_max;
+  dir_max += gt->Makefile->GetCurrentOutputDirectory();
+  dir_max += "/";
+  dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
+  dir_max += "/";
+  gt->ObjectDirectory = dir_max;
+}
+
+//----------------------------------------------------------------------------
 // Private methods
 
 void cmGlobalNinjaGenerator::OpenBuildFileStream()
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 7725cf3..e3a22e5 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.
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 0e03e89..f9ec0a9 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -108,15 +108,6 @@ void
 cmGlobalUnixMakefileGenerator3
 ::ComputeTargetObjects(cmGeneratorTarget* gt) const
 {
-  cmTarget* target = gt->Target;
-  // Compute full path to object file directory for this target.
-  std::string dir_max;
-  dir_max += gt->Makefile->GetCurrentOutputDirectory();
-  dir_max += "/";
-  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.
@@ -126,11 +117,27 @@ cmGlobalUnixMakefileGenerator3
     {
     cmSourceFile* sf = *si;
     std::string objectName = gt->LocalGenerator
-      ->GetObjectFileNameWithoutTarget(*sf, dir_max);
+      ->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory);
     gt->AddObject(sf, objectName);
     }
 }
 
+//----------------------------------------------------------------------------
+void
+cmGlobalUnixMakefileGenerator3
+::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
+{
+  cmTarget* target = gt->Target;
+
+  // Compute full path to object file directory for this target.
+  std::string dir_max;
+  dir_max += gt->Makefile->GetCurrentOutputDirectory();
+  dir_max += "/";
+  dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
+  dir_max += "/";
+  gt->ObjectDirectory = dir_max;
+}
+
 void cmGlobalUnixMakefileGenerator3::Configure()
 {
   // Initialize CMAKE_EDIT_COMMAND cache entry.
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 8115176..42453f2 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -128,6 +128,7 @@ public:
   /** Does the make tool tolerate .NOTPARALLEL? */
   virtual bool AllowNotParallel() const { return true; }
 
+  virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
 protected:
   void WriteMainMakefile2();
   void WriteMainCMakefile();
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 69c893c..f3cba5a 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -159,10 +159,15 @@ cmGlobalVisualStudioGenerator
       }
     gt->AddObject(sf, objectName);
     }
+}
 
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudioGenerator
+::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
+{
   std::string dir = gt->Makefile->GetCurrentOutputDirectory();
   dir += "/";
-  std::string tgtDir = lg->GetTargetDirectory(*gt->Target);
+  std::string tgtDir = gt->LocalGenerator->GetTargetDirectory(*gt->Target);
   if(!tgtDir.empty())
     {
     dir += tgtDir;
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 7e8dcf8..f957056 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -88,6 +88,7 @@ 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
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 36196a2..6c12040 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3964,7 +3964,12 @@ cmGlobalXCodeGenerator
 
     gt->AddObject(sf, objectName);
     }
+}
 
+//----------------------------------------------------------------------------
+void cmGlobalXCodeGenerator
+::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
+{
   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 be81cdc..f9dd58f 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -204,6 +204,7 @@ 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"; }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d5b2e33be2119ad12744ed62920a8f8d9b6d705d
commit d5b2e33be2119ad12744ed62920a8f8d9b6d705d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Mar 11 16:35:58 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Mar 13 15:27:23 2014 +0100

    Makefiles: Compute local object files on demand.
    
    Don't compute them up front.

diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index f5c56a9..0e03e89 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -109,9 +109,6 @@ cmGlobalUnixMakefileGenerator3
 ::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;
   dir_max += gt->Makefile->GetCurrentOutputDirectory();
@@ -128,12 +125,9 @@ cmGlobalUnixMakefileGenerator3
       si != objectSources.end(); ++si)
     {
     cmSourceFile* sf = *si;
-    bool hasSourceExtension = true;
     std::string objectName = gt->LocalGenerator
-      ->GetObjectFileNameWithoutTarget(*sf, dir_max,
-                                       &hasSourceExtension);
+      ->GetObjectFileNameWithoutTarget(*sf, dir_max);
     gt->AddObject(sf, objectName);
-    lg->AddLocalObjectFile(target, sf, objectName, hasSourceExtension);
     }
 }
 
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 9f12ffe..a838ce3 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -172,26 +172,57 @@ void cmLocalUnixMakefileGenerator3::Generate()
 }
 
 //----------------------------------------------------------------------------
-void cmLocalUnixMakefileGenerator3::AddLocalObjectFile(
-  cmTarget* target, cmSourceFile* sf, std::string objNoTargetDir,
-  bool hasSourceExtension)
+void cmLocalUnixMakefileGenerator3::
+GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
 {
-  if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str()))
+  std::set<std::string> emitted;
+  cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
+  for(cmGeneratorTargetsType::iterator ti = targets.begin();
+      ti != targets.end(); ++ti)
     {
-    objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir);
+    cmGeneratorTarget* gt = ti->second;
+    if (gt->GetType() == cmTarget::INTERFACE_LIBRARY)
+      {
+      continue;
+      }
+    std::vector<cmSourceFile*> 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*>::iterator
+          si = objectSources.begin();
+        si != objectSources.end(); ++si)
+      {
+      cmSourceFile* 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()));
+      }
     }
-  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 =
-         this->LocalObjectFiles.begin();
-       lo != this->LocalObjectFiles.end(); ++lo)
+         localObjectFiles.begin();
+       lo != localObjectFiles.end(); ++lo)
     {
     targets.push_back(lo->first);
 
@@ -253,11 +284,14 @@ 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 =
-         this->LocalObjectFiles.begin();
-       lo != this->LocalObjectFiles.end(); ++lo)
+         localObjectFiles.begin();
+       lo != 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 d504247..27070e2 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -224,10 +224,6 @@ 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
@@ -366,7 +362,9 @@ private:
     LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false),
                       HasAssembleRule(false) {}
   };
-  std::map<std::string, LocalObjectInfo> LocalObjectFiles;
+  void GetLocalObjectFiles(
+                    std::map<std::string, LocalObjectInfo> &localObjectFiles);
+
   void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
                                   const char* comment, const char* output,
                                   LocalObjectInfo const& info);

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

Summary of changes:
 Source/cmGeneratorTarget.cxx               |   34 ++++++++-----
 Source/cmGeneratorTarget.h                 |   29 +++++------
 Source/cmGlobalGenerator.cxx               |    6 +++
 Source/cmGlobalGenerator.h                 |    2 +
 Source/cmGlobalNinjaGenerator.cxx          |   38 ++++++++++-----
 Source/cmGlobalNinjaGenerator.h            |    2 +-
 Source/cmGlobalUnixMakefileGenerator3.cxx  |   42 +++++++++-------
 Source/cmGlobalUnixMakefileGenerator3.h    |    1 +
 Source/cmGlobalVisualStudio10Generator.cxx |    2 +-
 Source/cmGlobalVisualStudio10Generator.h   |    4 +-
 Source/cmGlobalVisualStudioGenerator.cxx   |   57 ++++++++--------------
 Source/cmGlobalVisualStudioGenerator.h     |    1 +
 Source/cmGlobalXCodeGenerator.cxx          |   37 +++++++-------
 Source/cmGlobalXCodeGenerator.h            |    1 +
 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, 390 insertions(+), 208 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list