소스 검색

Merge topic 'use-generator-target'

879fd35 Revert "Move GenerateTargetManifest to cmGeneratorTarget."
6674583 Fix compiler warning with initialization order.
5285458 Add convenience for getting a cmGeneratorTarget to use.
c31f3d9 Add a wrapper for accessing config-specific compile-definitions.
d1446ca Append the COMPILE_DEFINITIONS from the Makefile to all targets.
290e92a Move GetIncludeDirectories to cmGeneratorTarget.
f9146f6 Port cmLocalGenerator::GetTargetFlags to cmGeneratorTarget.
9facfd1 Move GetCreateRuleVariable to cmGeneratorTarget.
78bfee3 Make cmLocalGenerator::AddArchitectureFlags take a cmGeneratorTarget.
4f5384e Move GetLinkInformation to cmGeneratorTarget
987e12e Move GenerateTargetManifest to cmGeneratorTarget.
14bf778 Store cmGeneratorTargets with the makefile.
f428ca2 Add more forwarding API to cmGeneratorTarget.
David Cole 13 년 전
부모
커밋
3f3b731961

+ 3 - 1
Source/cmExtraCodeBlocksGenerator.cxx

@@ -636,9 +636,11 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
       // the include directories for this target
       // the include directories for this target
       std::set<std::string> uniqIncludeDirs;
       std::set<std::string> uniqIncludeDirs;
 
 
+      cmGeneratorTarget *gtgt = this->GlobalGenerator
+                                    ->GetGeneratorTarget(target);
       std::vector<std::string> includes;
       std::vector<std::string> includes;
       target->GetMakefile()->GetLocalGenerator()->
       target->GetMakefile()->GetLocalGenerator()->
-        GetIncludeDirectories(includes, target);
+        GetIncludeDirectories(includes, gtgt);
       for(std::vector<std::string>::const_iterator dirIt=includes.begin();
       for(std::vector<std::string>::const_iterator dirIt=includes.begin();
           dirIt != includes.end();
           dirIt != includes.end();
           ++dirIt)
           ++dirIt)

+ 5 - 3
Source/cmExtraEclipseCDT4Generator.cxx

@@ -884,11 +884,13 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
        it != this->GlobalGenerator->GetLocalGenerators().end();
        it != this->GlobalGenerator->GetLocalGenerators().end();
        ++it)
        ++it)
     {
     {
-    cmTargets & targets = (*it)->GetMakefile()->GetTargets();
-    for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l)
+    cmGeneratorTargetsType targets = (*it)->GetMakefile()
+                                        ->GetGeneratorTargets();
+    for (cmGeneratorTargetsType::iterator l = targets.begin();
+         l != targets.end(); ++l)
       {
       {
       std::vector<std::string> includeDirs;
       std::vector<std::string> includeDirs;
-      (*it)->GetIncludeDirectories(includeDirs, &l->second);
+      (*it)->GetIncludeDirectories(includeDirs, l->second);
       this->AppendIncludeDirectories(fout, includeDirs, emmited);
       this->AppendIncludeDirectories(fout, includeDirs, emmited);
       }
       }
     }
     }

+ 146 - 0
Source/cmGeneratorTarget.cxx

@@ -14,9 +14,12 @@
 #include "cmTarget.h"
 #include "cmTarget.h"
 #include "cmMakefile.h"
 #include "cmMakefile.h"
 #include "cmLocalGenerator.h"
 #include "cmLocalGenerator.h"
+#include "cmComputeLinkInformation.h"
 #include "cmGlobalGenerator.h"
 #include "cmGlobalGenerator.h"
 #include "cmSourceFile.h"
 #include "cmSourceFile.h"
 
 
+#include <assert.h>
+
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
 cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
 {
 {
@@ -27,6 +30,45 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
   this->LookupObjectLibraries();
   this->LookupObjectLibraries();
 }
 }
 
 
+cmGeneratorTarget::~cmGeneratorTarget()
+{
+  for(std::map<cmStdString, cmComputeLinkInformation*>::iterator i
+                  = LinkInformation.begin(); i != LinkInformation.end(); ++i)
+    {
+    delete i->second;
+    }
+}
+
+//----------------------------------------------------------------------------
+int cmGeneratorTarget::GetType() const
+{
+  return this->Target->GetType();
+}
+
+//----------------------------------------------------------------------------
+const char *cmGeneratorTarget::GetName() const
+{
+  return this->Target->GetName();
+}
+
+//----------------------------------------------------------------------------
+const char *cmGeneratorTarget::GetProperty(const char *prop)
+{
+  return this->Target->GetProperty(prop);
+}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::GetPropertyAsBool(const char *prop)
+{
+  return this->Target->GetPropertyAsBool(prop);
+}
+
+//----------------------------------------------------------------------------
+std::vector<cmSourceFile*> const& cmGeneratorTarget::GetSourceFiles()
+{
+  return this->Target->GetSourceFiles();
+}
+
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 void cmGeneratorTarget::ClassifySources()
 void cmGeneratorTarget::ClassifySources()
 {
 {
@@ -175,3 +217,107 @@ void cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs)
       }
       }
     }
     }
 }
 }
+
+//----------------------------------------------------------------------------
+cmComputeLinkInformation*
+cmGeneratorTarget::GetLinkInformation(const char* config)
+{
+  // Lookup any existing information for this configuration.
+  std::map<cmStdString, cmComputeLinkInformation*>::iterator
+    i = this->LinkInformation.find(config?config:"");
+  if(i == this->LinkInformation.end())
+    {
+    // Compute information for this configuration.
+    cmComputeLinkInformation* info =
+      new cmComputeLinkInformation(this->Target, config);
+    if(!info || !info->Compute())
+      {
+      delete info;
+      info = 0;
+      }
+
+    // Store the information for this configuration.
+    std::map<cmStdString, cmComputeLinkInformation*>::value_type
+      entry(config?config:"", info);
+    i = this->LinkInformation.insert(entry).first;
+    }
+  return i->second;
+}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetAppleArchs(const char* config,
+                             std::vector<std::string>& archVec)
+{
+  const char* archs = 0;
+  if(config && *config)
+    {
+    std::string defVarName = "OSX_ARCHITECTURES_";
+    defVarName += cmSystemTools::UpperCase(config);
+    archs = this->Target->GetProperty(defVarName.c_str());
+    }
+  if(!archs)
+    {
+    archs = this->Target->GetProperty("OSX_ARCHITECTURES");
+    }
+  if(archs)
+    {
+    cmSystemTools::ExpandListArgument(std::string(archs), archVec);
+    }
+}
+
+//----------------------------------------------------------------------------
+const char* cmGeneratorTarget::GetCreateRuleVariable()
+{
+  switch(this->GetType())
+    {
+    case cmTarget::STATIC_LIBRARY:
+      return "_CREATE_STATIC_LIBRARY";
+    case cmTarget::SHARED_LIBRARY:
+      return "_CREATE_SHARED_LIBRARY";
+    case cmTarget::MODULE_LIBRARY:
+      return "_CREATE_SHARED_MODULE";
+    case cmTarget::EXECUTABLE:
+      return "_LINK_EXECUTABLE";
+    default:
+      break;
+    }
+  return "";
+}
+
+//----------------------------------------------------------------------------
+std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories()
+{
+  std::vector<std::string> includes;
+  const char *prop = this->Target->GetProperty("INCLUDE_DIRECTORIES");
+  if(prop)
+    {
+    cmSystemTools::ExpandListArgument(prop, includes);
+    }
+
+  std::set<std::string> uniqueIncludes;
+  std::vector<std::string> orderedAndUniqueIncludes;
+  for(std::vector<std::string>::const_iterator
+      li = includes.begin(); li != includes.end(); ++li)
+    {
+    if(uniqueIncludes.insert(*li).second)
+      {
+      orderedAndUniqueIncludes.push_back(*li);
+      }
+    }
+
+  return orderedAndUniqueIncludes;
+}
+
+//----------------------------------------------------------------------------
+const char *cmGeneratorTarget::GetCompileDefinitions(const char *config)
+{
+  if (!config)
+    {
+    return this->Target->GetProperty("COMPILE_DEFINITIONS");
+    }
+  std::string defPropName = "COMPILE_DEFINITIONS_";
+  defPropName +=
+    cmSystemTools::UpperCase(config);
+
+  return this->Target->GetProperty(defPropName.c_str());
+}

+ 26 - 0
Source/cmGeneratorTarget.h

@@ -14,6 +14,7 @@
 
 
 #include "cmStandardIncludes.h"
 #include "cmStandardIncludes.h"
 
 
+class cmComputeLinkInformation;
 class cmCustomCommand;
 class cmCustomCommand;
 class cmGlobalGenerator;
 class cmGlobalGenerator;
 class cmLocalGenerator;
 class cmLocalGenerator;
@@ -25,6 +26,13 @@ class cmGeneratorTarget
 {
 {
 public:
 public:
   cmGeneratorTarget(cmTarget*);
   cmGeneratorTarget(cmTarget*);
+  ~cmGeneratorTarget();
+
+  int GetType() const;
+  const char *GetName() const;
+  const char *GetProperty(const char *prop);
+  bool GetPropertyAsBool(const char *prop);
+  std::vector<cmSourceFile*> const& GetSourceFiles();
 
 
   cmTarget* Target;
   cmTarget* Target;
   cmMakefile* Makefile;
   cmMakefile* Makefile;
@@ -52,6 +60,22 @@ public:
 
 
   void UseObjectLibraries(std::vector<std::string>& objs);
   void UseObjectLibraries(std::vector<std::string>& objs);
 
 
+  std::map<cmStdString, cmComputeLinkInformation*> LinkInformation;
+
+  cmComputeLinkInformation* GetLinkInformation(const char* config);
+
+  void GetAppleArchs(const char* config,
+                     std::vector<std::string>& archVec);
+
+  ///! Return the rule variable used to create this type of target,
+  //  need to add CMAKE_(LANG) for full name.
+  const char* GetCreateRuleVariable();
+
+  /** Get the include directories for this target.  */
+  std::vector<std::string> GetIncludeDirectories();
+
+  const char *GetCompileDefinitions(const char *config = 0);
+
 private:
 private:
   void ClassifySources();
   void ClassifySources();
   void LookupObjectLibraries();
   void LookupObjectLibraries();
@@ -60,4 +84,6 @@ private:
   void operator=(cmGeneratorTarget const&);
   void operator=(cmGeneratorTarget const&);
 };
 };
 
 
+typedef std::map<cmTarget*, cmGeneratorTarget*> cmGeneratorTargetsType;
+
 #endif
 #endif

+ 33 - 10
Source/cmGlobalGenerator.cxx

@@ -1075,23 +1075,46 @@ void cmGlobalGenerator::CreateGeneratorTargets()
   // Construct per-target generator information.
   // Construct per-target generator information.
   for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
   for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
     {
     {
-    cmTargets& targets =
-      this->LocalGenerators[i]->GetMakefile()->GetTargets();
+    cmGeneratorTargetsType generatorTargets;
+
+    cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
+    const char *noconfig_compile_definitions =
+                                      mf->GetProperty("COMPILE_DEFINITIONS");
+
+    std::vector<std::string> configs;
+    mf->GetConfigurations(configs);
+
+    cmTargets& targets = mf->GetTargets();
     for(cmTargets::iterator ti = targets.begin();
     for(cmTargets::iterator ti = targets.begin();
         ti != targets.end(); ++ti)
         ti != targets.end(); ++ti)
       {
       {
       cmTarget* t = &ti->second;
       cmTarget* t = &ti->second;
+
+      {
+      t->AppendProperty("COMPILE_DEFINITIONS", noconfig_compile_definitions);
+      for(std::vector<std::string>::const_iterator ci = configs.begin();
+          ci != configs.end(); ++ci)
+        {
+        std::string defPropName = "COMPILE_DEFINITIONS_";
+        defPropName += cmSystemTools::UpperCase(*ci);
+        t->AppendProperty(defPropName.c_str(),
+                          mf->GetProperty(defPropName.c_str()));
+        }
+      }
+
       cmGeneratorTarget* gt = new cmGeneratorTarget(t);
       cmGeneratorTarget* gt = new cmGeneratorTarget(t);
       this->GeneratorTargets[t] = gt;
       this->GeneratorTargets[t] = gt;
       this->ComputeTargetObjects(gt);
       this->ComputeTargetObjects(gt);
+      generatorTargets[t] = gt;
       }
       }
+    mf->SetGeneratorTargets(generatorTargets);
     }
     }
 }
 }
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 void cmGlobalGenerator::ClearGeneratorTargets()
 void cmGlobalGenerator::ClearGeneratorTargets()
 {
 {
-  for(GeneratorTargetsType::iterator i = this->GeneratorTargets.begin();
+  for(cmGeneratorTargetsType::iterator i = this->GeneratorTargets.begin();
       i != this->GeneratorTargets.end(); ++i)
       i != this->GeneratorTargets.end(); ++i)
     {
     {
     delete i->second;
     delete i->second;
@@ -1102,7 +1125,7 @@ void cmGlobalGenerator::ClearGeneratorTargets()
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 cmGeneratorTarget* cmGlobalGenerator::GetGeneratorTarget(cmTarget* t) const
 cmGeneratorTarget* cmGlobalGenerator::GetGeneratorTarget(cmTarget* t) const
 {
 {
-  GeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t);
+  cmGeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t);
   if(ti == this->GeneratorTargets.end())
   if(ti == this->GeneratorTargets.end())
     {
     {
     this->CMakeInstance->IssueMessage(
     this->CMakeInstance->IssueMessage(
@@ -1129,13 +1152,13 @@ void cmGlobalGenerator::CheckLocalGenerators()
     {
     {
     manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager();
     manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager();
     this->LocalGenerators[i]->ConfigureFinalPass();
     this->LocalGenerators[i]->ConfigureFinalPass();
-    cmTargets & targets =
-      this->LocalGenerators[i]->GetMakefile()->GetTargets();
-    for (cmTargets::iterator l = targets.begin();
+    cmGeneratorTargetsType targets =
+      this->LocalGenerators[i]->GetMakefile()->GetGeneratorTargets();
+    for (cmGeneratorTargetsType::iterator l = targets.begin();
          l != targets.end(); l++)
          l != targets.end(); l++)
       {
       {
       const cmTarget::LinkLibraryVectorType& libs =
       const cmTarget::LinkLibraryVectorType& libs =
-        l->second.GetOriginalLinkLibraries();
+        l->second->Target->GetOriginalLinkLibraries();
       for(cmTarget::LinkLibraryVectorType::const_iterator lib = libs.begin();
       for(cmTarget::LinkLibraryVectorType::const_iterator lib = libs.begin();
           lib != libs.end(); ++lib)
           lib != libs.end(); ++lib)
         {
         {
@@ -1151,14 +1174,14 @@ void cmGlobalGenerator::CheckLocalGenerators()
             }
             }
           std::string text = notFoundMap[varName];
           std::string text = notFoundMap[varName];
           text += "\n    linked by target \"";
           text += "\n    linked by target \"";
-          text += l->second.GetName();
+          text += l->second->GetName();
           text += "\" in directory ";
           text += "\" in directory ";
           text+=this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory();
           text+=this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory();
           notFoundMap[varName] = text;
           notFoundMap[varName] = text;
           }
           }
         }
         }
       std::vector<std::string> incs;
       std::vector<std::string> incs;
-      this->LocalGenerators[i]->GetIncludeDirectories(incs, &l->second);
+      this->LocalGenerators[i]->GetIncludeDirectories(incs, l->second);
 
 
       for( std::vector<std::string>::const_iterator incDir = incs.begin();
       for( std::vector<std::string>::const_iterator incDir = incs.begin();
             incDir != incs.end(); ++incDir)
             incDir != incs.end(); ++incDir)

+ 2 - 2
Source/cmGlobalGenerator.h

@@ -18,6 +18,7 @@
 #include "cmTarget.h" // For cmTargets
 #include "cmTarget.h" // For cmTargets
 #include "cmTargetDepend.h" // For cmTargetDependSet
 #include "cmTargetDepend.h" // For cmTargetDependSet
 #include "cmSystemTools.h" // for cmSystemTools::OutputOption
 #include "cmSystemTools.h" // for cmSystemTools::OutputOption
+#include "cmGeneratorTarget.h"
 class cmake;
 class cmake;
 class cmGeneratorTarget;
 class cmGeneratorTarget;
 class cmMakefile;
 class cmMakefile;
@@ -383,8 +384,7 @@ private:
   TargetDependMap TargetDependencies;
   TargetDependMap TargetDependencies;
 
 
   // Per-target generator information.
   // Per-target generator information.
-  typedef std::map<cmTarget*, cmGeneratorTarget*> GeneratorTargetsType;
-  GeneratorTargetsType GeneratorTargets;
+  cmGeneratorTargetsType GeneratorTargets;
   void CreateGeneratorTargets();
   void CreateGeneratorTargets();
   void ClearGeneratorTargets();
   void ClearGeneratorTargets();
   virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
   virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;

+ 8 - 3
Source/cmGlobalXCodeGenerator.cxx

@@ -1713,7 +1713,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
 
 
   // Set target-specific architectures.
   // Set target-specific architectures.
   std::vector<std::string> archs;
   std::vector<std::string> archs;
-  target.GetAppleArchs(configName, archs);
+  {
+  cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
+  gtgt->GetAppleArchs(configName, archs);
+  }
   if(!archs.empty())
   if(!archs.empty())
     {
     {
     // Enable ARCHS attribute.
     // Enable ARCHS attribute.
@@ -1950,7 +1953,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
   BuildObjectListOrString dirs(this, this->XcodeVersion >= 30);
   BuildObjectListOrString dirs(this, this->XcodeVersion >= 30);
   BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30);
   BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30);
   std::vector<std::string> includes;
   std::vector<std::string> includes;
-  this->CurrentLocalGenerator->GetIncludeDirectories(includes, &target);
+  cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
+  this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt);
   std::set<cmStdString> emitted;
   std::set<cmStdString> emitted;
   emitted.insert("/System/Library/Frameworks");
   emitted.insert("/System/Library/Frameworks");
   for(std::vector<std::string>::iterator i = includes.begin();
   for(std::vector<std::string>::iterator i = includes.begin();
@@ -2625,7 +2629,8 @@ void cmGlobalXCodeGenerator
       }
       }
 
 
     // Compute the link library and directory information.
     // Compute the link library and directory information.
-    cmComputeLinkInformation* pcli = cmtarget->GetLinkInformation(configName);
+    cmGeneratorTarget* gtgt = this->GetGeneratorTarget(cmtarget);
+    cmComputeLinkInformation* pcli = gtgt->GetLinkInformation(configName);
     if(!pcli)
     if(!pcli)
       {
       {
       continue;
       continue;

+ 26 - 4
Source/cmInstallTargetGenerator.cxx

@@ -16,6 +16,7 @@
 #include "cmLocalGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmMakefile.h"
 #include "cmake.h"
 #include "cmake.h"
+#include "cmGeneratorTarget.h"
 
 
 #include <assert.h>
 #include <assert.h>
 
 
@@ -26,7 +27,8 @@ cmInstallTargetGenerator
                            std::vector<std::string> const& configurations,
                            std::vector<std::string> const& configurations,
                            const char* component, bool optional):
                            const char* component, bool optional):
   cmInstallGenerator(dest, configurations, component), Target(&t),
   cmInstallGenerator(dest, configurations, component), Target(&t),
-  ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional)
+  ImportLibrary(implib), FilePermissions(file_permissions),
+  Optional(optional), GeneratorTarget(0)
 {
 {
   this->ActionsPerConfig = true;
   this->ActionsPerConfig = true;
   this->NamelinkMode = NamelinkModeNone;
   this->NamelinkMode = NamelinkModeNone;
@@ -484,6 +486,17 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os,
   this->AddStripRule(os, indent, file);
   this->AddStripRule(os, indent, file);
 }
 }
 
 
+void cmInstallTargetGenerator::CreateGeneratorTarget()
+{
+  if (!this->GeneratorTarget)
+    {
+    this->GeneratorTarget = this->Target->GetMakefile()
+                                        ->GetLocalGenerator()
+                                        ->GetGlobalGenerator()
+                                        ->GetGeneratorTarget(this->Target);
+    }
+}
+
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 void
 void
 cmInstallTargetGenerator
 cmInstallTargetGenerator
@@ -507,10 +520,13 @@ cmInstallTargetGenerator
     return;
     return;
     }
     }
 
 
+  this->CreateGeneratorTarget();
+
   // Build a map of build-tree install_name to install-tree install_name for
   // Build a map of build-tree install_name to install-tree install_name for
   // shared libraries linked to this target.
   // shared libraries linked to this target.
   std::map<cmStdString, cmStdString> install_name_remap;
   std::map<cmStdString, cmStdString> install_name_remap;
-  if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config))
+  if(cmComputeLinkInformation* cli =
+                            this->GeneratorTarget->GetLinkInformation(config))
     {
     {
     std::set<cmTarget*> const& sharedLibs = cli->GetSharedLibrariesLinked();
     std::set<cmTarget*> const& sharedLibs = cli->GetSharedLibrariesLinked();
     for(std::set<cmTarget*>::const_iterator j = sharedLibs.begin();
     for(std::set<cmTarget*>::const_iterator j = sharedLibs.begin();
@@ -608,9 +624,12 @@ cmInstallTargetGenerator
     return;
     return;
     }
     }
 
 
+  this->CreateGeneratorTarget();
+
   // Get the link information for this target.
   // Get the link information for this target.
   // It can provide the RPATH.
   // It can provide the RPATH.
-  cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config);
+  cmComputeLinkInformation* cli =
+                            this->GeneratorTarget->GetLinkInformation(config);
   if(!cli)
   if(!cli)
     {
     {
     return;
     return;
@@ -639,9 +658,12 @@ cmInstallTargetGenerator
     return;
     return;
     }
     }
 
 
+  this->CreateGeneratorTarget();
+
   // Get the link information for this target.
   // Get the link information for this target.
   // It can provide the RPATH.
   // It can provide the RPATH.
-  cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config);
+  cmComputeLinkInformation* cli =
+                            this->GeneratorTarget->GetLinkInformation(config);
   if(!cli)
   if(!cli)
     {
     {
     return;
     return;

+ 5 - 0
Source/cmInstallTargetGenerator.h

@@ -15,6 +15,8 @@
 #include "cmInstallGenerator.h"
 #include "cmInstallGenerator.h"
 #include "cmTarget.h"
 #include "cmTarget.h"
 
 
+class cmGeneratorTarget;
+
 /** \class cmInstallTargetGenerator
 /** \class cmInstallTargetGenerator
  * \brief Generate target installation rules.
  * \brief Generate target installation rules.
  */
  */
@@ -92,11 +94,14 @@ protected:
   void AddRanlibRule(std::ostream& os, Indent const& indent,
   void AddRanlibRule(std::ostream& os, Indent const& indent,
                      const std::string& toDestDirPath);
                      const std::string& toDestDirPath);
 
 
+  void CreateGeneratorTarget();
+
   cmTarget* Target;
   cmTarget* Target;
   bool ImportLibrary;
   bool ImportLibrary;
   std::string FilePermissions;
   std::string FilePermissions;
   bool Optional;
   bool Optional;
   NamelinkModeType NamelinkMode;
   NamelinkModeType NamelinkMode;
+  cmGeneratorTarget* GeneratorTarget;
 };
 };
 
 
 #endif
 #endif

+ 32 - 31
Source/cmLocalGenerator.cxx

@@ -554,9 +554,9 @@ void cmLocalGenerator::GenerateTargetManifest()
 }
 }
 
 
 void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
 void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
-                                                      const char* lang,
-                                                      cmSourceFile& source,
-                                                      cmTarget& target)
+                                                    const char* lang,
+                                                    cmSourceFile& source,
+                                                    cmGeneratorTarget& target)
 {
 {
   std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname));
   std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname));
   objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL);
   objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL);
@@ -635,7 +635,8 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
     );
     );
 }
 }
 
 
-void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
+void cmLocalGenerator::AddBuildTargetRule(const char* llang,
+                                          cmGeneratorTarget& target)
 {
 {
   cmStdString objs;
   cmStdString objs;
   std::vector<std::string> objVector;
   std::vector<std::string> objVector;
@@ -669,7 +670,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
   std::string createRule = "CMAKE_";
   std::string createRule = "CMAKE_";
   createRule += llang;
   createRule += llang;
   createRule += target.GetCreateRuleVariable();
   createRule += target.GetCreateRuleVariable();
-  std::string targetName = target.GetFullName();
+  std::string targetName = target.Target->GetFullName();
   // Executable :
   // Executable :
   // Shared Library:
   // Shared Library:
   // Static Library:
   // Static Library:
@@ -677,7 +678,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
   std::string linkLibs; // should be set
   std::string linkLibs; // should be set
   std::string flags; // should be set
   std::string flags; // should be set
   std::string linkFlags; // should be set
   std::string linkFlags; // should be set
-  this->GetTargetFlags(linkLibs, flags, linkFlags, target);
+  this->GetTargetFlags(linkLibs, flags, linkFlags, &target);
   cmLocalGenerator::RuleVariables vars;
   cmLocalGenerator::RuleVariables vars;
   vars.Language = llang;
   vars.Language = llang;
   vars.Objects = objs.c_str();
   vars.Objects = objs.c_str();
@@ -714,7 +715,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
     // Store this command line.
     // Store this command line.
     commandLines.push_back(commandLine);
     commandLines.push_back(commandLine);
     }
     }
-  std::string targetFullPath = target.GetFullPath();
+  std::string targetFullPath = target.Target->GetFullPath();
   // Generate a meaningful comment for the command.
   // Generate a meaningful comment for the command.
   std::string comment = "Linking ";
   std::string comment = "Linking ";
   comment += llang;
   comment += llang;
@@ -728,7 +729,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
     comment.c_str(),
     comment.c_str(),
     this->Makefile->GetStartOutputDirectory()
     this->Makefile->GetStartOutputDirectory()
     );
     );
-  target.AddSourceFile
+  target.Target->AddSourceFile
     (this->Makefile->GetSource(targetFullPath.c_str()));
     (this->Makefile->GetSource(targetFullPath.c_str()));
 }
 }
 
 
@@ -736,11 +737,11 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
 void cmLocalGenerator
 void cmLocalGenerator
 ::CreateCustomTargetsAndCommands(std::set<cmStdString> const& lang)
 ::CreateCustomTargetsAndCommands(std::set<cmStdString> const& lang)
 {
 {
-  cmTargets &tgts = this->Makefile->GetTargets();
-  for(cmTargets::iterator l = tgts.begin();
+  cmGeneratorTargetsType tgts = this->Makefile->GetGeneratorTargets();
+  for(cmGeneratorTargetsType::iterator l = tgts.begin();
       l != tgts.end(); l++)
       l != tgts.end(); l++)
     {
     {
-    cmTarget& target = l->second;
+    cmGeneratorTarget& target = *l->second;
     switch(target.GetType())
     switch(target.GetType())
       {
       {
       case cmTarget::STATIC_LIBRARY:
       case cmTarget::STATIC_LIBRARY:
@@ -748,12 +749,12 @@ void cmLocalGenerator
       case cmTarget::MODULE_LIBRARY:
       case cmTarget::MODULE_LIBRARY:
       case cmTarget::EXECUTABLE:
       case cmTarget::EXECUTABLE:
         {
         {
-        const char* llang = target.GetLinkerLanguage();
+        const char* llang = target.Target->GetLinkerLanguage();
         if(!llang)
         if(!llang)
           {
           {
           cmSystemTools::Error
           cmSystemTools::Error
             ("CMake can not determine linker language for target:",
             ("CMake can not determine linker language for target:",
-             target.GetName());
+             target.Target->GetName());
           return;
           return;
           }
           }
         // if the language is not in the set lang then create custom
         // if the language is not in the set lang then create custom
@@ -1318,7 +1319,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
 void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
-                                             cmTarget* target,
+                                             cmGeneratorTarget* target,
                                              const char* lang)
                                              const char* lang)
 {
 {
   // Need to decide whether to automatically include the source and
   // Need to decide whether to automatically include the source and
@@ -1449,7 +1450,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
 void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
 void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
                                  std::string& flags,
                                  std::string& flags,
                                  std::string& linkFlags,
                                  std::string& linkFlags,
-                                 cmTarget& target)
+                                 cmGeneratorTarget* target)
 {
 {
   std::string buildType =
   std::string buildType =
     this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
     this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
@@ -1457,12 +1458,12 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
   const char* libraryLinkVariable =
   const char* libraryLinkVariable =
     "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
     "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
 
 
-  switch(target.GetType())
+  switch(target->GetType())
     {
     {
     case cmTarget::STATIC_LIBRARY:
     case cmTarget::STATIC_LIBRARY:
       {
       {
       const char* targetLinkFlags =
       const char* targetLinkFlags =
-        target.GetProperty("STATIC_LIBRARY_FLAGS");
+        target->GetProperty("STATIC_LIBRARY_FLAGS");
       if(targetLinkFlags)
       if(targetLinkFlags)
         {
         {
         linkFlags += targetLinkFlags;
         linkFlags += targetLinkFlags;
@@ -1472,7 +1473,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
         {
         {
         std::string build = "STATIC_LIBRARY_FLAGS_";
         std::string build = "STATIC_LIBRARY_FLAGS_";
         build += buildType;
         build += buildType;
-        targetLinkFlags = target.GetProperty(build.c_str());
+        targetLinkFlags = target->GetProperty(build.c_str());
         if(targetLinkFlags)
         if(targetLinkFlags)
           {
           {
           linkFlags += targetLinkFlags;
           linkFlags += targetLinkFlags;
@@ -1498,7 +1499,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
       if(this->Makefile->IsOn("WIN32") &&
       if(this->Makefile->IsOn("WIN32") &&
          !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW")))
          !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW")))
         {
         {
-        const std::vector<cmSourceFile*>& sources = target.GetSourceFiles();
+        const std::vector<cmSourceFile*>& sources = target->GetSourceFiles();
         for(std::vector<cmSourceFile*>::const_iterator i = sources.begin();
         for(std::vector<cmSourceFile*>::const_iterator i = sources.begin();
             i != sources.end(); ++i)
             i != sources.end(); ++i)
           {
           {
@@ -1513,7 +1514,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
             }
             }
           }
           }
         }
         }
-      const char* targetLinkFlags = target.GetProperty("LINK_FLAGS");
+      const char* targetLinkFlags = target->GetProperty("LINK_FLAGS");
       if(targetLinkFlags)
       if(targetLinkFlags)
         {
         {
         linkFlags += targetLinkFlags;
         linkFlags += targetLinkFlags;
@@ -1523,7 +1524,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
         {
         {
         std::string configLinkFlags = "LINK_FLAGS_";
         std::string configLinkFlags = "LINK_FLAGS_";
         configLinkFlags += buildType;
         configLinkFlags += buildType;
-        targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
+        targetLinkFlags = target->GetProperty(configLinkFlags.c_str());
         if(targetLinkFlags)
         if(targetLinkFlags)
           {
           {
           linkFlags += targetLinkFlags;
           linkFlags += targetLinkFlags;
@@ -1531,7 +1532,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
           }
           }
         }
         }
       cmOStringStream linklibsStr;
       cmOStringStream linklibsStr;
-      this->OutputLinkLibraries(linklibsStr, target, false);
+      this->OutputLinkLibraries(linklibsStr, *target, false);
       linkLibs = linklibsStr.str();
       linkLibs = linklibsStr.str();
       }
       }
       break;
       break;
@@ -1547,17 +1548,17 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
         linkFlags += this->Makefile->GetSafeDefinition(build.c_str());
         linkFlags += this->Makefile->GetSafeDefinition(build.c_str());
         linkFlags += " ";
         linkFlags += " ";
         }
         }
-      const char* linkLanguage = target.GetLinkerLanguage();
+      const char* linkLanguage = target->Target->GetLinkerLanguage();
       if(!linkLanguage)
       if(!linkLanguage)
         {
         {
         cmSystemTools::Error
         cmSystemTools::Error
           ("CMake can not determine linker language for target:",
           ("CMake can not determine linker language for target:",
-           target.GetName());
+           target->Target->GetName());
         return;
         return;
         }
         }
       this->AddLanguageFlags(flags, linkLanguage, buildType.c_str());
       this->AddLanguageFlags(flags, linkLanguage, buildType.c_str());
       cmOStringStream linklibs;
       cmOStringStream linklibs;
-      this->OutputLinkLibraries(linklibs, target, false);
+      this->OutputLinkLibraries(linklibs, *target, false);
       linkLibs = linklibs.str();
       linkLibs = linklibs.str();
       if(cmSystemTools::IsOn
       if(cmSystemTools::IsOn
          (this->Makefile->GetDefinition("BUILD_SHARED_LIBS")))
          (this->Makefile->GetDefinition("BUILD_SHARED_LIBS")))
@@ -1567,7 +1568,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
         linkFlags += this->Makefile->GetSafeDefinition(sFlagVar.c_str());
         linkFlags += this->Makefile->GetSafeDefinition(sFlagVar.c_str());
         linkFlags += " ";
         linkFlags += " ";
         }
         }
-      if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") )
+      if ( target->GetPropertyAsBool("WIN32_EXECUTABLE") )
         {
         {
         linkFlags +=
         linkFlags +=
           this->Makefile->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE");
           this->Makefile->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE");
@@ -1579,7 +1580,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
           this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE");
           this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE");
         linkFlags += " ";
         linkFlags += " ";
         }
         }
-      if (target.IsExecutableWithExports())
+      if (target->Target->IsExecutableWithExports())
         {
         {
         std::string exportFlagVar = "CMAKE_EXE_EXPORTS_";
         std::string exportFlagVar = "CMAKE_EXE_EXPORTS_";
         exportFlagVar += linkLanguage;
         exportFlagVar += linkLanguage;
@@ -1589,7 +1590,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
           this->Makefile->GetSafeDefinition(exportFlagVar.c_str());
           this->Makefile->GetSafeDefinition(exportFlagVar.c_str());
         linkFlags += " ";
         linkFlags += " ";
         }
         }
-      const char* targetLinkFlags = target.GetProperty("LINK_FLAGS");
+      const char* targetLinkFlags = target->GetProperty("LINK_FLAGS");
       if(targetLinkFlags)
       if(targetLinkFlags)
         {
         {
         linkFlags += targetLinkFlags;
         linkFlags += targetLinkFlags;
@@ -1599,7 +1600,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
         {
         {
         std::string configLinkFlags = "LINK_FLAGS_";
         std::string configLinkFlags = "LINK_FLAGS_";
         configLinkFlags += buildType;
         configLinkFlags += buildType;
-        targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
+        targetLinkFlags = target->GetProperty(configLinkFlags.c_str());
         if(targetLinkFlags)
         if(targetLinkFlags)
           {
           {
           linkFlags += targetLinkFlags;
           linkFlags += targetLinkFlags;
@@ -1651,7 +1652,7 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib)
  * to the name of the library.  This will not link a library against itself.
  * to the name of the library.  This will not link a library against itself.
  */
  */
 void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
 void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
-                                           cmTarget& tgt,
+                                           cmGeneratorTarget& tgt,
                                            bool relink)
                                            bool relink)
 {
 {
   const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
   const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
@@ -1778,7 +1779,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
 void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
-                                            cmTarget* target,
+                                            cmGeneratorTarget* target,
                                             const char *lang,
                                             const char *lang,
                                             const char* config)
                                             const char* config)
 {
 {

+ 8 - 6
Source/cmLocalGenerator.h

@@ -16,6 +16,7 @@
 
 
 class cmMakefile;
 class cmMakefile;
 class cmGlobalGenerator;
 class cmGlobalGenerator;
+class cmGeneratorTarget;
 class cmTarget;
 class cmTarget;
 class cmTargetManifest;
 class cmTargetManifest;
 class cmSourceFile;
 class cmSourceFile;
@@ -135,7 +136,7 @@ public:
   std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; };
   std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; };
 
 
 
 
-  void AddArchitectureFlags(std::string& flags, cmTarget* target,
+  void AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target,
                             const char *lang, const char* config);
                             const char *lang, const char* config);
 
 
   void AddLanguageFlags(std::string& flags, const char* lang,
   void AddLanguageFlags(std::string& flags, const char* lang,
@@ -205,7 +206,7 @@ public:
 
 
   /** Get the include flags for the current makefile and language.  */
   /** Get the include flags for the current makefile and language.  */
   void GetIncludeDirectories(std::vector<std::string>& dirs,
   void GetIncludeDirectories(std::vector<std::string>& dirs,
-                             cmTarget* target,
+                             cmGeneratorTarget* target,
                              const char* lang = "C");
                              const char* lang = "C");
 
 
   /** Compute the language used to compile the given source file.  */
   /** Compute the language used to compile the given source file.  */
@@ -334,11 +335,12 @@ public:
   void GetTargetFlags(std::string& linkLibs,
   void GetTargetFlags(std::string& linkLibs,
                       std::string& flags,
                       std::string& flags,
                       std::string& linkFlags,
                       std::string& linkFlags,
-                      cmTarget&target);
+                      cmGeneratorTarget* target);
 
 
 protected:
 protected:
   ///! put all the libraries for a target on into the given stream
   ///! put all the libraries for a target on into the given stream
-  virtual void OutputLinkLibraries(std::ostream&, cmTarget&, bool relink);
+  virtual void OutputLinkLibraries(std::ostream&, cmGeneratorTarget&,
+                                   bool relink);
 
 
   // Expand rule variables in CMake of the type found in language rules
   // Expand rule variables in CMake of the type found in language rules
   void ExpandRuleVariables(std::string& string,
   void ExpandRuleVariables(std::string& string,
@@ -354,12 +356,12 @@ protected:
 
 
   /** Convert a target to a utility target for unsupported
   /** Convert a target to a utility target for unsupported
    *  languages of a generator */
    *  languages of a generator */
-  void AddBuildTargetRule(const char* llang, cmTarget& target);
+  void AddBuildTargetRule(const char* llang, cmGeneratorTarget& target);
   ///! add a custom command to build a .o file that is part of a target
   ///! add a custom command to build a .o file that is part of a target
   void AddCustomCommandToCreateObject(const char* ofname,
   void AddCustomCommandToCreateObject(const char* ofname,
                                       const char* lang,
                                       const char* lang,
                                       cmSourceFile& source,
                                       cmSourceFile& source,
-                                      cmTarget& target);
+                                      cmGeneratorTarget& target);
   // Create Custom Targets and commands for unsupported languages
   // Create Custom Targets and commands for unsupported languages
   // The set passed in should contain the languages supported by the
   // The set passed in should contain the languages supported by the
   // generator directly.  Any targets containing files that are not
   // generator directly.  Any targets containing files that are not

+ 15 - 22
Source/cmLocalVisualStudio6Generator.cxx

@@ -862,10 +862,13 @@ cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target)
   // the length threatens this problem.
   // the length threatens this problem.
   unsigned int maxIncludeLength = 3000;
   unsigned int maxIncludeLength = 3000;
   bool useShortPath = false;
   bool useShortPath = false;
+
+  cmGeneratorTarget* gt =
+    this->GlobalGenerator->GetGeneratorTarget(&target);
   for(int j=0; j < 2; ++j)
   for(int j=0; j < 2; ++j)
     {
     {
     std::vector<std::string> includes;
     std::vector<std::string> includes;
-    this->GetIncludeDirectories(includes, &target);
+    this->GetIncludeDirectories(includes, gt);
 
 
     std::vector<std::string>::iterator i;
     std::vector<std::string>::iterator i;
     for(i = includes.begin(); i != includes.end(); ++i)
     for(i = includes.begin(); i != includes.end(); ++i)
@@ -1676,37 +1679,25 @@ void cmLocalVisualStudio6Generator
     std::set<std::string> minsizeDefinesSet;
     std::set<std::string> minsizeDefinesSet;
     std::set<std::string> debugrelDefinesSet;
     std::set<std::string> debugrelDefinesSet;
 
 
-    this->AppendDefines(
-      definesSet,
-      this->Makefile->GetProperty("COMPILE_DEFINITIONS"));
-    this->AppendDefines(
-      debugDefinesSet,
-      this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG"));
-    this->AppendDefines(
-      releaseDefinesSet,
-      this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE"));
-    this->AppendDefines(
-      minsizeDefinesSet,
-      this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"));
-    this->AppendDefines(
-      debugrelDefinesSet,
-      this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"));
+
+    cmGeneratorTarget* gt =
+      this->GlobalGenerator->GetGeneratorTarget(&target);
 
 
     this->AppendDefines(
     this->AppendDefines(
       definesSet,
       definesSet,
-      target.GetProperty("COMPILE_DEFINITIONS"));
+      gt->GetCompileDefinitions());
     this->AppendDefines(
     this->AppendDefines(
       debugDefinesSet,
       debugDefinesSet,
-      target.GetProperty("COMPILE_DEFINITIONS_DEBUG"));
+      gt->GetCompileDefinitions("DEBUG"));
     this->AppendDefines(
     this->AppendDefines(
       releaseDefinesSet,
       releaseDefinesSet,
-      target.GetProperty("COMPILE_DEFINITIONS_RELEASE"));
+      gt->GetCompileDefinitions("RELEASE"));
     this->AppendDefines(
     this->AppendDefines(
       minsizeDefinesSet,
       minsizeDefinesSet,
-      target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"));
+      gt->GetCompileDefinitions("MINSIZEREL"));
     this->AppendDefines(
     this->AppendDefines(
       debugrelDefinesSet,
       debugrelDefinesSet,
-      target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"));
+      gt->GetCompileDefinitions("RELWITHDEBINFO"));
 
 
     std::string defines = " ";
     std::string defines = " ";
     std::string debugDefines = " ";
     std::string debugDefines = " ";
@@ -1776,8 +1767,10 @@ void cmLocalVisualStudio6Generator
                      const std::string extraOptions,
                      const std::string extraOptions,
                      std::string& options)
                      std::string& options)
 {
 {
+  cmGeneratorTarget* gt =
+    this->GlobalGenerator->GetGeneratorTarget(&target);
   // Compute the link information for this configuration.
   // Compute the link information for this configuration.
-  cmComputeLinkInformation* pcli = target.GetLinkInformation(configName);
+  cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName);
   if(!pcli)
   if(!pcli)
     {
     {
     return;
     return;

+ 9 - 3
Source/cmLocalVisualStudio7Generator.cxx

@@ -819,7 +819,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
   targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
   targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
   fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
   fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
   std::vector<std::string> includes;
   std::vector<std::string> includes;
-  this->GetIncludeDirectories(includes, &target);
+  cmGeneratorTarget* gt =
+    this->GlobalGenerator->GetGeneratorTarget(&target);
+  this->GetIncludeDirectories(includes, gt);
   std::vector<std::string>::iterator i = includes.begin();
   std::vector<std::string>::iterator i = includes.begin();
   for(;i != includes.end(); ++i)
   for(;i != includes.end(); ++i)
     {
     {
@@ -1079,7 +1081,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
                            targetNameImport, targetNamePDB, configName);
                            targetNameImport, targetNamePDB, configName);
 
 
     // Compute the link library and directory information.
     // Compute the link library and directory information.
-    cmComputeLinkInformation* pcli = target.GetLinkInformation(configName);
+    cmGeneratorTarget* gt =
+      this->GlobalGenerator->GetGeneratorTarget(&target);
+    cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName);
     if(!pcli)
     if(!pcli)
       {
       {
       return;
       return;
@@ -1164,7 +1168,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
                               targetNameImport, targetNamePDB, configName);
                               targetNameImport, targetNamePDB, configName);
 
 
     // Compute the link library and directory information.
     // Compute the link library and directory information.
-    cmComputeLinkInformation* pcli = target.GetLinkInformation(configName);
+    cmGeneratorTarget* gt =
+      this->GlobalGenerator->GetGeneratorTarget(&target);
+    cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName);
     if(!pcli)
     if(!pcli)
       {
       {
       return;
       return;

+ 4 - 3
Source/cmMakeDepend.cxx

@@ -58,11 +58,12 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile)
   // Now extract any include paths from the targets
   // Now extract any include paths from the targets
   std::set<std::string> uniqueIncludes;
   std::set<std::string> uniqueIncludes;
   std::vector<std::string> orderedAndUniqueIncludes;
   std::vector<std::string> orderedAndUniqueIncludes;
-  cmTargets & targets = this->Makefile->GetTargets();
-  for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l)
+  cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
+  for (cmGeneratorTargetsType::iterator l = targets.begin();
+       l != targets.end(); ++l)
     {
     {
     const std::vector<std::string>& includes =
     const std::vector<std::string>& includes =
-      l->second.GetIncludeDirectories();
+      l->second->GetIncludeDirectories();
     for(std::vector<std::string>::const_iterator j = includes.begin();
     for(std::vector<std::string>::const_iterator j = includes.begin();
         j != includes.end(); ++j)
         j != includes.end(); ++j)
       {
       {

+ 6 - 0
Source/cmMakefile.cxx

@@ -3984,6 +3984,12 @@ cmTarget* cmMakefile::FindTargetToUse(const char* name)
   return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, name);
   return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, name);
 }
 }
 
 
+cmGeneratorTarget* cmMakefile::FindGeneratorTargetToUse(const char* name)
+{
+  cmTarget *t = this->FindTargetToUse(name);
+  return this->LocalGenerator->GetGlobalGenerator()->GetGeneratorTarget(t);
+}
+
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
 bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
                                    bool isCustom)
                                    bool isCustom)

+ 13 - 0
Source/cmMakefile.h

@@ -20,6 +20,7 @@
 #include "cmSystemTools.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmTarget.h"
 #include "cmNewLineStyle.h"
 #include "cmNewLineStyle.h"
+#include "cmGeneratorTarget.h"
 #include "cmake.h"
 #include "cmake.h"
 
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -519,11 +520,22 @@ public:
    */
    */
   const cmTargets &GetTargets() const { return this->Targets; }
   const cmTargets &GetTargets() const { return this->Targets; }
 
 
+  const cmGeneratorTargetsType &GetGeneratorTargets() const
+    {
+      return this->GeneratorTargets;
+    }
+
+  void SetGeneratorTargets(const cmGeneratorTargetsType &targets)
+    {
+      this->GeneratorTargets = targets;
+    }
+
   cmTarget* FindTarget(const char* name);
   cmTarget* FindTarget(const char* name);
 
 
   /** Find a target to use in place of the given name.  The target
   /** Find a target to use in place of the given name.  The target
       returned may be imported or built within the project.  */
       returned may be imported or built within the project.  */
   cmTarget* FindTargetToUse(const char* name);
   cmTarget* FindTargetToUse(const char* name);
+  cmGeneratorTarget* FindGeneratorTargetToUse(const char* name);
 
 
   /**
   /**
    * Mark include directories as system directories.
    * Mark include directories as system directories.
@@ -865,6 +877,7 @@ protected:
 
 
   // libraries, classes, and executables
   // libraries, classes, and executables
   cmTargets Targets;
   cmTargets Targets;
+  cmGeneratorTargetsType GeneratorTargets;
   std::vector<cmSourceFile*> SourceFiles;
   std::vector<cmSourceFile*> SourceFiles;
 
 
   // Tests
   // Tests

+ 3 - 2
Source/cmMakefileExecutableTargetGenerator.cxx

@@ -210,7 +210,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
   // Add language feature flags.
   // Add language feature flags.
   this->AddFeatureFlags(flags, linkLanguage);
   this->AddFeatureFlags(flags, linkLanguage);
 
 
-  this->LocalGenerator->AddArchitectureFlags(flags, this->Target,
+  this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
                                              linkLanguage, this->ConfigName);
                                              linkLanguage, this->ConfigName);
 
 
   // Add target-specific linker flags.
   // Add target-specific linker flags.
@@ -319,7 +319,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
 
 
   // Collect up flags to link in needed libraries.
   // Collect up flags to link in needed libraries.
   cmOStringStream linklibs;
   cmOStringStream linklibs;
-  this->LocalGenerator->OutputLinkLibraries(linklibs, *this->Target, relink);
+  this->LocalGenerator->OutputLinkLibraries(linklibs, *this->GeneratorTarget,
+                                            relink);
 
 
   // Construct object file lists that may be needed to expand the
   // Construct object file lists that may be needed to expand the
   // rule.
   // rule.

+ 2 - 2
Source/cmMakefileLibraryTargetGenerator.cxx

@@ -546,7 +546,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
   if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
   if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
     {
     {
     this->LocalGenerator
     this->LocalGenerator
-      ->OutputLinkLibraries(linklibs, *this->Target, relink);
+      ->OutputLinkLibraries(linklibs, *this->GeneratorTarget, relink);
     }
     }
 
 
   // Construct object file lists that may be needed to expand the
   // Construct object file lists that may be needed to expand the
@@ -625,7 +625,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
   std::string langFlags;
   std::string langFlags;
   this->AddFeatureFlags(langFlags, linkLanguage);
   this->AddFeatureFlags(langFlags, linkLanguage);
 
 
-  this->LocalGenerator->AddArchitectureFlags(langFlags, this->Target,
+  this->LocalGenerator->AddArchitectureFlags(langFlags, this->GeneratorTarget,
                                              linkLanguage, this->ConfigName);
                                              linkLanguage, this->ConfigName);
 
 
   // remove any language flags that might not work with the
   // remove any language flags that might not work with the

+ 17 - 16
Source/cmMakefileTargetGenerator.cxx

@@ -259,7 +259,7 @@ std::string cmMakefileTargetGenerator::GetFlags(const std::string &l)
     // Add language feature flags.
     // Add language feature flags.
     this->AddFeatureFlags(flags, lang);
     this->AddFeatureFlags(flags, lang);
 
 
-    this->LocalGenerator->AddArchitectureFlags(flags, this->Target,
+    this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
                                                lang, this->ConfigName);
                                                lang, this->ConfigName);
 
 
     // Fortran-specific flags computed for this target.
     // Fortran-specific flags computed for this target.
@@ -302,16 +302,11 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l)
 
 
     // Add preprocessor definitions for this target and configuration.
     // Add preprocessor definitions for this target and configuration.
     this->LocalGenerator->AppendDefines
     this->LocalGenerator->AppendDefines
-      (defines, this->Makefile->GetProperty("COMPILE_DEFINITIONS"));
-    this->LocalGenerator->AppendDefines
-      (defines, this->Target->GetProperty("COMPILE_DEFINITIONS"));
-    std::string defPropName = "COMPILE_DEFINITIONS_";
-    defPropName +=
-      cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName);
-    this->LocalGenerator->AppendDefines
-      (defines, this->Makefile->GetProperty(defPropName.c_str()));
+      (defines, this->GeneratorTarget->GetCompileDefinitions());
+
     this->LocalGenerator->AppendDefines
     this->LocalGenerator->AppendDefines
-      (defines, this->Target->GetProperty(defPropName.c_str()));
+      (defines, this->GeneratorTarget->GetCompileDefinitions(
+                            this->LocalGenerator->ConfigurationName.c_str()));
 
 
     std::string definesString;
     std::string definesString;
     this->LocalGenerator->JoinDefines(defines, definesString, lang);
     this->LocalGenerator->JoinDefines(defines, definesString, lang);
@@ -1022,7 +1017,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
     << "SET(CMAKE_TARGET_LINKED_INFO_FILES\n";
     << "SET(CMAKE_TARGET_LINKED_INFO_FILES\n";
   std::set<cmTarget const*> emitted;
   std::set<cmTarget const*> emitted;
   const char* cfg = this->LocalGenerator->ConfigurationName.c_str();
   const char* cfg = this->LocalGenerator->ConfigurationName.c_str();
-  if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
+  if(cmComputeLinkInformation* cli =
+                              this->GeneratorTarget->GetLinkInformation(cfg))
     {
     {
     cmComputeLinkInformation::ItemVector const& items = cli->GetItems();
     cmComputeLinkInformation::ItemVector const& items = cli->GetItems();
     for(cmComputeLinkInformation::ItemVector::const_iterator
     for(cmComputeLinkInformation::ItemVector::const_iterator
@@ -1061,7 +1057,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
   *this->InfoFileStream
   *this->InfoFileStream
     << "SET(CMAKE_C_TARGET_INCLUDE_PATH\n";
     << "SET(CMAKE_C_TARGET_INCLUDE_PATH\n";
   std::vector<std::string> includes;
   std::vector<std::string> includes;
-  this->LocalGenerator->GetIncludeDirectories(includes, this->Target);
+  this->LocalGenerator->GetIncludeDirectories(includes,
+                                              this->GeneratorTarget);
   for(std::vector<std::string>::iterator i = includes.begin();
   for(std::vector<std::string>::iterator i = includes.begin();
       i != includes.end(); ++i)
       i != includes.end(); ++i)
     {
     {
@@ -1546,7 +1543,8 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags()
   emitted.insert("/System/Library/Frameworks");
   emitted.insert("/System/Library/Frameworks");
 #endif
 #endif
   std::vector<std::string> includes;
   std::vector<std::string> includes;
-  this->LocalGenerator->GetIncludeDirectories(includes, this->Target);
+  this->LocalGenerator->GetIncludeDirectories(includes,
+                                              this->GeneratorTarget);
   std::vector<std::string>::iterator i;
   std::vector<std::string>::iterator i;
   // check all include directories for frameworks as this
   // check all include directories for frameworks as this
   // will already have added a -F for the framework
   // will already have added a -F for the framework
@@ -1590,7 +1588,8 @@ void cmMakefileTargetGenerator
 
 
   // Loop over all library dependencies.
   // Loop over all library dependencies.
   const char* cfg = this->LocalGenerator->ConfigurationName.c_str();
   const char* cfg = this->LocalGenerator->ConfigurationName.c_str();
-  if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
+  if(cmComputeLinkInformation* cli =
+                              this->GeneratorTarget->GetLinkInformation(cfg))
     {
     {
     std::vector<std::string> const& libDeps = cli->GetDepends();
     std::vector<std::string> const& libDeps = cli->GetDepends();
     for(std::vector<std::string>::const_iterator j = libDeps.begin();
     for(std::vector<std::string>::const_iterator j = libDeps.begin();
@@ -1850,7 +1849,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
 
 
 
 
   std::vector<std::string> includes;
   std::vector<std::string> includes;
-  this->LocalGenerator->GetIncludeDirectories(includes, this->Target, lang);
+  this->LocalGenerator->GetIncludeDirectories(includes,
+                                              this->GeneratorTarget, lang);
 
 
   std::string includeFlags =
   std::string includeFlags =
     this->LocalGenerator->GetIncludeFlags(includes, lang, useResponseFile);
     this->LocalGenerator->GetIncludeFlags(includes, lang, useResponseFile);
@@ -1953,7 +1953,8 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags)
      this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG"))
      this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG"))
     {
     {
     std::vector<std::string> includes;
     std::vector<std::string> includes;
-    this->LocalGenerator->GetIncludeDirectories(includes, this->Target);
+    this->LocalGenerator->GetIncludeDirectories(includes,
+                                                this->GeneratorTarget);
     for(std::vector<std::string>::const_iterator idi = includes.begin();
     for(std::vector<std::string>::const_iterator idi = includes.begin();
         idi != includes.end(); ++idi)
         idi != includes.end(); ++idi)
       {
       {

+ 2 - 2
Source/cmNinjaNormalTargetGenerator.cxx

@@ -423,7 +423,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
   this->GetLocalGenerator()->GetTargetFlags(vars["LINK_LIBRARIES"],
   this->GetLocalGenerator()->GetTargetFlags(vars["LINK_LIBRARIES"],
                                             vars["FLAGS"],
                                             vars["FLAGS"],
                                             vars["LINK_FLAGS"],
                                             vars["LINK_FLAGS"],
-                                            *this->GetTarget());
+                                            this->GetGeneratorTarget());
 
 
   this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);
   this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);
 
 
@@ -434,7 +434,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
                                ? vars["FLAGS"]
                                ? vars["FLAGS"]
                                : vars["ARCH_FLAGS"]);
                                : vars["ARCH_FLAGS"]);
   this->GetLocalGenerator()->AddArchitectureFlags(flags,
   this->GetLocalGenerator()->AddArchitectureFlags(flags,
-                             this->GetTarget(),
+                             this->GetGeneratorTarget(),
                              this->TargetLinkLanguage,
                              this->TargetLinkLanguage,
                              this->GetConfigName());
                              this->GetConfigName());
   if (targetType == cmTarget::EXECUTABLE) {
   if (targetType == cmTarget::EXECUTABLE) {

+ 5 - 11
Source/cmNinjaTargetGenerator.cxx

@@ -134,7 +134,7 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source,
   this->AddFeatureFlags(flags, language.c_str());
   this->AddFeatureFlags(flags, language.c_str());
 
 
   this->GetLocalGenerator()->AddArchitectureFlags(flags,
   this->GetLocalGenerator()->AddArchitectureFlags(flags,
-                                                  this->GetTarget(),
+                                                  this->GeneratorTarget,
                                                   language.c_str(),
                                                   language.c_str(),
                                                   this->GetConfigName());
                                                   this->GetConfigName());
 
 
@@ -152,7 +152,7 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source,
   // Add include directory flags.
   // Add include directory flags.
   {
   {
   std::vector<std::string> includes;
   std::vector<std::string> includes;
-  this->LocalGenerator->GetIncludeDirectories(includes, this->Target,
+  this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget,
                                               language.c_str());
                                               language.c_str());
   std::string includeFlags =
   std::string includeFlags =
     this->LocalGenerator->GetIncludeFlags(includes, language.c_str(),
     this->LocalGenerator->GetIncludeFlags(includes, language.c_str(),
@@ -225,10 +225,7 @@ ComputeDefines(cmSourceFile *source, const std::string& language)
   // Add preprocessor definitions for this target and configuration.
   // Add preprocessor definitions for this target and configuration.
   this->LocalGenerator->AppendDefines
   this->LocalGenerator->AppendDefines
     (defines,
     (defines,
-     this->Makefile->GetProperty("COMPILE_DEFINITIONS"));
-  this->LocalGenerator->AppendDefines
-    (defines,
-     this->Target->GetProperty("COMPILE_DEFINITIONS"));
+     this->GeneratorTarget->GetCompileDefinitions());
   this->LocalGenerator->AppendDefines
   this->LocalGenerator->AppendDefines
     (defines,
     (defines,
      source->GetProperty("COMPILE_DEFINITIONS"));
      source->GetProperty("COMPILE_DEFINITIONS"));
@@ -237,10 +234,7 @@ ComputeDefines(cmSourceFile *source, const std::string& language)
   defPropName += cmSystemTools::UpperCase(this->GetConfigName());
   defPropName += cmSystemTools::UpperCase(this->GetConfigName());
   this->LocalGenerator->AppendDefines
   this->LocalGenerator->AppendDefines
     (defines,
     (defines,
-     this->Makefile->GetProperty(defPropName.c_str()));
-  this->LocalGenerator->AppendDefines
-    (defines,
-     this->Target->GetProperty(defPropName.c_str()));
+     this->GeneratorTarget->GetCompileDefinitions(this->GetConfigName()));
   this->LocalGenerator->AppendDefines
   this->LocalGenerator->AppendDefines
     (defines,
     (defines,
      source->GetProperty(defPropName.c_str()));
      source->GetProperty(defPropName.c_str()));
@@ -261,7 +255,7 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
     return cmNinjaDeps();
     return cmNinjaDeps();
 
 
   cmComputeLinkInformation* cli =
   cmComputeLinkInformation* cli =
-    this->Target->GetLinkInformation(this->GetConfigName());
+    this->GeneratorTarget->GetLinkInformation(this->GetConfigName());
   if(!cli)
   if(!cli)
     return cmNinjaDeps();
     return cmNinjaDeps();
 
 

+ 3 - 0
Source/cmNinjaTargetGenerator.h

@@ -52,6 +52,9 @@ protected:
   cmTarget* GetTarget() const
   cmTarget* GetTarget() const
   { return this->Target; }
   { return this->Target; }
 
 
+  cmGeneratorTarget* GetGeneratorTarget() const
+  { return this->GeneratorTarget; }
+
   cmLocalNinjaGenerator* GetLocalGenerator() const
   cmLocalNinjaGenerator* GetLocalGenerator() const
   { return this->LocalGenerator; }
   { return this->LocalGenerator; }
 
 

+ 0 - 114
Source/cmTarget.cxx

@@ -15,7 +15,6 @@
 #include "cmSourceFile.h"
 #include "cmSourceFile.h"
 #include "cmLocalGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmGlobalGenerator.h"
 #include "cmGlobalGenerator.h"
-#include "cmComputeLinkInformation.h"
 #include "cmDocumentCompileDefinitions.h"
 #include "cmDocumentCompileDefinitions.h"
 #include "cmDocumentLocationUndefined.h"
 #include "cmDocumentLocationUndefined.h"
 #include "cmListFileCache.h"
 #include "cmListFileCache.h"
@@ -2953,25 +2952,6 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc)
     }
     }
 }
 }
 
 
-//----------------------------------------------------------------------------
-const char* cmTarget::GetCreateRuleVariable()
-{
-  switch(this->GetType())
-    {
-    case cmTarget::STATIC_LIBRARY:
-      return "_CREATE_STATIC_LIBRARY";
-    case cmTarget::SHARED_LIBRARY:
-      return "_CREATE_SHARED_LIBRARY";
-    case cmTarget::MODULE_LIBRARY:
-      return "_CREATE_SHARED_MODULE";
-    case cmTarget::EXECUTABLE:
-      return "_LINK_EXECUTABLE";
-    default:
-      break;
-    }
-  return "";
-}
-
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 const char* cmTarget::GetSuffixVariableInternal(bool implib)
 const char* cmTarget::GetSuffixVariableInternal(bool implib)
 {
 {
@@ -3979,27 +3959,6 @@ void cmTarget::GetLanguages(std::set<cmStdString>& languages) const
     }
     }
 }
 }
 
 
-//----------------------------------------------------------------------------
-void cmTarget::GetAppleArchs(const char* config,
-                             std::vector<std::string>& archVec)
-{
-  const char* archs = 0;
-  if(config && *config)
-    {
-    std::string defVarName = "OSX_ARCHITECTURES_";
-    defVarName += cmSystemTools::UpperCase(config);
-    archs = this->GetProperty(defVarName.c_str());
-    }
-  if(!archs)
-    {
-    archs = this->GetProperty("OSX_ARCHITECTURES");
-    }
-  if(archs)
-    {
-    cmSystemTools::ExpandListArgument(std::string(archs), archVec);
-    }
-}
-
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 bool cmTarget::IsChrpathUsed(const char* config)
 bool cmTarget::IsChrpathUsed(const char* config)
 {
 {
@@ -4670,56 +4629,6 @@ std::string cmTarget::CheckCMP0004(std::string const& item)
   return lib;
   return lib;
 }
 }
 
 
-//----------------------------------------------------------------------------
-cmComputeLinkInformation*
-cmTarget::GetLinkInformation(const char* config)
-{
-  // Lookup any existing information for this configuration.
-  std::map<cmStdString, cmComputeLinkInformation*>::iterator
-    i = this->LinkInformation.find(config?config:"");
-  if(i == this->LinkInformation.end())
-    {
-    // Compute information for this configuration.
-    cmComputeLinkInformation* info =
-      new cmComputeLinkInformation(this, config);
-    if(!info || !info->Compute())
-      {
-      delete info;
-      info = 0;
-      }
-
-    // Store the information for this configuration.
-    std::map<cmStdString, cmComputeLinkInformation*>::value_type
-      entry(config?config:"", info);
-    i = this->LinkInformation.insert(entry).first;
-    }
-  return i->second;
-}
-
-//----------------------------------------------------------------------------
-std::vector<std::string> cmTarget::GetIncludeDirectories()
-{
-  std::vector<std::string> includes;
-  const char *prop = this->GetProperty("INCLUDE_DIRECTORIES");
-  if(prop)
-    {
-    cmSystemTools::ExpandListArgument(prop, includes);
-    }
-
-  std::set<std::string> uniqueIncludes;
-  std::vector<std::string> orderedAndUniqueIncludes;
-  for(std::vector<std::string>::const_iterator
-      li = includes.begin(); li != includes.end(); ++li)
-    {
-    if(uniqueIncludes.insert(*li).second)
-      {
-      orderedAndUniqueIncludes.push_back(*li);
-      }
-    }
-
-  return orderedAndUniqueIncludes;
-}
-
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 std::string cmTarget::GetFrameworkDirectory(const char* config)
 std::string cmTarget::GetFrameworkDirectory(const char* config)
 {
 {
@@ -4777,29 +4686,6 @@ std::string cmTarget::GetMacContentDirectory(const char* config,
   return fpath;
   return fpath;
 }
 }
 
 
-//----------------------------------------------------------------------------
-cmTargetLinkInformationMap
-::cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r): derived()
-{
-  // Ideally cmTarget instances should never be copied.  However until
-  // we can make a sweep to remove that, this copy constructor avoids
-  // allowing the resources (LinkInformation) from getting copied.  In
-  // the worst case this will lead to extra cmComputeLinkInformation
-  // instances.  We also enforce in debug mode that the map be emptied
-  // when copied.
-  static_cast<void>(r);
-  assert(r.empty());
-}
-
-//----------------------------------------------------------------------------
-cmTargetLinkInformationMap::~cmTargetLinkInformationMap()
-{
-  for(derived::iterator i = this->begin(); i != this->end(); ++i)
-    {
-    delete i->second;
-    }
-}
-
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 cmTargetInternalPointer::cmTargetInternalPointer()
 cmTargetInternalPointer::cmTargetInternalPointer()
 {
 {

+ 0 - 24
Source/cmTarget.h

@@ -22,18 +22,8 @@ class cmake;
 class cmMakefile;
 class cmMakefile;
 class cmSourceFile;
 class cmSourceFile;
 class cmGlobalGenerator;
 class cmGlobalGenerator;
-class cmComputeLinkInformation;
 class cmListFileBacktrace;
 class cmListFileBacktrace;
 
 
-struct cmTargetLinkInformationMap:
-  public std::map<cmStdString, cmComputeLinkInformation*>
-{
-  typedef std::map<cmStdString, cmComputeLinkInformation*> derived;
-  cmTargetLinkInformationMap() {}
-  cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r);
-  ~cmTargetLinkInformationMap();
-};
-
 class cmTargetInternals;
 class cmTargetInternals;
 class cmTargetInternalPointer
 class cmTargetInternalPointer
 {
 {
@@ -330,10 +320,6 @@ public:
   ///! Return the preferred linker language for this target
   ///! Return the preferred linker language for this target
   const char* GetLinkerLanguage(const char* config = 0);
   const char* GetLinkerLanguage(const char* config = 0);
 
 
-  ///! Return the rule variable used to create this type of target,
-  //  need to add CMAKE_(LANG) for full name.
-  const char* GetCreateRuleVariable();
-
   /** Get the full name of the target according to the settings in its
   /** Get the full name of the target according to the settings in its
       makefile.  */
       makefile.  */
   std::string GetFullName(const char* config=0, bool implib = false);
   std::string GetFullName(const char* config=0, bool implib = false);
@@ -400,8 +386,6 @@ public:
   std::string GetInstallNameDirForInstallTree(const char* config,
   std::string GetInstallNameDirForInstallTree(const char* config,
                                               bool for_xcode = false);
                                               bool for_xcode = false);
 
 
-  cmComputeLinkInformation* GetLinkInformation(const char* config);
-
   // Get the properties
   // Get the properties
   cmPropertyMap &GetProperties() { return this->Properties; };
   cmPropertyMap &GetProperties() { return this->Properties; };
 
 
@@ -419,9 +403,6 @@ public:
   // until we have per-target object file properties.
   // until we have per-target object file properties.
   void GetLanguages(std::set<cmStdString>& languages) const;
   void GetLanguages(std::set<cmStdString>& languages) const;
 
 
-  /** Get the list of OS X target architectures to be built.  */
-  void GetAppleArchs(const char* config, std::vector<std::string>& archVec);
-
   /** Return whether this target is an executable with symbol exports
   /** Return whether this target is an executable with symbol exports
       enabled.  */
       enabled.  */
   bool IsExecutableWithExports();
   bool IsExecutableWithExports();
@@ -459,9 +440,6 @@ public:
       directory.  */
       directory.  */
   bool UsesDefaultOutputDir(const char* config, bool implib);
   bool UsesDefaultOutputDir(const char* config, bool implib);
 
 
-  /** Get the include directories for this target.  */
-  std::vector<std::string> GetIncludeDirectories();
-
   /** Append to @a base the mac content directory and return it. */
   /** Append to @a base the mac content directory and return it. */
   std::string BuildMacContentDirectory(const std::string& base,
   std::string BuildMacContentDirectory(const std::string& base,
                                        const char* config = 0,
                                        const char* config = 0,
@@ -599,8 +577,6 @@ private:
   ImportInfo const* GetImportInfo(const char* config);
   ImportInfo const* GetImportInfo(const char* config);
   void ComputeImportInfo(std::string const& desired_config, ImportInfo& info);
   void ComputeImportInfo(std::string const& desired_config, ImportInfo& info);
 
 
-  cmTargetLinkInformationMap LinkInformation;
-
   bool ComputeLinkInterface(const char* config, LinkInterface& iface);
   bool ComputeLinkInterface(const char* config, LinkInterface& iface);
 
 
   void ComputeLinkImplementation(const char* config,
   void ComputeLinkImplementation(const char* config,

+ 3 - 2
Source/cmVisualStudio10TargetGenerator.cxx

@@ -1452,7 +1452,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
   // Replace spaces in libs with ;
   // Replace spaces in libs with ;
   cmSystemTools::ReplaceString(libs, " ", ";");
   cmSystemTools::ReplaceString(libs, " ", ";");
   cmComputeLinkInformation* pcli =
   cmComputeLinkInformation* pcli =
-    this->Target->GetLinkInformation(config.c_str());
+    this->GeneratorTarget->GetLinkInformation(config.c_str());
   if(!pcli)
   if(!pcli)
     {
     {
     cmSystemTools::Error
     cmSystemTools::Error
@@ -1594,7 +1594,8 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
     static_cast<cmGlobalVisualStudio7Generator *>
     static_cast<cmGlobalVisualStudio7Generator *>
     (this->GlobalGenerator)->GetConfigurations();
     (this->GlobalGenerator)->GetConfigurations();
   std::vector<std::string> includes;
   std::vector<std::string> includes;
-  this->LocalGenerator->GetIncludeDirectories(includes, this->Target);
+  this->LocalGenerator->GetIncludeDirectories(includes,
+                                              this->GeneratorTarget);
   for(std::vector<std::string>::iterator i = configs->begin();
   for(std::vector<std::string>::iterator i = configs->begin();
       i != configs->end(); ++i)
       i != configs->end(); ++i)
     {
     {

+ 2 - 1
Source/cmake.cxx

@@ -630,7 +630,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
     std::string linkLibs;
     std::string linkLibs;
     std::string flags;
     std::string flags;
     std::string linkFlags;
     std::string linkFlags;
-    lg->GetTargetFlags(linkLibs, flags, linkFlags, *tgt);
+    cmGeneratorTarget gtgt(tgt);
+    lg->GetTargetFlags(linkLibs, flags, linkFlags, &gtgt);
 
 
     printf("%s\n", linkLibs.c_str() );
     printf("%s\n", linkLibs.c_str() );