[Cmake-commits] CMake branch, next, updated. v3.4.0-rc1-845-g464c031

Stephen Kelly steveire at gmail.com
Wed Oct 21 16:00:50 EDT 2015


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  464c0314e74dda86d3812e7022d88f516258dbf6 (commit)
       via  bdf3feb98e2efa29ac93873c5b16f98cc02143ee (commit)
       via  d158158255d11b1bfb3aff01bce98d1125dab757 (commit)
       via  93bc501d43c4ac66b1f27fae802054b7efaf40b5 (commit)
       via  dd82a1338bac70f4fcfbe2c29293950c250e605b (commit)
       via  a25fc62ac40f2fe24a7d96d9014d03bf604cdad0 (commit)
       via  23f212b86d1890722a8e58ff4153ec60df696580 (commit)
       via  5f8521d0755f65917b8f406e78097b9b444af094 (commit)
       via  0546c7fa0c379c154b0da606ff38b815cf3da25c (commit)
       via  ca72f3ce24edb8959a2d622c5fc34139e6b81fd4 (commit)
       via  b45d4a883d10a8b3cd2ddfa2fc9fcbdfffbe8187 (commit)
      from  a52e9382ed912858423b4683879109900376859b (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=464c0314e74dda86d3812e7022d88f516258dbf6
commit 464c0314e74dda86d3812e7022d88f516258dbf6
Merge: a52e938 bdf3feb
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 21 16:00:48 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Oct 21 16:00:48 2015 -0400

    Merge topic 'use-generator-target' into next
    
    bdf3feb9 Sublime: Port API to cmGeneratorTarget.
    d1581582 Xcode: Port API to cmGeneratorTarget.
    93bc501d Xcode: Prefer to get target state from cmGeneratorTarget.
    dd82a133 Xcode: Re-order conditions.
    a25fc62a Xcode: Port ForceLinkerLanguage to cmGeneratorTarget.
    23f212b8 Xcode: Port loops to cmGeneratorTarget.
    5f8521d0 Makefiles: Port to cmGeneratorTarget.
    0546c7fa Ninja: Port to cmGeneratorTarget.
    ca72f3ce Use cmLocalGenerator at generate-time.
    b45d4a88 Port to GetGeneratorTargets.


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bdf3feb98e2efa29ac93873c5b16f98cc02143ee
commit bdf3feb98e2efa29ac93873c5b16f98cc02143ee
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Oct 18 23:53:26 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 21 21:59:57 2015 +0200

    Sublime: Port API to cmGeneratorTarget.

diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 47822e8..92d38b9 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -20,7 +20,6 @@
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
 #include "cmSystemTools.h"
-#include "cmTarget.h"
 
 #include <cmsys/SystemTools.hxx>
 
@@ -204,12 +203,12 @@ void cmExtraSublimeTextGenerator::
         case cmState::MODULE_LIBRARY:
         case cmState::OBJECT_LIBRARY:
           {
-          this->AppendTarget(fout, targetName, *lg, (*ti)->Target,
+          this->AppendTarget(fout, targetName, *lg, *ti,
                              make.c_str(), makefile, compiler.c_str(),
                              sourceFileFlags, false);
           std::string fastTarget = targetName;
           fastTarget += "/fast";
-          this->AppendTarget(fout, fastTarget, *lg, (*ti)->Target,
+          this->AppendTarget(fout, fastTarget, *lg, *ti,
                              make.c_str(), makefile, compiler.c_str(),
                              sourceFileFlags, false);
           }
@@ -225,7 +224,7 @@ void cmExtraSublimeTextGenerator::
   AppendTarget(cmGeneratedFileStream& fout,
                const std::string& targetName,
                cmLocalGenerator* lg,
-               cmTarget* target,
+               cmGeneratorTarget* target,
                const char* make,
                const cmMakefile* makefile,
                const char*, //compiler
@@ -235,10 +234,8 @@ void cmExtraSublimeTextGenerator::
 
   if (target != 0)
     {
-      cmGeneratorTarget *gtgt = this->GlobalGenerator
-                                    ->GetGeneratorTarget(target);
       std::vector<cmSourceFile*> sourceFiles;
-      gtgt->GetSourceFiles(sourceFiles,
+      target->GetSourceFiles(sourceFiles,
                              makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
       std::vector<cmSourceFile*>::const_iterator sourceFilesEnd =
         sourceFiles.end();
@@ -256,9 +253,9 @@ void cmExtraSublimeTextGenerator::
             }
           std::vector<std::string>& flags = sourceFileFlagsIter->second;
           std::string flagsString =
-            this->ComputeFlagsForObject(*iter, lg, gtgt);
+            this->ComputeFlagsForObject(*iter, lg, target);
           std::string definesString =
-            this->ComputeDefines(*iter, lg, gtgt);
+            this->ComputeDefines(*iter, lg, target);
           flags.clear();
           cmsys::RegularExpression flagRegex;
           // Regular expression to extract compiler flags from a string
diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h
index 5dd1140..cf31ee0 100644
--- a/Source/cmExtraSublimeTextGenerator.h
+++ b/Source/cmExtraSublimeTextGenerator.h
@@ -18,7 +18,6 @@
 
 class cmLocalGenerator;
 class cmMakefile;
-class cmTarget;
 class cmGeneratedFileStream;
 class cmGeneratorTarget;
 
@@ -67,7 +66,7 @@ private:
   void AppendTarget(cmGeneratedFileStream& fout,
                     const std::string& targetName,
                     cmLocalGenerator* lg,
-                    cmTarget* target,
+                    cmGeneratorTarget* target,
                     const char* make,
                     const cmMakefile* makefile,
                     const char* compiler,

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d158158255d11b1bfb3aff01bce98d1125dab757
commit d158158255d11b1bfb3aff01bce98d1125dab757
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Oct 19 21:23:29 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 21 21:59:57 2015 +0200

    Xcode: Port API to cmGeneratorTarget.

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 08c38a6..9111a3f 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -711,9 +711,9 @@ cmXCodeObject* cmGlobalXCodeGenerator
 
 //----------------------------------------------------------------------------
 std::string
-GetGroupMapKeyFromPath(cmTarget& cmtarget, const std::string& fullpath)
+GetGroupMapKeyFromPath(cmGeneratorTarget* target, const std::string& fullpath)
 {
-  std::string key(cmtarget.GetName());
+  std::string key(target->GetName());
   key += "-";
   key += fullpath;
   return key;
@@ -721,16 +721,16 @@ GetGroupMapKeyFromPath(cmTarget& cmtarget, const std::string& fullpath)
 
 //----------------------------------------------------------------------------
 std::string
-GetGroupMapKey(cmTarget& cmtarget, cmSourceFile* sf)
+GetGroupMapKey(cmGeneratorTarget* target, cmSourceFile* sf)
 {
-  return GetGroupMapKeyFromPath(cmtarget, sf->GetFullPath());
+  return GetGroupMapKeyFromPath(target, sf->GetFullPath());
 }
 
 //----------------------------------------------------------------------------
 cmXCodeObject*
 cmGlobalXCodeGenerator::CreateXCodeSourceFileFromPath(
   const std::string &fullpath,
-  cmTarget& cmtarget,
+  cmGeneratorTarget* target,
   const std::string &lang,
   cmSourceFile* sf)
 {
@@ -738,7 +738,7 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFileFromPath(
   // fileRef object for any given full path.
   //
   cmXCodeObject* fileRef =
-    this->CreateXCodeFileReferenceFromPath(fullpath, cmtarget, lang, sf);
+    this->CreateXCodeFileReferenceFromPath(fullpath, target, lang, sf);
 
   cmXCodeObject* buildFile = this->CreateObject(cmXCodeObject::PBXBuildFile);
   buildFile->SetComment(fileRef->GetComment());
@@ -751,7 +751,7 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFileFromPath(
 cmXCodeObject*
 cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
                                               cmSourceFile* sf,
-                                              cmTarget& cmtarget)
+                                              cmGeneratorTarget* gtgt)
 {
   // Add flags from target and source file properties.
   std::string flags;
@@ -781,7 +781,7 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
     this->CurrentLocalGenerator->GetSourceFileLanguage(*sf);
 
   cmXCodeObject* buildFile =
-    this->CreateXCodeSourceFileFromPath(sf->GetFullPath(), cmtarget, lang, sf);
+    this->CreateXCodeSourceFileFromPath(sf->GetFullPath(), gtgt, lang, sf);
   cmXCodeObject* fileRef = buildFile->GetObject("fileRef")->GetObject();
 
   cmXCodeObject* settings =
@@ -791,7 +791,6 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
   // Is this a resource file in this target? Add it to the resources group...
   //
 
-  cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
   cmGeneratorTarget::SourceFileFlags tsFlags =
       gtgt->GetTargetSourceFileFlags(sf);
   bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource;
@@ -926,11 +925,11 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext,
 cmXCodeObject*
 cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
   const std::string &fullpath,
-  cmTarget& cmtarget,
+  cmGeneratorTarget* target,
   const std::string &lang,
   cmSourceFile* sf)
 {
-  std::string key = GetGroupMapKeyFromPath(cmtarget, fullpath);
+  std::string key = GetGroupMapKeyFromPath(target, fullpath);
   cmXCodeObject* fileRef = this->FileRefs[key];
   if(!fileRef)
     {
@@ -1007,13 +1006,13 @@ cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
 //----------------------------------------------------------------------------
 cmXCodeObject*
 cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf,
-                                                 cmTarget& cmtarget)
+                                                 cmGeneratorTarget* target)
 {
   std::string lang =
     this->CurrentLocalGenerator->GetSourceFileLanguage(*sf);
 
   return this->CreateXCodeFileReferenceFromPath(
-    sf->GetFullPath(), cmtarget, lang, sf);
+    sf->GetFullPath(), target, lang, sf);
 }
 
 //----------------------------------------------------------------------------
@@ -1100,7 +1099,6 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
       l != sortedTargets.end(); l++)
     {
     cmGeneratorTarget* gtgt = l->second;
-    cmTarget& cmtarget = *gtgt->Target;
 
     std::string targetName = gtgt->GetName();
 
@@ -1118,7 +1116,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
     if(gtgt->GetType() == cmState::UTILITY ||
        gtgt->GetType() == cmState::GLOBAL_TARGET)
       {
-      cmXCodeObject* t = this->CreateUtilityTarget(cmtarget);
+      cmXCodeObject* t = this->CreateUtilityTarget(gtgt);
       if (!t)
         {
         return false;
@@ -1146,7 +1144,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
       {
       cmXCodeObject* xsf =
         this->CreateXCodeSourceFile(this->CurrentLocalGenerator,
-                                    *i, cmtarget);
+                                    *i, gtgt);
       cmXCodeObject* fr = xsf->GetObject("fileRef");
       cmXCodeObject* filetype =
         fr->GetObject()->GetObject("explicitFileType");
@@ -1197,7 +1195,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
         {
         std::string obj = *oi;
         cmXCodeObject* xsf =
-          this->CreateXCodeSourceFileFromPath(obj, cmtarget, "", 0);
+          this->CreateXCodeSourceFileFromPath(obj, gtgt, "", 0);
         externalObjFiles.push_back(xsf);
         }
       }
@@ -1320,7 +1318,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
           {
           cmXCodeObject* xsf =
             this->CreateXCodeSourceFile(this->CurrentLocalGenerator,
-                                        *sfIt, cmtarget);
+                                        *sfIt, gtgt);
           buildFiles->AddObject(xsf);
           }
         contentBuildPhases.push_back(copyFilesBuildPhase);
@@ -1354,9 +1352,9 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
     this->CreateCustomCommands(buildPhases, sourceBuildPhase,
                                headerBuildPhase, resourceBuildPhase,
                                contentBuildPhases,
-                               frameworkBuildPhase, cmtarget);
+                               frameworkBuildPhase, gtgt);
 
-    targets.push_back(this->CreateXCodeTarget(cmtarget, buildPhases));
+    targets.push_back(this->CreateXCodeTarget(gtgt, buildPhases));
     }
   return true;
 }
@@ -1431,7 +1429,7 @@ bool cmGlobalXCodeGenerator::IsHeaderFile(cmSourceFile* sf)
 cmXCodeObject*
 cmGlobalXCodeGenerator::CreateBuildPhase(const char* name,
                                          const char* name2,
-                                         cmTarget& cmtarget,
+                                         cmGeneratorTarget* target,
                                          const std::vector<cmCustomCommand>&
                                          commands)
 {
@@ -1451,7 +1449,7 @@ cmGlobalXCodeGenerator::CreateBuildPhase(const char* name,
                            this->CreateString("0"));
   buildPhase->AddAttribute("shellPath",
                            this->CreateString("/bin/sh"));
-  this->AddCommandsToBuildPhase(buildPhase, cmtarget, commands,
+  this->AddCommandsToBuildPhase(buildPhase, target, commands,
                                 name2);
   return buildPhase;
 }
@@ -1468,16 +1466,14 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
                                                   contentBuildPhases,
                                                   cmXCodeObject*
                                                   frameworkBuildPhase,
-                                                  cmTarget& cmtarget)
+                                                  cmGeneratorTarget* gtgt)
 {
   std::vector<cmCustomCommand> const & prebuild
-    = cmtarget.GetPreBuildCommands();
+    = gtgt->Target->GetPreBuildCommands();
   std::vector<cmCustomCommand> const & prelink
-    = cmtarget.GetPreLinkCommands();
+    = gtgt->Target->GetPreLinkCommands();
   std::vector<cmCustomCommand> postbuild
-    = cmtarget.GetPostBuildCommands();
-
-  cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
+    = gtgt->Target->GetPostBuildCommands();
 
   if(gtgt->GetType() == cmState::SHARED_LIBRARY &&
     !gtgt->IsFrameworkOnApple())
@@ -1530,19 +1526,19 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
   cmXCodeObject* cmakeRulesBuildPhase =
     this->CreateBuildPhase("CMake Rules",
                            "cmakeRulesBuildPhase",
-                           cmtarget, commands);
+                           gtgt, commands);
   // create prebuild phase
   cmXCodeObject* preBuildPhase =
     this->CreateBuildPhase("CMake PreBuild Rules", "preBuildCommands",
-                           cmtarget, prebuild);
+                           gtgt, prebuild);
   // create prelink phase
   cmXCodeObject* preLinkPhase =
     this->CreateBuildPhase("CMake PreLink Rules", "preLinkCommands",
-                           cmtarget, prelink);
+                           gtgt, prelink);
   // create postbuild phase
   cmXCodeObject* postBuildPhase =
     this->CreateBuildPhase("CMake PostBuild Rules", "postBuildPhase",
-                           cmtarget, postbuild);
+                           gtgt, postbuild);
 
   // The order here is the order they will be built in.
   // The order "headers, resources, sources" mimics a native project generated
@@ -1625,7 +1621,7 @@ std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag,
 //----------------------------------------------------------------------------
 void
 cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
-                                                cmTarget& target,
+                                                cmGeneratorTarget* target,
                                                 std::vector<cmCustomCommand>
                                                 const & commands,
                                                 const char* name)
@@ -1635,7 +1631,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
   cmSystemTools::MakeDirectory(dir.c_str());
   std::string makefile = dir;
   makefile += "/";
-  makefile += target.GetName();
+  makefile += target->GetName();
   makefile += "_";
   makefile += name;
   makefile += ".make";
@@ -1669,7 +1665,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
 //----------------------------------------------------------------------------
 void  cmGlobalXCodeGenerator
 ::CreateCustomRulesMakefile(const char* makefileBasename,
-                            cmTarget& target,
+                            cmGeneratorTarget* target,
                             std::vector<cmCustomCommand>
                             const & commands,
                             const std::string& configName)
@@ -1686,7 +1682,7 @@ void  cmGlobalXCodeGenerator
     }
   makefileStream.SetCopyIfDifferent(true);
   makefileStream << "# Generated by CMake, DO NOT EDIT\n";
-  makefileStream << "# Custom rules for " << target.GetName() << "\n";
+  makefileStream << "# Custom rules for " << target->GetName() << "\n";
 
   // disable the implicit rules
   makefileStream << ".SUFFIXES: " << "\n";
@@ -1715,7 +1711,7 @@ void  cmGlobalXCodeGenerator
         {
         std::ostringstream str;
         str << "_buildpart_" << count++ ;
-        tname[&ccg.GetCC()] = std::string(target.GetName()) + str.str();
+        tname[&ccg.GetCC()] = std::string(target->GetName()) + str.str();
         makefileStream << "\\\n\t" << tname[&ccg.GetCC()];
         }
       }
@@ -1793,11 +1789,10 @@ void  cmGlobalXCodeGenerator
 }
 
 //----------------------------------------------------------------------------
-void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
+void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
                                                 cmXCodeObject* buildSettings,
                                                 const std::string& configName)
 {
-  cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
   if(gtgt->GetType() == cmState::INTERFACE_LIBRARY)
     {
     return;
@@ -2020,7 +2015,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     if(this->XcodeVersion >= 21)
       {
       std::string pncdir = this->GetObjectsNormalDirectory(
-        this->CurrentProject, configName, &target);
+        this->CurrentProject, configName, gtgt);
       buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
                                   this->CreateString(pncdir.c_str()));
       }
@@ -2029,7 +2024,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
       buildSettings->AddAttribute("OBJROOT",
                                   this->CreateString(pndir.c_str()));
       pndir = this->GetObjectsNormalDirectory(
-        this->CurrentProject, configName, &target);
+        this->CurrentProject, configName, gtgt);
       }
     }
 
@@ -2067,7 +2062,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
         extraLinkOptions += " ";
         extraLinkOptions += createFlags;
         }
-      std::string plist = this->ComputeInfoPListLocation(target);
+      std::string plist = this->ComputeInfoPListLocation(gtgt);
       // Xcode will create the final version of Info.plist at build time,
       // so let it replace the cfbundle name. This avoids creating
       // a per-configuration Info.plist file. The cfbundle plist
@@ -2113,11 +2108,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     {
     if(gtgt->GetPropertyAsBool("FRAMEWORK"))
       {
-      std::string fw_version = target.GetFrameworkVersion();
+      std::string fw_version = gtgt->Target->GetFrameworkVersion();
       buildSettings->AddAttribute("FRAMEWORK_VERSION",
                                   this->CreateString(fw_version.c_str()));
 
-      std::string plist = this->ComputeInfoPListLocation(target);
+      std::string plist = this->ComputeInfoPListLocation(gtgt);
       // Xcode will create the final version of Info.plist at build time,
       // so let it replace the framework name. This avoids creating
       // a per-configuration Info.plist file.
@@ -2160,7 +2155,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     // Handle bundles and normal executables separately.
     if(gtgt->GetPropertyAsBool("MACOSX_BUNDLE"))
       {
-      std::string plist = this->ComputeInfoPListLocation(target);
+      std::string plist = this->ComputeInfoPListLocation(gtgt);
       // Xcode will create the final version of Info.plist at build time,
       // so let it replace the executable name.  This avoids creating
       // a per-configuration Info.plist file.
@@ -2400,7 +2395,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
       }
     }
 
-  buildSettings->AddAttribute(this->GetTargetLinkFlagsVar(target),
+  buildSettings->AddAttribute(this->GetTargetLinkFlagsVar(gtgt),
                               this->CreateString(extraLinkOptions.c_str()));
   buildSettings->AddAttribute("OTHER_REZFLAGS",
                               this->CreateString(""));
@@ -2459,7 +2454,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
   // put this last so it can override existing settings
   // Convert "XCODE_ATTRIBUTE_*" properties directly.
   {
-  cmPropertyMap const& props = target.GetProperties();
+  cmPropertyMap const& props = gtgt->Target->GetProperties();
   for(cmPropertyMap::const_iterator i = props.begin();
       i != props.end(); ++i)
     {
@@ -2508,9 +2503,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
 
 //----------------------------------------------------------------------------
 cmXCodeObject*
-cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
+cmGlobalXCodeGenerator::CreateUtilityTarget(cmGeneratorTarget* gtgt)
 {
-  cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
   cmXCodeObject* shellBuildPhase =
     this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase);
   shellBuildPhase->AddAttribute("buildActionMask",
@@ -2538,11 +2532,11 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
     this->CreateObject(cmXCodeObject::OBJECT_LIST);
   std::vector<cmXCodeObject*> emptyContentVector;
   this->CreateCustomCommands(buildPhases, 0, 0, 0, emptyContentVector, 0,
-                             cmtarget);
+                             gtgt);
   target->AddAttribute("buildPhases", buildPhases);
   if(this->XcodeVersion > 20)
     {
-    this->AddConfigurations(target, cmtarget);
+    this->AddConfigurations(target, gtgt);
     }
   else
     {
@@ -2550,7 +2544,7 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
       this->CurrentMakefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
     cmXCodeObject* buildSettings =
       this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
-    this->CreateBuildSettings(cmtarget, buildSettings, theConfig);
+    this->CreateBuildSettings(gtgt, buildSettings, theConfig);
     target->AddAttribute("buildSettings", buildSettings);
     }
   cmXCodeObject* dependencies =
@@ -2558,8 +2552,8 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
   target->AddAttribute("dependencies", dependencies);
   target->AddAttribute("name", this->CreateString(gtgt->GetName()));
   target->AddAttribute("productName",this->CreateString(gtgt->GetName()));
-  target->SetTarget(&cmtarget);
-  this->XCodeObjectMap[&cmtarget] = target;
+  target->SetTarget(gtgt);
+  this->XCodeObjectMap[gtgt] = target;
 
   // Add source files without build rules for editing convenience.
   if(gtgt->GetType() == cmState::UTILITY)
@@ -2575,7 +2569,7 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
       {
       if(!(*i)->GetPropertyAsBool("GENERATED"))
         {
-        this->CreateXCodeFileReference(*i, cmtarget);
+        this->CreateXCodeFileReference(*i, gtgt);
         }
       }
     }
@@ -2588,7 +2582,7 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
 
 //----------------------------------------------------------------------------
 std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
-                                                      cmTarget& cmtarget)
+                                                      cmGeneratorTarget* gtgt)
 {
   std::string configTypes =
     this->CurrentMakefile->GetRequiredDefinition("CMAKE_CONFIGURATION_TYPES");
@@ -2604,7 +2598,7 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
   std::string comment = "Build configuration list for ";
   comment += cmXCodeObject::PBXTypeNames[target->GetIsA()];
   comment += " \"";
-  comment += cmtarget.GetName();
+  comment += gtgt->GetName();
   comment += "\"";
   configlist->SetComment(comment.c_str());
   target->AddAttribute("buildConfigurationList",
@@ -2616,7 +2610,7 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
     buildConfigurations->AddObject(config);
     cmXCodeObject* buildSettings =
       this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
-    this->CreateBuildSettings(cmtarget, buildSettings,
+    this->CreateBuildSettings(gtgt, buildSettings,
                               configVector[i].c_str());
     config->AddAttribute("name", this->CreateString(configVector[i].c_str()));
     config->SetComment(configVector[i].c_str());
@@ -2634,12 +2628,12 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
 }
 
 //----------------------------------------------------------------------------
-const char*
-cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(cmTarget const& cmtarget) const
+const char* cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(
+    cmGeneratorTarget const* target) const
 {
   if(this->XcodeVersion >= 60 &&
-     (cmtarget.GetType() == cmState::STATIC_LIBRARY ||
-      cmtarget.GetType() == cmState::OBJECT_LIBRARY))
+     (target->GetType() == cmState::STATIC_LIBRARY ||
+      target->GetType() == cmState::OBJECT_LIBRARY))
     {
     return "OTHER_LIBTOOLFLAGS";
     }
@@ -2709,11 +2703,9 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(
 
 //----------------------------------------------------------------------------
 cmXCodeObject*
-cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
+cmGlobalXCodeGenerator::CreateXCodeTarget(cmGeneratorTarget* gtgt,
                                           cmXCodeObject* buildPhases)
 {
-  cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&cmtarget);
-
   if(gtgt->GetType() == cmState::INTERFACE_LIBRARY)
     {
     return 0;
@@ -2726,14 +2718,14 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
   std::string defConfig;
   if(this->XcodeVersion > 20)
     {
-    defConfig = this->AddConfigurations(target, cmtarget);
+    defConfig = this->AddConfigurations(target, gtgt);
     }
   else
     {
     cmXCodeObject* buildSettings =
       this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
     defConfig = this->CurrentMakefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
-    this->CreateBuildSettings(cmtarget, buildSettings, defConfig.c_str());
+    this->CreateBuildSettings(gtgt, buildSettings, defConfig.c_str());
     target->AddAttribute("buildSettings", buildSettings);
     }
   cmXCodeObject* dependencies =
@@ -2770,22 +2762,23 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
     {
     target->AddAttribute("productType", this->CreateString(productType));
     }
-  target->SetTarget(&cmtarget);
-  this->XCodeObjectMap[&cmtarget] = target;
+  target->SetTarget(gtgt);
+  this->XCodeObjectMap[gtgt] = target;
   target->SetId(this->GetOrCreateId(
     gtgt->GetName(), target->GetId()).c_str());
   return target;
 }
 
 //----------------------------------------------------------------------------
-cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(cmTarget const* t)
+cmXCodeObject*
+cmGlobalXCodeGenerator::FindXCodeTarget(cmGeneratorTarget const* t)
 {
   if(!t)
     {
     return 0;
     }
 
-  std::map<cmTarget const*, cmXCodeObject*>::const_iterator const i =
+  std::map<cmGeneratorTarget const*, cmXCodeObject*>::const_iterator const i =
     this->XCodeObjectMap.find(t);
   if (i == this->XCodeObjectMap.end())
     {
@@ -2922,8 +2915,7 @@ void cmGlobalXCodeGenerator
 void cmGlobalXCodeGenerator
 ::AddDependAndLinkInformation(cmXCodeObject* target)
 {
-  cmTarget* cmtarget = target->GetTarget();
-  cmGeneratorTarget* gt = this->GetGeneratorTarget(cmtarget);
+  cmGeneratorTarget* gt = target->GetTarget();
   if(!gt)
     {
     cmSystemTools::Error("Error no target on xobject\n");
@@ -2938,7 +2930,7 @@ void cmGlobalXCodeGenerator
   TargetDependSet const& deps = this->GetTargetDirectDepends(gt);
   for(TargetDependSet::const_iterator i = deps.begin(); i != deps.end(); ++i)
     {
-    if(cmXCodeObject* dptarget = this->FindXCodeTarget((*i)->Target))
+    if(cmXCodeObject* dptarget = this->FindXCodeTarget(*i))
       {
       this->AddDependTarget(target, dptarget);
       }
@@ -2967,7 +2959,7 @@ void cmGlobalXCodeGenerator
         linkObjs += this->XCodeEscapePath(oi->c_str());
         }
       this->AppendBuildSettingAttribute(
-        target, this->GetTargetLinkFlagsVar(*cmtarget),
+        target, this->GetTargetLinkFlagsVar(gt),
         linkObjs.c_str(), configName);
       }
 
@@ -3047,7 +3039,7 @@ void cmGlobalXCodeGenerator
         }
       }
     this->AppendBuildSettingAttribute(
-      target, this->GetTargetLinkFlagsVar(*cmtarget),
+      target, this->GetTargetLinkFlagsVar(gt),
       linkLibs.c_str(), configName);
     }
     }
@@ -3090,7 +3082,7 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
       // MACOSX_BUNDLE file
       if(gtgt->GetPropertyAsBool("MACOSX_BUNDLE"))
         {
-        std::string plist = this->ComputeInfoPListLocation(gtgt->Target);
+        std::string plist = this->ComputeInfoPListLocation(gtgt);
         mf->GetOrCreateSource(plist, true);
         gtgt->AddSource(plist);
         }
@@ -3110,8 +3102,8 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
         cmSourceGroup* sourceGroup =
           mf->FindSourceGroup(source.c_str(), sourceGroups);
         cmXCodeObject* pbxgroup =
-          this->CreateOrGetPBXGroup(gtgt->Target, sourceGroup);
-        std::string key = GetGroupMapKey(gtgt->Target, sf);
+          this->CreateOrGetPBXGroup(gtgt, sourceGroup);
+        std::string key = GetGroupMapKey(gtgt, sf);
         this->GroupMap[key] = pbxgroup;
         }
 
@@ -3125,8 +3117,8 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
         cmSourceGroup* sourceGroup =
           mf->FindSourceGroup(source.c_str(), sourceGroups);
         cmXCodeObject* pbxgroup =
-          this->CreateOrGetPBXGroup(gtgt->Target, sourceGroup);
-        std::string key = GetGroupMapKeyFromPath(gtgt->Target, source);
+          this->CreateOrGetPBXGroup(gtgt, sourceGroup);
+        std::string key = GetGroupMapKeyFromPath(gtgt, source);
         this->GroupMap[key] = pbxgroup;
         }
       }
@@ -3157,16 +3149,16 @@ cmXCodeObject *cmGlobalXCodeGenerator
 
 //----------------------------------------------------------------------------
 cmXCodeObject* cmGlobalXCodeGenerator
-::CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg)
+::CreateOrGetPBXGroup(cmGeneratorTarget* gtgt, cmSourceGroup* sg)
 {
   std::string s;
   std::string target;
-  const char *targetFolder= cmtarget.GetProperty("FOLDER");
+  const char *targetFolder= gtgt->GetProperty("FOLDER");
   if(targetFolder) {
     target = targetFolder;
     target += "/";
   }
-  target += cmtarget.GetName();
+  target += gtgt->GetName();
   s = target + "/";
   s += sg->GetFullName();
   std::map<std::string, cmXCodeObject* >::iterator it =
@@ -3556,10 +3548,10 @@ std::string
 cmGlobalXCodeGenerator::GetObjectsNormalDirectory(
   const std::string &projName,
   const std::string &configName,
-  const cmTarget *t) const
+  const cmGeneratorTarget *t) const
 {
   std::string dir =
-    t->GetMakefile()->GetCurrentBinaryDirectory();
+    t->GetLocalGenerator()->GetCurrentBinaryDirectory();
   dir += "/";
   dir += projName;
   dir += ".build/";
@@ -3633,8 +3625,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
         i != targets.end(); ++i)
       {
       cmXCodeObject* target = *i;
-      cmTarget* t =target->GetTarget();
-      cmGeneratorTarget *gt = this->GetGeneratorTarget(t);
+      cmGeneratorTarget* gt =target->GetTarget();
 
       if(gt->GetType() == cmState::EXECUTABLE ||
 // Nope - no post-build for OBJECT_LIRBRARY
@@ -3695,7 +3686,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
         if(this->Architectures.size() > 1)
           {
           std::string universal = this->GetObjectsNormalDirectory(
-            this->CurrentProject, configName, t);
+            this->CurrentProject, configName, gt);
           for( std::vector<std::string>::iterator arch =
                  this->Architectures.begin();
                arch != this->Architectures.end(); ++arch)
@@ -4038,12 +4029,13 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags,
 
 //----------------------------------------------------------------------------
 std::string
-cmGlobalXCodeGenerator::ComputeInfoPListLocation(cmTarget& target)
+cmGlobalXCodeGenerator::ComputeInfoPListLocation(cmGeneratorTarget* target)
 {
-  std::string plist = target.GetMakefile()->GetCurrentBinaryDirectory();
+  std::string plist =
+      target->GetLocalGenerator()->GetCurrentBinaryDirectory();
   plist += cmake::GetCMakeFilesDirectory();
   plist += "/";
-  plist += target.GetName();
+  plist += target->GetName();
   plist += ".dir/Info.plist";
   return plist;
 }
@@ -4069,7 +4061,7 @@ void cmGlobalXCodeGenerator
 {
   std::string configName = this->GetCMakeCFGIntDir();
   std::string dir = this->GetObjectsNormalDirectory(
-    "$(PROJECT_NAME)", configName, gt->Target);
+    "$(PROJECT_NAME)", configName, gt);
   if(this->XcodeVersion >= 21)
     {
     dir += "$(CURRENT_ARCH)/";
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 10d9bd6..510d46e 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -16,7 +16,6 @@
 #include "cmXCodeObject.h"
 #include "cmCustomCommand.h"
 class cmGlobalGeneratorFactory;
-class cmTarget;
 class cmSourceFile;
 class cmSourceGroup;
 
@@ -90,7 +89,7 @@ protected:
   virtual void AddExtraIDETargets();
   virtual void Generate();
 private:
-  cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget,
+  cmXCodeObject* CreateOrGetPBXGroup(cmGeneratorTarget* gtgt,
                                      cmSourceGroup* sg);
   cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent,
                                 std::string name);
@@ -108,22 +107,22 @@ private:
                             cmXCodeObject* resourceBuildPhase,
                             std::vector<cmXCodeObject*> contentBuildPhases,
                             cmXCodeObject* frameworkBuildPhase,
-                            cmTarget& cmtarget);
+                            cmGeneratorTarget *gtgt);
 
-  std::string ComputeInfoPListLocation(cmTarget& target);
+  std::string ComputeInfoPListLocation(cmGeneratorTarget *target);
 
   void AddCommandsToBuildPhase(cmXCodeObject* buildphase,
-                               cmTarget& target,
+                               cmGeneratorTarget *target,
                                std::vector<cmCustomCommand>
                                const & commands,
                                const char* commandFileName);
 
   void CreateCustomRulesMakefile(const char* makefileBasename,
-                                 cmTarget& target,
+                                 cmGeneratorTarget* target,
                                  std::vector<cmCustomCommand> const & commands,
                                  const std::string& configName);
 
-  cmXCodeObject* FindXCodeTarget(cmTarget const*);
+  cmXCodeObject* FindXCodeTarget(const cmGeneratorTarget *);
   std::string GetOrCreateId(const std::string& name, const std::string& id);
 
   // create cmXCodeObject from these functions so that memory can be managed
@@ -132,22 +131,23 @@ private:
   cmXCodeObject* CreateObject(cmXCodeObject::Type type);
   cmXCodeObject* CreateString(const std::string& s);
   cmXCodeObject* CreateObjectReference(cmXCodeObject*);
-  cmXCodeObject* CreateXCodeTarget(cmTarget& target,
+  cmXCodeObject* CreateXCodeTarget(cmGeneratorTarget *gtgt,
                                    cmXCodeObject* buildPhases);
   void ForceLinkerLanguages();
   void ForceLinkerLanguage(cmGeneratorTarget* gtgt);
-  const char* GetTargetLinkFlagsVar(cmTarget const& cmtarget) const;
+  const char* GetTargetLinkFlagsVar(const cmGeneratorTarget *target) const;
   const char* GetTargetFileType(cmGeneratorTarget* target);
   const char* GetTargetProductType(cmGeneratorTarget* target);
-  std::string AddConfigurations(cmXCodeObject* target, cmTarget& cmtarget);
+  std::string AddConfigurations(cmXCodeObject* target,
+                                cmGeneratorTarget *gtgt);
   void AppendOrAddBuildSetting(cmXCodeObject* settings, const char* attr,
                                const char* value);
   void AppendBuildSettingAttribute(cmXCodeObject* target, const char* attr,
                                    const char* value,
                                    const std::string& configName);
-  cmXCodeObject* CreateUtilityTarget(cmTarget& target);
+  cmXCodeObject* CreateUtilityTarget(cmGeneratorTarget *gtgt);
   void AddDependAndLinkInformation(cmXCodeObject* target);
-  void CreateBuildSettings(cmTarget& target,
+  void CreateBuildSettings(cmGeneratorTarget *gtgt,
                            cmXCodeObject* buildSettings,
                            const std::string& buildType);
   std::string ExtractFlag(const char* flag, std::string& flags);
@@ -161,18 +161,18 @@ private:
   void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root,
                          std::vector<cmLocalGenerator*>& generators);
   cmXCodeObject* CreateXCodeFileReferenceFromPath(const std::string &fullpath,
-                                                  cmTarget& cmtarget,
+                                                  cmGeneratorTarget *target,
                                                   const std::string &lang,
                                                   cmSourceFile* sf);
   cmXCodeObject* CreateXCodeSourceFileFromPath(const std::string &fullpath,
-                                               cmTarget& cmtarget,
+                                               cmGeneratorTarget *target,
                                                const std::string &lang,
                                                cmSourceFile* sf);
   cmXCodeObject* CreateXCodeFileReference(cmSourceFile* sf,
-                                          cmTarget& cmtarget);
+                                          cmGeneratorTarget *target);
   cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen,
                                        cmSourceFile* sf,
-                                       cmTarget& cmtarget);
+                                       cmGeneratorTarget *gtgt);
   bool CreateXCodeTargets(cmLocalGenerator* gen,
                           std::vector<cmXCodeObject*>&);
   bool IsHeaderFile(cmSourceFile*);
@@ -185,7 +185,7 @@ private:
                        std::vector<cmLocalGenerator*>& gens);
   cmXCodeObject* CreateBuildPhase(const char* name,
                                   const char* name2,
-                                  cmTarget& cmtarget,
+                                  cmGeneratorTarget *target,
                                   const std::vector<cmCustomCommand>&);
   void CreateReRunCMakeFile(cmLocalGenerator* root,
                             std::vector<cmLocalGenerator*> const& gens);
@@ -224,10 +224,9 @@ private:
   void PrintCompilerAdvice(std::ostream&, std::string const&,
                            const char*) const {}
 
-  std::string GetObjectsNormalDirectory(
-    const std::string &projName,
+  std::string GetObjectsNormalDirectory(const std::string &projName,
     const std::string &configName,
-    const cmTarget *t) const;
+    const cmGeneratorTarget *t) const;
 
   void addObject(cmXCodeObject *obj);
   std::string PostBuildMakeTarget(std::string const& tName,
@@ -249,7 +248,7 @@ private:
   std::map<std::string, cmXCodeObject* > GroupNameMap;
   std::map<std::string, cmXCodeObject* > TargetGroup;
   std::map<std::string, cmXCodeObject* > FileRefs;
-  std::map<cmTarget const*, cmXCodeObject* > XCodeObjectMap;
+  std::map<cmGeneratorTarget const*, cmXCodeObject* > XCodeObjectMap;
   std::vector<std::string> Architectures;
   std::string GeneratorToolset;
 };
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h
index ed2940a..0f0548b 100644
--- a/Source/cmXCodeObject.h
+++ b/Source/cmXCodeObject.h
@@ -13,7 +13,7 @@
 #define cmXCodeObject_h
 
 #include "cmStandardIncludes.h"
-class cmTarget;
+class cmGeneratorTarget;
 
 class cmXCodeObject
 {
@@ -87,11 +87,11 @@ public:
     {
       this->Id = id;
     }
-  cmTarget* GetTarget()
+  cmGeneratorTarget* GetTarget()
     {
       return this->Target;
     }
-  void SetTarget(cmTarget* t)
+  void SetTarget(cmGeneratorTarget* t)
     {
       this->Target = t;
     }
@@ -146,7 +146,7 @@ public:
 protected:
   void PrintString(std::ostream& os) const;
 
-  cmTarget* Target;
+  cmGeneratorTarget* Target;
   Type TypeValue;
   std::string Id;
   PBXType IsA;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=93bc501d43c4ac66b1f27fae802054b7efaf40b5
commit 93bc501d43c4ac66b1f27fae802054b7efaf40b5
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 21 20:36:59 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 21 21:59:57 2015 +0200

    Xcode: Prefer to get target state from cmGeneratorTarget.

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index d6c2e59..08c38a6 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1110,13 +1110,13 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
       continue;
       }
 
-    if(cmtarget.GetType() == cmState::INTERFACE_LIBRARY)
+    if(gtgt->GetType() == cmState::INTERFACE_LIBRARY)
       {
       continue;
       }
 
-    if(cmtarget.GetType() == cmState::UTILITY ||
-       cmtarget.GetType() == cmState::GLOBAL_TARGET)
+    if(gtgt->GetType() == cmState::UTILITY ||
+       gtgt->GetType() == cmState::GLOBAL_TARGET)
       {
       cmXCodeObject* t = this->CreateUtilityTarget(cmtarget);
       if (!t)
@@ -1204,7 +1204,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
 
     // some build phases only apply to bundles and/or frameworks
     bool isFrameworkTarget = gtgt->IsFrameworkOnApple();
-    bool isBundleTarget = cmtarget.GetPropertyAsBool("MACOSX_BUNDLE");
+    bool isBundleTarget = gtgt->GetPropertyAsBool("MACOSX_BUNDLE");
     bool isCFBundleTarget = gtgt->IsCFBundleOnApple();
 
     cmXCodeObject* buildFiles = 0;
@@ -1479,7 +1479,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
 
   cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
 
-  if(cmtarget.GetType() == cmState::SHARED_LIBRARY &&
+  if(gtgt->GetType() == cmState::SHARED_LIBRARY &&
     !gtgt->IsFrameworkOnApple())
     {
     cmCustomCommandLines cmd;
@@ -1488,13 +1488,13 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
     cmd[0].push_back("-E");
     cmd[0].push_back("cmake_symlink_library");
     std::string str_file = "$<TARGET_FILE:";
-    str_file += cmtarget.GetName();
+    str_file += gtgt->GetName();
     str_file += ">";
     std::string str_so_file = "$<TARGET_SONAME_FILE:";
-    str_so_file += cmtarget.GetName();
+    str_so_file += gtgt->GetName();
     str_so_file += ">";
     std::string str_link_file = "$<TARGET_LINKER_FILE:";
-    str_link_file += cmtarget.GetName();
+    str_link_file += gtgt->GetName();
     str_link_file += ">";
     cmd[0].push_back(str_file);
     cmd[0].push_back(str_so_file);
@@ -1797,22 +1797,22 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
                                                 cmXCodeObject* buildSettings,
                                                 const std::string& configName)
 {
-  if(target.GetType() == cmState::INTERFACE_LIBRARY)
+  cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
+  if(gtgt->GetType() == cmState::INTERFACE_LIBRARY)
     {
     return;
     }
 
   std::string defFlags;
-  bool shared = ((target.GetType() == cmState::SHARED_LIBRARY) ||
-                 (target.GetType() == cmState::MODULE_LIBRARY));
-  bool binary = ((target.GetType() == cmState::OBJECT_LIBRARY) ||
-                 (target.GetType() == cmState::STATIC_LIBRARY) ||
-                 (target.GetType() == cmState::EXECUTABLE) ||
+  bool shared = ((gtgt->GetType() == cmState::SHARED_LIBRARY) ||
+                 (gtgt->GetType() == cmState::MODULE_LIBRARY));
+  bool binary = ((gtgt->GetType() == cmState::OBJECT_LIBRARY) ||
+                 (gtgt->GetType() == cmState::STATIC_LIBRARY) ||
+                 (gtgt->GetType() == cmState::EXECUTABLE) ||
                  shared);
 
   // Compute the compilation flags for each language.
   std::set<std::string> languages;
-  cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
   gtgt->GetLanguages(languages, configName);
   std::map<std::string, std::string> cflags;
   for (std::set<std::string>::iterator li = languages.begin();
@@ -1840,7 +1840,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     {
     cmSystemTools::Error
       ("CMake can not determine linker language for target: ",
-       target.GetName().c_str());
+       gtgt->GetName().c_str());
     return;
     }
 
@@ -1869,15 +1869,15 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
 
   std::string extraLinkOptionsVar;
   std::string extraLinkOptions;
-  if(target.GetType() == cmState::EXECUTABLE)
+  if(gtgt->GetType() == cmState::EXECUTABLE)
     {
     extraLinkOptionsVar = "CMAKE_EXE_LINKER_FLAGS";
     }
-  else if(target.GetType() == cmState::SHARED_LIBRARY)
+  else if(gtgt->GetType() == cmState::SHARED_LIBRARY)
     {
     extraLinkOptionsVar = "CMAKE_SHARED_LINKER_FLAGS";
     }
-  else if(target.GetType() == cmState::MODULE_LIBRARY)
+  else if(gtgt->GetType() == cmState::MODULE_LIBRARY)
     {
     extraLinkOptionsVar = "CMAKE_MODULE_LINKER_FLAGS";
     }
@@ -1889,8 +1889,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
                                configName);
     }
 
-  if(target.GetType() == cmState::OBJECT_LIBRARY ||
-     target.GetType() == cmState::STATIC_LIBRARY)
+  if(gtgt->GetType() == cmState::OBJECT_LIBRARY ||
+     gtgt->GetType() == cmState::STATIC_LIBRARY)
     {
     this->CurrentLocalGenerator
       ->GetStaticLibraryFlags(extraLinkOptions,
@@ -1899,7 +1899,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     }
   else
     {
-    const char* targetLinkFlags = target.GetProperty("LINK_FLAGS");
+    const char* targetLinkFlags = gtgt->GetProperty("LINK_FLAGS");
     if(targetLinkFlags)
       {
       this->CurrentLocalGenerator->
@@ -1909,7 +1909,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
       {
       std::string linkFlagsVar = "LINK_FLAGS_";
       linkFlagsVar += cmSystemTools::UpperCase(configName);
-      if(const char* linkFlags = target.GetProperty(linkFlagsVar.c_str()))
+      if(const char* linkFlags = gtgt->GetProperty(linkFlagsVar.c_str()))
         {
         this->CurrentLocalGenerator->
           AppendFlags(extraLinkOptions, linkFlags);
@@ -1952,8 +1952,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
   std::string pnsuffix;
   gtgt->GetFullNameComponents(pnprefix, pnbase, pnsuffix, configName);
 
-  const char* version = target.GetProperty("VERSION");
-  const char* soversion = target.GetProperty("SOVERSION");
+  const char* version = gtgt->GetProperty("VERSION");
+  const char* soversion = gtgt->GetProperty("SOVERSION");
   if(!gtgt->HasSOName(configName) || gtgt->IsFrameworkOnApple())
     {
     version = 0;
@@ -1980,10 +1980,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
 
   // Set attributes to specify the proper name for the target.
   std::string pndir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory();
-  if(target.GetType() == cmState::STATIC_LIBRARY ||
-     target.GetType() == cmState::SHARED_LIBRARY ||
-     target.GetType() == cmState::MODULE_LIBRARY ||
-     target.GetType() == cmState::EXECUTABLE)
+  if(gtgt->GetType() == cmState::STATIC_LIBRARY ||
+     gtgt->GetType() == cmState::SHARED_LIBRARY ||
+     gtgt->GetType() == cmState::MODULE_LIBRARY ||
+     gtgt->GetType() == cmState::EXECUTABLE)
     {
     if(this->XcodeVersion >= 21)
       {
@@ -2011,10 +2011,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     buildSettings->AddAttribute("EXECUTABLE_SUFFIX",
                                 this->CreateString(pnsuffix.c_str()));
     }
-  else if(target.GetType() == cmState::OBJECT_LIBRARY)
+  else if(gtgt->GetType() == cmState::OBJECT_LIBRARY)
     {
     pnprefix = "lib";
-    pnbase = target.GetName();
+    pnbase = gtgt->GetName();
     pnsuffix = ".a";
 
     if(this->XcodeVersion >= 21)
@@ -2040,7 +2040,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
                               this->CreateString(pndir.c_str()));
 
   // Handle settings for each target type.
-  switch(target.GetType())
+  switch(gtgt->GetType())
     {
     case cmState::OBJECT_LIBRARY:
     case cmState::STATIC_LIBRARY:
@@ -2111,7 +2111,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     }
     case cmState::SHARED_LIBRARY:
     {
-    if(target.GetPropertyAsBool("FRAMEWORK"))
+    if(gtgt->GetPropertyAsBool("FRAMEWORK"))
       {
       std::string fw_version = target.GetFrameworkVersion();
       buildSettings->AddAttribute("FRAMEWORK_VERSION",
@@ -2158,7 +2158,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
       }
 
     // Handle bundles and normal executables separately.
-    if(target.GetPropertyAsBool("MACOSX_BUNDLE"))
+    if(gtgt->GetPropertyAsBool("MACOSX_BUNDLE"))
       {
       std::string plist = this->ComputeInfoPListLocation(target);
       // Xcode will create the final version of Info.plist at build time,
@@ -2323,7 +2323,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
 
   // Add Fortran source format attribute if property is set.
   const char* format = 0;
-  const char* tgtfmt = target.GetProperty("Fortran_FORMAT");
+  const char* tgtfmt = gtgt->GetProperty("Fortran_FORMAT");
   switch(this->CurrentLocalGenerator->GetFortranFormat(tgtfmt))
     {
     case cmLocalGenerator::FortranFormatFixed: format = "fixed"; break;
@@ -2338,7 +2338,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
 
   // Create the INSTALL_PATH attribute.
   std::string install_name_dir;
-  if(target.GetType() == cmState::SHARED_LIBRARY)
+  if(gtgt->GetType() == cmState::SHARED_LIBRARY)
     {
     // Get the install_name directory for the build tree.
     install_name_dir = gtgt->GetInstallNameDirForBuildTree(configName);
@@ -2426,7 +2426,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     }
 
   // Runtime version information.
-  if(target.GetType() == cmState::SHARED_LIBRARY)
+  if(gtgt->GetType() == cmState::SHARED_LIBRARY)
     {
     int major;
     int minor;
@@ -2510,6 +2510,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
 cmXCodeObject*
 cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
 {
+  cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
   cmXCodeObject* shellBuildPhase =
     this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase);
   shellBuildPhase->AddAttribute("buildActionMask",
@@ -2532,7 +2533,7 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
 
   cmXCodeObject* target =
     this->CreateObject(cmXCodeObject::PBXAggregateTarget);
-  target->SetComment(cmtarget.GetName().c_str());
+  target->SetComment(gtgt->GetName().c_str());
   cmXCodeObject* buildPhases =
     this->CreateObject(cmXCodeObject::OBJECT_LIST);
   std::vector<cmXCodeObject*> emptyContentVector;
@@ -2555,16 +2556,15 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
   cmXCodeObject* dependencies =
     this->CreateObject(cmXCodeObject::OBJECT_LIST);
   target->AddAttribute("dependencies", dependencies);
-  target->AddAttribute("name", this->CreateString(cmtarget.GetName()));
-  target->AddAttribute("productName",this->CreateString(cmtarget.GetName()));
+  target->AddAttribute("name", this->CreateString(gtgt->GetName()));
+  target->AddAttribute("productName",this->CreateString(gtgt->GetName()));
   target->SetTarget(&cmtarget);
   this->XCodeObjectMap[&cmtarget] = target;
 
   // Add source files without build rules for editing convenience.
-  if(cmtarget.GetType() == cmState::UTILITY)
+  if(gtgt->GetType() == cmState::UTILITY)
     {
     std::vector<cmSourceFile*> sources;
-    cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
     if (!gtgt->GetConfigCommonSourceFiles(sources))
       {
       return 0;
@@ -2581,7 +2581,7 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
     }
 
   target->SetId(this->GetOrCreateId(
-    cmtarget.GetName(), target->GetId()).c_str());
+    gtgt->GetName(), target->GetId()).c_str());
 
   return target;
 }
@@ -2712,7 +2712,9 @@ cmXCodeObject*
 cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
                                           cmXCodeObject* buildPhases)
 {
-  if(cmtarget.GetType() == cmState::INTERFACE_LIBRARY)
+  cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&cmtarget);
+
+  if(gtgt->GetType() == cmState::INTERFACE_LIBRARY)
     {
     return 0;
     }
@@ -2737,10 +2739,8 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
   cmXCodeObject* dependencies =
     this->CreateObject(cmXCodeObject::OBJECT_LIST);
   target->AddAttribute("dependencies", dependencies);
-  target->AddAttribute("name", this->CreateString(cmtarget.GetName()));
-  target->AddAttribute("productName",this->CreateString(cmtarget.GetName()));
-
-  cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&cmtarget);
+  target->AddAttribute("name", this->CreateString(gtgt->GetName()));
+  target->AddAttribute("productName",this->CreateString(gtgt->GetName()));
 
   cmXCodeObject* fileRef =
     this->CreateObject(cmXCodeObject::PBXFileReference);
@@ -2749,10 +2749,10 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
     fileRef->AddAttribute("explicitFileType", this->CreateString(fileType));
     }
   std::string fullName;
-  if(cmtarget.GetType() == cmState::OBJECT_LIBRARY)
+  if(gtgt->GetType() == cmState::OBJECT_LIBRARY)
     {
     fullName = "lib";
-    fullName += cmtarget.GetName();
+    fullName += gtgt->GetName();
     fullName += ".a";
     }
   else
@@ -2763,7 +2763,7 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
   fileRef->AddAttribute("refType", this->CreateString("0"));
   fileRef->AddAttribute("sourceTree",
                         this->CreateString("BUILT_PRODUCTS_DIR"));
-  fileRef->SetComment(cmtarget.GetName().c_str());
+  fileRef->SetComment(gtgt->GetName().c_str());
   target->AddAttribute("productReference",
                        this->CreateObjectReference(fileRef));
   if(const char* productType = this->GetTargetProductType(gtgt))
@@ -2773,7 +2773,7 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
   target->SetTarget(&cmtarget);
   this->XCodeObjectMap[&cmtarget] = target;
   target->SetId(this->GetOrCreateId(
-    cmtarget.GetName(), target->GetId()).c_str());
+    gtgt->GetName(), target->GetId()).c_str());
   return target;
 }
 
@@ -2923,18 +2923,18 @@ void cmGlobalXCodeGenerator
 ::AddDependAndLinkInformation(cmXCodeObject* target)
 {
   cmTarget* cmtarget = target->GetTarget();
-  if(!cmtarget)
+  cmGeneratorTarget* gt = this->GetGeneratorTarget(cmtarget);
+  if(!gt)
     {
     cmSystemTools::Error("Error no target on xobject\n");
     return;
     }
-  if(cmtarget->GetType() == cmState::INTERFACE_LIBRARY)
+  if(gt->GetType() == cmState::INTERFACE_LIBRARY)
     {
     return;
     }
 
   // Add dependencies on other CMake targets.
-  cmGeneratorTarget* gt = this->GetGeneratorTarget(cmtarget);
   TargetDependSet const& deps = this->GetTargetDirectDepends(gt);
   for(TargetDependSet::const_iterator i = deps.begin(); i != deps.end(); ++i)
     {
@@ -2958,7 +2958,7 @@ void cmGlobalXCodeGenerator
       std::string linkObjs;
       const char* sep = "";
       std::vector<std::string> objs;
-      this->GetGeneratorTarget(cmtarget)->UseObjectLibraries(objs, "");
+      gt->UseObjectLibraries(objs, "");
       for(std::vector<std::string>::const_iterator
             oi = objs.begin(); oi != objs.end(); ++oi)
         {
@@ -2972,15 +2972,14 @@ void cmGlobalXCodeGenerator
       }
 
     // Skip link information for object libraries.
-    if(cmtarget->GetType() == cmState::OBJECT_LIBRARY ||
-       cmtarget->GetType() == cmState::STATIC_LIBRARY)
+    if(gt->GetType() == cmState::OBJECT_LIBRARY ||
+       gt->GetType() == cmState::STATIC_LIBRARY)
       {
       continue;
       }
 
     // Compute the link library and directory information.
-    cmGeneratorTarget* gtgt = this->GetGeneratorTarget(cmtarget);
-    cmComputeLinkInformation* pcli = gtgt->GetLinkInformation(configName);
+    cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName);
     if(!pcli)
       {
       continue;
@@ -3637,21 +3636,21 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
       cmTarget* t =target->GetTarget();
       cmGeneratorTarget *gt = this->GetGeneratorTarget(t);
 
-      if(t->GetType() == cmState::EXECUTABLE ||
+      if(gt->GetType() == cmState::EXECUTABLE ||
 // Nope - no post-build for OBJECT_LIRBRARY
-//         t->GetType() == cmState::OBJECT_LIBRARY ||
-         t->GetType() == cmState::STATIC_LIBRARY ||
-         t->GetType() == cmState::SHARED_LIBRARY ||
-         t->GetType() == cmState::MODULE_LIBRARY)
+//         gt->GetType() == cmState::OBJECT_LIBRARY ||
+         gt->GetType() == cmState::STATIC_LIBRARY ||
+         gt->GetType() == cmState::SHARED_LIBRARY ||
+         gt->GetType() == cmState::MODULE_LIBRARY)
         {
         // Declare an entry point for the target post-build phase.
-        makefileStream << this->PostBuildMakeTarget(t->GetName(), *ct)
+        makefileStream << this->PostBuildMakeTarget(gt->GetName(), *ct)
                        << ":\n";
         }
 
-      if(t->GetType() == cmState::EXECUTABLE ||
-         t->GetType() == cmState::SHARED_LIBRARY ||
-         t->GetType() == cmState::MODULE_LIBRARY)
+      if(gt->GetType() == cmState::EXECUTABLE ||
+         gt->GetType() == cmState::SHARED_LIBRARY ||
+         gt->GetType() == cmState::MODULE_LIBRARY)
         {
         std::string tfull = gt->GetFullPath(configName);
         std::string trel = this->ConvertToRelativeForMake(tfull.c_str());

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd82a1338bac70f4fcfbe2c29293950c250e605b
commit dd82a1338bac70f4fcfbe2c29293950c250e605b
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 21 21:14:00 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 21 21:59:56 2015 +0200

    Xcode: Re-order conditions.

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 5be76af..d6c2e59 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2923,13 +2923,13 @@ void cmGlobalXCodeGenerator
 ::AddDependAndLinkInformation(cmXCodeObject* target)
 {
   cmTarget* cmtarget = target->GetTarget();
-  if(cmtarget->GetType() == cmState::INTERFACE_LIBRARY)
+  if(!cmtarget)
     {
+    cmSystemTools::Error("Error no target on xobject\n");
     return;
     }
-  if(!cmtarget)
+  if(cmtarget->GetType() == cmState::INTERFACE_LIBRARY)
     {
-    cmSystemTools::Error("Error no target on xobject\n");
     return;
     }
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a25fc62ac40f2fe24a7d96d9014d03bf604cdad0
commit a25fc62ac40f2fe24a7d96d9014d03bf604cdad0
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 21 20:38:10 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 21 21:59:56 2015 +0200

    Xcode: Port ForceLinkerLanguage to cmGeneratorTarget.

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index d015a92..5be76af 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1368,22 +1368,22 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguages()
   for(TargetMap::const_iterator
         ti = this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
     {
-    this->ForceLinkerLanguage(*ti->second);
+    cmGeneratorTarget* gt = this->GetGeneratorTarget(ti->second);
+    this->ForceLinkerLanguage(gt);
     }
 }
 
 //----------------------------------------------------------------------------
-void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
+void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt)
 {
   // This matters only for targets that link.
-  if(cmtarget.GetType() != cmState::EXECUTABLE &&
-     cmtarget.GetType() != cmState::SHARED_LIBRARY &&
-     cmtarget.GetType() != cmState::MODULE_LIBRARY)
+  if(gtgt->GetType() != cmState::EXECUTABLE &&
+     gtgt->GetType() != cmState::SHARED_LIBRARY &&
+     gtgt->GetType() != cmState::MODULE_LIBRARY)
     {
     return;
     }
 
-  cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&cmtarget);
   std::string llang = gtgt->GetLinkerLanguage("NOCONFIG");
   if(llang.empty()) { return; }
 
@@ -1399,11 +1399,11 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
   // Add an empty source file to the target that compiles with the
   // linker language.  This should convince Xcode to choose the proper
   // language.
-  cmMakefile* mf = cmtarget.GetMakefile();
+  cmMakefile* mf = gtgt->Target->GetMakefile();
   std::string fname = gtgt->GetLocalGenerator()->GetCurrentBinaryDirectory();
   fname += cmake::GetCMakeFilesDirectory();
   fname += "/";
-  fname += cmtarget.GetName();
+  fname += gtgt->GetName();
   fname += "-CMakeForceLinker";
   fname += ".";
   fname += cmSystemTools::LowerCase(llang);
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index feb5009..10d9bd6 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -135,7 +135,7 @@ private:
   cmXCodeObject* CreateXCodeTarget(cmTarget& target,
                                    cmXCodeObject* buildPhases);
   void ForceLinkerLanguages();
-  void ForceLinkerLanguage(cmTarget& cmtarget);
+  void ForceLinkerLanguage(cmGeneratorTarget* gtgt);
   const char* GetTargetLinkFlagsVar(cmTarget const& cmtarget) const;
   const char* GetTargetFileType(cmGeneratorTarget* target);
   const char* GetTargetProductType(cmGeneratorTarget* target);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=23f212b86d1890722a8e58ff4153ec60df696580
commit 23f212b86d1890722a8e58ff4153ec60df696580
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 21 20:32:20 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 21 21:59:56 2015 +0200

    Xcode: Port loops to cmGeneratorTarget.

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index fe115ac..d015a92 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -514,18 +514,18 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
     for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
         l != tgts.end(); l++)
       {
-      cmTarget& target = *(*l)->Target;
+      cmGeneratorTarget* target = *l;
 
-      if (target.GetType() == cmState::GLOBAL_TARGET)
+      if (target->GetType() == cmState::GLOBAL_TARGET)
         {
         continue;
         }
 
-      std::string targetName = target.GetName();
+      std::string targetName = target->GetName();
 
       if (regenerate && (targetName != CMAKE_CHECK_BUILD_SYSTEM_TARGET))
         {
-        target.AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
+        target->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
         }
 
       // make all exe, shared libs and modules
@@ -533,19 +533,19 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
       // this will make sure that when the next target is built
       // things are up-to-date
       if(!makeHelper.empty() &&
-         (target.GetType() == cmState::EXECUTABLE ||
+         (target->GetType() == cmState::EXECUTABLE ||
 // Nope - no post-build for OBJECT_LIRBRARY
-//          target.GetType() == cmState::OBJECT_LIBRARY ||
-          target.GetType() == cmState::STATIC_LIBRARY ||
-          target.GetType() == cmState::SHARED_LIBRARY ||
-          target.GetType() == cmState::MODULE_LIBRARY))
+//          target->GetType() == cmState::OBJECT_LIBRARY ||
+          target->GetType() == cmState::STATIC_LIBRARY ||
+          target->GetType() == cmState::SHARED_LIBRARY ||
+          target->GetType() == cmState::MODULE_LIBRARY))
         {
         makeHelper[makeHelper.size()-1] = // fill placeholder
-          this->PostBuildMakeTarget(target.GetName(), "$(CONFIGURATION)");
+          this->PostBuildMakeTarget(target->GetName(), "$(CONFIGURATION)");
         cmCustomCommandLines commandLines;
         commandLines.push_back(makeHelper);
         std::vector<std::string> no_byproducts;
-        lg->GetMakefile()->AddCustomCommandToTarget(target.GetName(),
+        lg->GetMakefile()->AddCustomCommandToTarget(target->GetName(),
                                                     no_byproducts,
                                                     no_depends,
                                                     commandLines,
@@ -554,19 +554,17 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
                                                     dir.c_str());
         }
 
-      if(target.GetType() != cmState::INTERFACE_LIBRARY
-          && !target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
+      if(target->GetType() != cmState::INTERFACE_LIBRARY
+          && !target->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
         {
-        allbuild->AddUtility(target.GetName());
+        allbuild->AddUtility(target->GetName());
         }
 
-      cmGeneratorTarget* targetGT = this->GetGeneratorTarget(&target);
-
       // Refer to the build configuration file for easy editing.
       listfile = lg->GetCurrentSourceDirectory();
       listfile += "/";
       listfile += "CMakeLists.txt";
-      targetGT->AddSource(listfile.c_str());
+      target->AddSource(listfile.c_str());
       }
     }
 }
@@ -3074,28 +3072,26 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
     for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
         l != tgts.end(); l++)
       {
-      cmTarget& cmtarget = *(*l)->Target;
+      cmGeneratorTarget* gtgt = *l;
 
       // Same skipping logic here as in CreateXCodeTargets so that we do not
       // end up with (empty anyhow) ALL_BUILD and XCODE_DEPEND_HELPER source
       // groups:
       //
-      if(cmtarget.GetType() == cmState::GLOBAL_TARGET)
+      if(gtgt->GetType() == cmState::GLOBAL_TARGET)
         {
         continue;
         }
-      if(cmtarget.GetType() == cmState::INTERFACE_LIBRARY)
+      if(gtgt->GetType() == cmState::INTERFACE_LIBRARY)
         {
         continue;
         }
 
-      cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
-
       // add the soon to be generated Info.plist file as a source for a
       // MACOSX_BUNDLE file
-      if(cmtarget.GetPropertyAsBool("MACOSX_BUNDLE"))
+      if(gtgt->GetPropertyAsBool("MACOSX_BUNDLE"))
         {
-        std::string plist = this->ComputeInfoPListLocation(cmtarget);
+        std::string plist = this->ComputeInfoPListLocation(gtgt->Target);
         mf->GetOrCreateSource(plist, true);
         gtgt->AddSource(plist);
         }
@@ -3115,14 +3111,14 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
         cmSourceGroup* sourceGroup =
           mf->FindSourceGroup(source.c_str(), sourceGroups);
         cmXCodeObject* pbxgroup =
-          this->CreateOrGetPBXGroup(cmtarget, sourceGroup);
-        std::string key = GetGroupMapKey(cmtarget, sf);
+          this->CreateOrGetPBXGroup(gtgt->Target, sourceGroup);
+        std::string key = GetGroupMapKey(gtgt->Target, sf);
         this->GroupMap[key] = pbxgroup;
         }
 
       // Put OBJECT_LIBRARY objects in proper groups:
       std::vector<std::string> objs;
-      this->GetGeneratorTarget(&cmtarget)->UseObjectLibraries(objs, "");
+      gtgt->UseObjectLibraries(objs, "");
       for(std::vector<std::string>::const_iterator
             oi = objs.begin(); oi != objs.end(); ++oi)
         {
@@ -3130,8 +3126,8 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
         cmSourceGroup* sourceGroup =
           mf->FindSourceGroup(source.c_str(), sourceGroups);
         cmXCodeObject* pbxgroup =
-          this->CreateOrGetPBXGroup(cmtarget, sourceGroup);
-        std::string key = GetGroupMapKeyFromPath(cmtarget, source);
+          this->CreateOrGetPBXGroup(gtgt->Target, sourceGroup);
+        std::string key = GetGroupMapKeyFromPath(gtgt->Target, source);
         this->GroupMap[key] = pbxgroup;
         }
       }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f8521d0755f65917b8f406e78097b9b444af094
commit 5f8521d0755f65917b8f406e78097b9b444af094
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Oct 18 23:20:47 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 21 21:59:56 2015 +0200

    Makefiles: Port to cmGeneratorTarget.

diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 2c47ab2..bd47715 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -18,7 +18,6 @@
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
 #include "cmSystemTools.h"
-#include "cmTarget.h"
 
 cmCommonTargetGenerator::cmCommonTargetGenerator(
   cmOutputConverter::RelativeRoot wd,
@@ -26,7 +25,6 @@ cmCommonTargetGenerator::cmCommonTargetGenerator(
   )
   : WorkingDirectory(wd)
   , GeneratorTarget(gt)
-  , Target(gt->Target)
   , Makefile(gt->Makefile)
   , LocalGenerator(static_cast<cmLocalCommonGenerator*>(gt->LocalGenerator))
   , GlobalGenerator(static_cast<cmGlobalCommonGenerator*>(
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index a4b2c10..3fb1fd0 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -21,7 +21,6 @@ class cmGlobalCommonGenerator;
 class cmLocalCommonGenerator;
 class cmMakefile;
 class cmSourceFile;
-class cmTarget;
 
 /** \class cmCommonTargetGenerator
  * \brief Common infrastructure for Makefile and Ninja per-target generators
@@ -49,7 +48,6 @@ protected:
 
   cmOutputConverter::RelativeRoot WorkingDirectory;
   cmGeneratorTarget* GeneratorTarget;
-  cmTarget* Target;
   cmMakefile* Makefile;
   cmLocalCommonGenerator* LocalGenerator;
   cmGlobalCommonGenerator* GlobalGenerator;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 4d7ca25..b4a915c 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -16,7 +16,6 @@
 #include "cmake.h"
 #include "cmGeneratedFileStream.h"
 #include "cmSourceFile.h"
-#include "cmTarget.h"
 #include "cmGeneratorTarget.h"
 #include "cmAlgorithms.h"
 
@@ -742,7 +741,7 @@ cmGlobalUnixMakefileGenerator3
       makefileName = localName;
       makefileName += "/build.make";
 
-      bool needRequiresStep = this->NeedRequiresStep(*gtarget->Target);
+      bool needRequiresStep = this->NeedRequiresStep(gtarget);
 
       lg->WriteDivider(ruleFileStream);
       ruleFileStream
@@ -1129,19 +1128,19 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
 
 
 bool cmGlobalUnixMakefileGenerator3
-::NeedRequiresStep(cmTarget const& target)
+::NeedRequiresStep(const cmGeneratorTarget* target)
 {
   std::set<std::string> languages;
-  cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&target);
-  gtgt->GetLanguages(languages,
-                target.GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"));
+  target->GetLanguages(languages,
+                       target->Target->GetMakefile()
+                       ->GetSafeDefinition("CMAKE_BUILD_TYPE"));
   for(std::set<std::string>::const_iterator l = languages.begin();
       l != languages.end(); ++l)
     {
     std::string var = "CMAKE_NEEDS_REQUIRES_STEP_";
     var += *l;
     var += "_FLAG";
-    if(target.GetMakefile()->GetDefinition(var))
+    if(target->Target->GetMakefile()->GetDefinition(var))
       {
       return true;
       }
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 0485eb8..63ffcb4 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -154,7 +154,7 @@ protected:
                                  cmGeneratorTarget* target);
 
   // does this generator need a requires step for any of its targets
-  bool NeedRequiresStep(cmTarget const&);
+  bool NeedRequiresStep(cmGeneratorTarget const*);
 
   // Target name hooks for superclass.
   const char* GetAllTargetName()           const { return "all"; }
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index e9dc9ff..34a50a3 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1977,7 +1977,7 @@ void cmLocalUnixMakefileGenerator3
                           cmGeneratorTarget* target)
 {
   ImplicitDependLanguageMap const& implicitLangs =
-    this->GetImplicitDepends(*target->Target);
+    this->GetImplicitDepends(target);
 
   // list the languages
   cmakefileStream
@@ -2292,19 +2292,20 @@ cmLocalUnixMakefileGenerator3
 
 //----------------------------------------------------------------------------
 cmLocalUnixMakefileGenerator3::ImplicitDependLanguageMap const&
-cmLocalUnixMakefileGenerator3::GetImplicitDepends(cmTarget const& tgt)
+cmLocalUnixMakefileGenerator3::GetImplicitDepends(
+    const cmGeneratorTarget* tgt)
 {
-  return this->ImplicitDepends[tgt.GetName()];
+  return this->ImplicitDepends[tgt->GetName()];
 }
 
 //----------------------------------------------------------------------------
 void
-cmLocalUnixMakefileGenerator3::AddImplicitDepends(cmTarget const& tgt,
+cmLocalUnixMakefileGenerator3::AddImplicitDepends(const cmGeneratorTarget* tgt,
                                                   const std::string& lang,
                                                   const char* obj,
                                                   const char* src)
 {
-  this->ImplicitDepends[tgt.GetName()][lang][obj].push_back(src);
+  this->ImplicitDepends[tgt->GetName()][lang][obj].push_back(src);
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 7e0f248..8f69311 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -21,7 +21,6 @@ class cmCustomCommand;
 class cmCustomCommandGenerator;
 class cmDepends;
 class cmMakefileTargetGenerator;
-class cmTarget;
 class cmSourceFile;
 
 /** \class cmLocalUnixMakefileGenerator3
@@ -141,9 +140,11 @@ public:
     public std::map<std::string, ImplicitDependFileMap> {};
   struct ImplicitDependTargetMap:
     public std::map<std::string, ImplicitDependLanguageMap> {};
-  ImplicitDependLanguageMap const& GetImplicitDepends(cmTarget const& tgt);
+  ImplicitDependLanguageMap const&
+  GetImplicitDepends(cmGeneratorTarget const* tgt);
 
-  void AddImplicitDepends(cmTarget const& tgt, const std::string& lang,
+  void AddImplicitDepends(cmGeneratorTarget const* tgt,
+                          const std::string& lang,
                           const char* obj, const char* src);
 
   // write the target rules for the local Makefile into the stream
@@ -197,12 +198,12 @@ protected:
                             const std::string& helpTarget);
 
   void WriteTargetDependRule(std::ostream& ruleFileStream,
-                             cmTarget& target);
+                             cmGeneratorTarget* target);
   void WriteTargetCleanRule(std::ostream& ruleFileStream,
-                            cmTarget& target,
+                            cmGeneratorTarget* target,
                             const std::vector<std::string>& files);
   void WriteTargetRequiresRule(std::ostream& ruleFileStream,
-                               cmTarget& target,
+                               cmGeneratorTarget* target,
                                const std::vector<std::string>& objects);
 
   void AppendRuleDepend(std::vector<std::string>& depends,
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 020e64c..f56037f 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -16,7 +16,6 @@
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include "cmTarget.h"
 #include "cmake.h"
 
 //----------------------------------------------------------------------------
@@ -279,11 +278,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
   if(!relink)
     {
     this->LocalGenerator
-      ->AppendCustomCommands(commands, this->Target->GetPreBuildCommands(),
-                             this->GeneratorTarget);
+      ->AppendCustomCommands(commands,
+                        this->GeneratorTarget->Target->GetPreBuildCommands(),
+                        this->GeneratorTarget);
     this->LocalGenerator
-      ->AppendCustomCommands(commands, this->Target->GetPreLinkCommands(),
-                             this->GeneratorTarget);
+      ->AppendCustomCommands(commands,
+                        this->GeneratorTarget->Target->GetPreLinkCommands(),
+                        this->GeneratorTarget);
     }
 
   // Determine whether a link script will be used.
@@ -448,8 +449,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
   if(!relink)
     {
     this->LocalGenerator->
-      AppendCustomCommands(commands, this->Target->GetPostBuildCommands(),
-                           this->GeneratorTarget);
+      AppendCustomCommands(commands,
+                       this->GeneratorTarget->Target->GetPostBuildCommands(),
+                       this->GeneratorTarget);
     }
 
   // Write the build rule.
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index df2a8c9..0a65641 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -16,7 +16,6 @@
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include "cmTarget.h"
 #include "cmake.h"
 #include "cmAlgorithms.h"
 
@@ -114,7 +113,8 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
 
   // Add post-build rules.
   this->LocalGenerator->
-    AppendCustomCommands(commands, this->Target->GetPostBuildCommands(),
+    AppendCustomCommands(commands,
+                         this->GeneratorTarget->Target->GetPostBuildCommands(),
                          this->GeneratorTarget);
 
   // Depend on the object files.
@@ -457,11 +457,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
   if(!relink)
     {
     this->LocalGenerator
-      ->AppendCustomCommands(commands, this->Target->GetPreBuildCommands(),
-                             this->GeneratorTarget);
+      ->AppendCustomCommands(commands,
+                        this->GeneratorTarget->Target->GetPreBuildCommands(),
+                        this->GeneratorTarget);
     this->LocalGenerator
-      ->AppendCustomCommands(commands, this->Target->GetPreLinkCommands(),
-                             this->GeneratorTarget);
+      ->AppendCustomCommands(commands,
+                        this->GeneratorTarget->Target->GetPreLinkCommands(),
+                        this->GeneratorTarget);
     }
 
   // Determine whether a link script will be used.
@@ -811,8 +813,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
   if(!relink)
     {
     this->LocalGenerator->
-      AppendCustomCommands(commands, this->Target->GetPostBuildCommands(),
-                           this->GeneratorTarget);
+      AppendCustomCommands(commands,
+                       this->GeneratorTarget->Target->GetPostBuildCommands(),
+                       this->GeneratorTarget);
     }
 
   // Compute the list of outputs.
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index b7970fd..7acccb3 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -18,7 +18,6 @@
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include "cmTarget.h"
 #include "cmake.h"
 #include "cmState.h"
 #include "cmComputeLinkInformation.h"
@@ -432,7 +431,7 @@ void cmMakefileTargetGenerator
   std::string srcFullPath =
     this->Convert(source.GetFullPath(), cmLocalGenerator::FULL);
   this->LocalGenerator->
-    AddImplicitDepends(*this->Target, lang,
+    AddImplicitDepends(this->GeneratorTarget, lang,
                        objFullPath.c_str(),
                        srcFullPath.c_str());
 }
@@ -1241,7 +1240,7 @@ void cmMakefileTargetGenerator
     std::string srcFullPath =
       this->Convert(idi->second, cmLocalGenerator::FULL);
     this->LocalGenerator->
-      AddImplicitDepends(*this->Target, idi->first,
+      AddImplicitDepends(this->GeneratorTarget, idi->first,
                          objFullPath.c_str(),
                          srcFullPath.c_str());
     }
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index e38c50b..38f40c0 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -24,7 +24,6 @@ class cmGeneratedFileStream;
 class cmGlobalUnixMakefileGenerator3;
 class cmLocalUnixMakefileGenerator3;
 class cmMakefile;
-class cmTarget;
 class cmSourceFile;
 
 /** \class cmMakefileTargetGenerator
@@ -51,7 +50,6 @@ public:
   std::string GetProgressFileNameFull()
     { return this->ProgressFileNameFull; }
 
-  cmTarget* GetTarget() { return this->Target;}
   cmGeneratorTarget* GetGeneratorTarget() { return this->GeneratorTarget;}
 
 protected:
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index 11601c5..d35c3ae 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -16,7 +16,6 @@
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include "cmTarget.h"
 
 //----------------------------------------------------------------------------
 cmMakefileUtilityTargetGenerator
@@ -68,19 +67,21 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
 
   // Utility targets store their rules in pre- and post-build commands.
   this->LocalGenerator->AppendCustomDepends
-    (depends, this->Target->GetPreBuildCommands());
+    (depends, this->GeneratorTarget->Target->GetPreBuildCommands());
 
   this->LocalGenerator->AppendCustomDepends
-    (depends, this->Target->GetPostBuildCommands());
+    (depends, this->GeneratorTarget->Target->GetPostBuildCommands());
 
   this->LocalGenerator->AppendCustomCommands
-    (commands, this->Target->GetPreBuildCommands(), this->GeneratorTarget);
+    (commands, this->GeneratorTarget->Target->GetPreBuildCommands(),
+     this->GeneratorTarget);
 
   // Depend on all custom command outputs for sources
   this->DriveCustomCommands(depends);
 
   this->LocalGenerator->AppendCustomCommands
-    (commands, this->Target->GetPostBuildCommands(), this->GeneratorTarget);
+    (commands, this->GeneratorTarget->Target->GetPostBuildCommands(),
+     this->GeneratorTarget);
 
   // Add dependencies on targets that must be built first.
   this->AppendTargetDepends(depends);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0546c7fa0c379c154b0da606ff38b815cf3da25c
commit 0546c7fa0c379c154b0da606ff38b815cf3da25c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Oct 18 23:13:50 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 21 21:59:56 2015 +0200

    Ninja: Port to cmGeneratorTarget.

diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 6e650ce..2671f4d 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -886,7 +886,7 @@ void cmGlobalNinjaGenerator::WriteDisclaimer(std::ostream& os)
     << cmVersion::GetMinorVersion() << "\n\n";
 }
 
-void cmGlobalNinjaGenerator::AddDependencyToAll(cmTarget* target)
+void cmGlobalNinjaGenerator::AddDependencyToAll(cmGeneratorTarget* target)
 {
   this->AppendTargetOutputs(target, this->AllDependencies);
 }
@@ -912,18 +912,16 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
 
 void
 cmGlobalNinjaGenerator
-::AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs)
+::AppendTargetOutputs(cmGeneratorTarget const* target, cmNinjaDeps& outputs)
 {
   std::string configName =
-    target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
-
-  cmGeneratorTarget *gtgt = this->GetGeneratorTarget(target);
+    target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
 
   // for frameworks, we want the real name, not smple name
   // frameworks always appear versioned, and the build.ninja
   // will always attempt to manage symbolic links instead
   // of letting cmOSXBundleGenerator do it.
-  bool realname = gtgt->IsFrameworkOnApple();
+  bool realname = target->IsFrameworkOnApple();
 
   switch (target->GetType()) {
   case cmState::EXECUTABLE:
@@ -932,7 +930,7 @@ cmGlobalNinjaGenerator
   case cmState::MODULE_LIBRARY:
     {
     outputs.push_back(this->ConvertToNinjaPath(
-      gtgt->GetFullPath(configName, false, realname)));
+      target->GetFullPath(configName, false, realname)));
     break;
     }
   case cmState::OBJECT_LIBRARY:
@@ -962,16 +960,15 @@ cmGlobalNinjaGenerator
 
 void
 cmGlobalNinjaGenerator
-::AppendTargetDepends(cmTarget const* target, cmNinjaDeps& outputs)
+::AppendTargetDepends(cmGeneratorTarget const* target, cmNinjaDeps& outputs)
 {
   if (target->GetType() == cmState::GLOBAL_TARGET) {
     // Global targets only depend on other utilities, which may not appear in
     // the TargetDepends set (e.g. "all").
-    std::set<std::string> const& utils = target->GetUtilities();
+    std::set<std::string> const& utils = target->Target->GetUtilities();
     std::copy(utils.begin(), utils.end(), std::back_inserter(outputs));
   } else {
-    cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
-    cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(gt);
+    cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target);
     for (cmTargetDependSet::const_iterator i = targetDeps.begin();
          i != targetDeps.end(); ++i)
       {
@@ -979,13 +976,13 @@ cmGlobalNinjaGenerator
         {
         continue;
         }
-      this->AppendTargetOutputs((*i)->Target, outputs);
+      this->AppendTargetOutputs(*i, outputs);
     }
   }
 }
 
 void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
-                                            cmTarget* target) {
+                                            cmGeneratorTarget* target) {
   cmNinjaDeps outputs;
   this->AppendTargetOutputs(target, outputs);
   // Mark the target's outputs as ambiguous to ensure that no other target uses
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 292f7c7..7547f16 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -285,9 +285,11 @@ public:
     ASD.insert(deps.begin(), deps.end());
   }
 
-  void AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs);
-  void AppendTargetDepends(cmTarget const* target, cmNinjaDeps& outputs);
-  void AddDependencyToAll(cmTarget* target);
+  void AppendTargetOutputs(cmGeneratorTarget const* target,
+                           cmNinjaDeps& outputs);
+  void AppendTargetDepends(cmGeneratorTarget const* target,
+                           cmNinjaDeps& outputs);
+  void AddDependencyToAll(cmGeneratorTarget* target);
   void AddDependencyToAll(const std::string& input);
 
   const std::vector<cmLocalGenerator*>& GetLocalGenerators() const {
@@ -299,7 +301,7 @@ public:
   int GetRuleCmdLength(const std::string& name) {
     return RuleCmdLength[name]; }
 
-  void AddTargetAlias(const std::string& alias, cmTarget* target);
+  void AddTargetAlias(const std::string& alias, cmGeneratorTarget* target);
 
   virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
 
@@ -388,7 +390,7 @@ private:
   /// The mapping from source file to assumed dependencies.
   std::map<std::string, std::set<std::string> > AssumedSourceDependencies;
 
-  typedef std::map<std::string, cmTarget*> TargetAliasMap;
+  typedef std::map<std::string, cmGeneratorTarget*> TargetAliasMap;
   TargetAliasMap TargetAliases;
 };
 
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 3dd18bd..891c44e 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -89,7 +89,7 @@ void cmLocalNinjaGenerator::Generate()
       if (!this->GetGlobalNinjaGenerator()->IsExcluded(
             this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0],
             *t))
-        this->GetGlobalNinjaGenerator()->AddDependencyToAll((*t)->Target);
+        this->GetGlobalNinjaGenerator()->AddDependencyToAll(*t);
       delete tg;
       }
     }
@@ -285,14 +285,14 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
 
 void
 cmLocalNinjaGenerator
-::AppendTargetOutputs(cmTarget* target, cmNinjaDeps& outputs)
+::AppendTargetOutputs(cmGeneratorTarget* target, cmNinjaDeps& outputs)
 {
   this->GetGlobalNinjaGenerator()->AppendTargetOutputs(target, outputs);
 }
 
 void
 cmLocalNinjaGenerator
-::AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs)
+::AppendTargetDepends(cmGeneratorTarget* target, cmNinjaDeps& outputs)
 {
   this->GetGlobalNinjaGenerator()->AppendTargetDepends(target, outputs);
 }
@@ -441,7 +441,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
 }
 
 void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc,
-                                                   cmTarget* target)
+                                                   cmGeneratorTarget* target)
 {
   this->CustomCommandTargets[cc].insert(target);
 }
@@ -459,7 +459,7 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
     //
     // FIXME: This won't work in certain obscure scenarios involving indirect
     // dependencies.
-    std::set<cmTarget*>::iterator j = i->second.begin();
+    std::set<cmGeneratorTarget*>::iterator j = i->second.begin();
     assert(j != i->second.end());
     std::vector<std::string> ccTargetDeps;
     this->AppendTargetDepends(*j, ccTargetDeps);
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index ce5f82d..b6987ef 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -58,10 +58,11 @@ public:
 
   std::string BuildCommandLine(const std::vector<std::string> &cmdLines);
 
-  void AppendTargetOutputs(cmTarget* target, cmNinjaDeps& outputs);
-  void AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs);
+  void AppendTargetOutputs(cmGeneratorTarget* target, cmNinjaDeps& outputs);
+  void AppendTargetDepends(cmGeneratorTarget* target, cmNinjaDeps& outputs);
 
-  void AddCustomCommandTarget(cmCustomCommand const* cc, cmTarget* target);
+  void AddCustomCommandTarget(cmCustomCommand const* cc,
+                              cmGeneratorTarget* target);
   void AppendCustomCommandLines(cmCustomCommandGenerator const& ccg,
                                 std::vector<std::string> &cmdLines);
   void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
@@ -102,7 +103,7 @@ private:
 
   std::string HomeRelativeOutputPath;
 
-  typedef std::map<cmCustomCommand const*, std::set<cmTarget*> >
+  typedef std::map<cmCustomCommand const*, std::set<cmGeneratorTarget*> >
     CustomCommandTargetMap;
   CustomCommandTargetMap CustomCommandTargets;
 };
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index dafbda9..b533d37 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -399,7 +399,6 @@ static int calculateCommandLineLengthLimit(int linkRuleLength)
 
 void cmNinjaNormalTargetGenerator::WriteLinkStatement()
 {
-  cmTarget& target = *this->GetTarget();
   cmGeneratorTarget& gt = *this->GetGeneratorTarget();
   const std::string cfgName = this->GetConfigName();
   std::string targetOutput = ConvertToNinjaPath(
@@ -443,7 +442,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
 
   // Write comments.
   cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream());
-  const cmState::TargetType targetType = target.GetType();
+  const cmState::TargetType targetType = gt.GetType();
   this->GetBuildFileStream()
     << "# Link build statements for "
     << cmState::GetTargetTypeName(targetType)
@@ -490,13 +489,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
                           &genTarget,
                           useWatcomQuote);
   if(this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")
-     && target.GetType() == cmState::SHARED_LIBRARY)
+     && gt.GetType() == cmState::SHARED_LIBRARY)
     {
-    if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
+    if(gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
       {
       std::string name_of_def_file
         = gt.GetSupportDirectory();
-      name_of_def_file += "/" + target.GetName();
+      name_of_def_file += "/" + gt.GetName();
       name_of_def_file += ".def ";
       vars["LINK_FLAGS"] += " /DEF:";
       vars["LINK_FLAGS"] += this->GetLocalGenerator()
@@ -505,7 +504,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
       }
     }
 
-  this->addPoolNinjaVariable("JOB_POOL_LINK", &target, vars);
+  this->addPoolNinjaVariable("JOB_POOL_LINK", &gt, vars);
 
   this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);
   vars["LINK_FLAGS"] = cmGlobalNinjaGenerator
@@ -599,9 +598,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
     }
 
   const std::vector<cmCustomCommand> *cmdLists[3] = {
-    &target.GetPreBuildCommands(),
-    &target.GetPreLinkCommands(),
-    &target.GetPostBuildCommands()
+    &gt.Target->GetPreBuildCommands(),
+    &gt.Target->GetPreLinkCommands(),
+    &gt.Target->GetPostBuildCommands()
   };
 
   std::vector<std::string> preLinkCmdLines, postBuildCmdLines;
@@ -626,17 +625,17 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
     }
 
   // maybe create .def file from list of objects
-  if (target.GetType() == cmState::SHARED_LIBRARY &&
+  if (gt.GetType() == cmState::SHARED_LIBRARY &&
       this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
     {
-    if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
+    if(gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
       {
       std::string cmakeCommand =
       this->GetLocalGenerator()->ConvertToOutputFormat(
         cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
       std::string name_of_def_file
         = gt.GetSupportDirectory();
-      name_of_def_file += "/" + target.GetName();
+      name_of_def_file += "/" + gt.GetName();
       name_of_def_file += ".def";
       std::string cmd = cmakeCommand;
       cmd += " -E __create_def ";
@@ -699,11 +698,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
 
   const std::string rspfile =
       std::string(cmake::GetCMakeFilesDirectoryPostSlash())
-      + target.GetName() + ".rsp";
+      + gt.GetName() + ".rsp";
 
   // Gather order-only dependencies.
   cmNinjaDeps orderOnlyDeps;
-  this->GetLocalGenerator()->AppendTargetDepends(this->GetTarget(),
+  this->GetLocalGenerator()->AppendTargetDepends(this->GetGeneratorTarget(),
     orderOnlyDeps);
 
   // Ninja should restat after linking if and only if there are byproducts.
@@ -772,8 +771,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
     }
 
   // Add aliases for the file name and the target name.
-  globalGen.AddTargetAlias(this->TargetNameOut, &target);
-  globalGen.AddTargetAlias(this->GetTargetName(), &target);
+  globalGen.AddTargetAlias(this->TargetNameOut, &gt);
+  globalGen.AddTargetAlias(this->GetTargetName(), &gt);
 }
 
 //----------------------------------------------------------------------------
@@ -781,7 +780,8 @@ void cmNinjaNormalTargetGenerator::WriteObjectLibStatement()
 {
   // Write a phony output that depends on all object files.
   cmNinjaDeps outputs;
-  this->GetLocalGenerator()->AppendTargetOutputs(this->GetTarget(), outputs);
+  this->GetLocalGenerator()->AppendTargetOutputs(this->GetGeneratorTarget(),
+                                                 outputs);
   cmNinjaDeps depends = this->GetObjects();
   this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
                                               "Object library "
@@ -791,5 +791,5 @@ void cmNinjaNormalTargetGenerator::WriteObjectLibStatement()
 
   // Add aliases for the target name.
   this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(),
-                                             this->GetTarget());
+                                             this->GetGeneratorTarget());
 }
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index b018005..dc2c7a6 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -486,7 +486,8 @@ cmNinjaTargetGenerator
       si != customCommands.end(); ++si)
      {
      cmCustomCommand const* cc = (*si)->GetCustomCommand();
-     this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
+     this->GetLocalGenerator()->AddCustomCommandTarget(cc,
+         this->GetGeneratorTarget());
      // Record the custom commands for this target. The container is used
      // in WriteObjectBuildStatement when called in a loop below.
      this->CustomCommands.push_back(cc);
@@ -511,7 +512,8 @@ cmNinjaTargetGenerator
     }
 
   cmNinjaDeps orderOnlyDeps;
-  this->GetLocalGenerator()->AppendTargetDepends(this->Target, orderOnlyDeps);
+  this->GetLocalGenerator()->AppendTargetDepends(this->GeneratorTarget,
+                                                 orderOnlyDeps);
 
   // Add order-only dependencies on custom command outputs.
   for(std::vector<cmCustomCommand const*>::const_iterator
@@ -633,7 +635,8 @@ cmNinjaTargetGenerator
                               ConvertToNinjaPath(objectFileDir),
                               cmLocalGenerator::SHELL);
 
-  this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetTarget(), vars);
+  this->addPoolNinjaVariable("JOB_POOL_COMPILE",
+                             this->GetGeneratorTarget(), vars);
 
   this->SetMsvcTargetPdbVariable(vars);
 
@@ -782,7 +785,7 @@ cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
 
 void cmNinjaTargetGenerator::addPoolNinjaVariable(
                                               const std::string& pool_property,
-                                              cmTarget* target,
+                                              cmGeneratorTarget* target,
                                               cmNinjaVars& vars)
 {
     const char* pool = target->GetProperty(pool_property);
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 0267f63..e3ec423 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -53,9 +53,6 @@ protected:
   cmGeneratedFileStream& GetBuildFileStream() const;
   cmGeneratedFileStream& GetRulesFileStream() const;
 
-  cmTarget* GetTarget() const
-  { return this->Target; }
-
   cmGeneratorTarget* GetGeneratorTarget() const
   { return this->GeneratorTarget; }
 
@@ -152,7 +149,7 @@ protected:
   std::set<std::string> MacContentFolders;
 
   void addPoolNinjaVariable(const std::string& pool_property,
-                            cmTarget* target,
+                            cmGeneratorTarget* target,
                             cmNinjaVars& vars);
 
 private:
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index 5bbe268..b2a5334 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -16,7 +16,6 @@
 #include "cmGlobalNinjaGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include "cmTarget.h"
 #include "cmCustomCommandGenerator.h"
 
 cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator(
@@ -34,8 +33,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
   cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName);
 
   const std::vector<cmCustomCommand> *cmdLists[2] = {
-    &this->GetTarget()->GetPreBuildCommands(),
-    &this->GetTarget()->GetPostBuildCommands()
+    &this->GetGeneratorTarget()->Target->GetPreBuildCommands(),
+    &this->GetGeneratorTarget()->Target->GetPostBuildCommands()
   };
 
   bool uses_terminal = false;
@@ -66,7 +65,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
       {
       cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
                                    this->GetLocalGenerator());
-      this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
+      this->GetLocalGenerator()->AddCustomCommandTarget(cc,
+          this->GetGeneratorTarget());
 
       // Depend on all custom command outputs.
       const std::vector<std::string>& ccOutputs = ccg.GetOutputs();
@@ -78,8 +78,10 @@ void cmNinjaUtilityTargetGenerator::Generate()
       }
     }
 
-  this->GetLocalGenerator()->AppendTargetOutputs(this->GetTarget(), outputs);
-  this->GetLocalGenerator()->AppendTargetDepends(this->GetTarget(), deps);
+  this->GetLocalGenerator()->AppendTargetOutputs(this->GetGeneratorTarget(),
+                                                 outputs);
+  this->GetLocalGenerator()->AppendTargetDepends(this->GetGeneratorTarget(),
+                                                 deps);
 
   if (commands.empty()) {
     this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
@@ -140,5 +142,5 @@ void cmNinjaUtilityTargetGenerator::Generate()
   }
 
   this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(),
-                                             this->GetTarget());
+                                             this->GetGeneratorTarget());
 }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ca72f3ce24edb8959a2d622c5fc34139e6b81fd4
commit ca72f3ce24edb8959a2d622c5fc34139e6b81fd4
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 21 19:59:12 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 21 21:59:56 2015 +0200

    Use cmLocalGenerator at generate-time.

diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 6920faf..2c47ab2 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -123,7 +123,7 @@ std::string cmCommonTargetGenerator::ComputeFortranModuleDirectory() const
     else
       {
       // Interpret relative to the current output directory.
-      mod_dir = this->Makefile->GetCurrentBinaryDirectory();
+      mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory();
       mod_dir += "/";
       mod_dir += target_mod_dir;
       }
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 1a84625..d52ce35 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -456,13 +456,13 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
 
   if (cge->GetHadContextSensitiveCondition())
     {
-    cmMakefile* mf = target->Target->GetMakefile();
+    cmLocalGenerator* lg = target->GetLocalGenerator();
     std::ostringstream e;
     e << "Target \"" << target->GetName() << "\" is installed with "
     "INCLUDES DESTINATION set to a context sensitive path.  Paths which "
     "depend on the configuration, policy values or the link interface are "
     "not supported.  Consider using target_include_directories instead.";
-    mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+    lg->IssueMessage(cmake::FATAL_ERROR, e.str());
     return;
     }
 
@@ -535,11 +535,11 @@ void getCompatibleInterfaceProperties(cmGeneratorTarget *target,
 
   if (!info)
     {
-    cmMakefile* mf = target->Target->GetMakefile();
+    cmLocalGenerator* lg = target->GetLocalGenerator();
     std::ostringstream e;
     e << "Exporting the target \"" << target->GetName() << "\" is not "
         "allowed since its linker language cannot be determined";
-    mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+    lg->IssueMessage(cmake::FATAL_ERROR, e.str());
     return;
     }
 
@@ -835,13 +835,13 @@ cmExportFileGenerator
 
   if(newCMP0022Behavior && !this->ExportOld)
     {
-    cmMakefile *mf = target->Target->GetMakefile();
+    cmLocalGenerator *lg = target->GetLocalGenerator();
     std::ostringstream e;
     e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, "
          "but also has old-style LINK_INTERFACE_LIBRARIES properties "
          "populated, but it was exported without the "
          "EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties";
-    mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+    lg->IssueMessage(cmake::FATAL_ERROR, e.str());
     return;
     }
 
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 89a6dff..6e650ce 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -719,7 +719,7 @@ void cmGlobalNinjaGenerator
 {
   // Compute full path to object file directory for this target.
   std::string dir;
-  dir += gt->Makefile->GetCurrentBinaryDirectory();
+  dir += gt->LocalGenerator->GetCurrentBinaryDirectory();
   dir += "/";
   dir += gt->LocalGenerator->GetTargetDirectory(gt);
   dir += "/";
@@ -938,7 +938,7 @@ cmGlobalNinjaGenerator
   case cmState::OBJECT_LIBRARY:
   case cmState::UTILITY: {
     std::string path = this->ConvertToNinjaPath(
-      target->GetMakefile()->GetCurrentBinaryDirectory());
+      target->GetLocalGenerator()->GetCurrentBinaryDirectory());
     if (path.empty() || path == ".")
       outputs.push_back(target->GetName());
     else {
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 2a5b153..4d7ca25 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -116,7 +116,7 @@ cmGlobalUnixMakefileGenerator3
 {
   // Compute full path to object file directory for this target.
   std::string dir;
-  dir += gt->Makefile->GetCurrentBinaryDirectory();
+  dir += gt->LocalGenerator->GetCurrentBinaryDirectory();
   dir += "/";
   dir += gt->LocalGenerator->GetTargetDirectory(gt);
   dir += "/";
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 7a10356..59d06f6 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -76,7 +76,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
   if(this->Target->NeedRelinkBeforeInstall(config))
     {
     fromDirConfig =
-        this->Target->Target->GetMakefile()->GetCurrentBinaryDirectory();
+        this->Target->GetLocalGenerator()->GetCurrentBinaryDirectory();
     fromDirConfig += cmake::GetCMakeFilesDirectory();
     fromDirConfig += "/CMakeRelink.dir/";
     }
@@ -111,7 +111,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
     case cmState::UTILITY:
     case cmState::GLOBAL_TARGET:
     case cmState::UNKNOWN_LIBRARY:
-      this->Target->Target->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR,
+      this->Target->GetLocalGenerator()->IssueMessage(cmake::INTERNAL_ERROR,
         "cmInstallTargetGenerator created with non-installable target.");
       return;
     }
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2166c09..c37417d 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2140,7 +2140,7 @@ void cmLocalGenerator
       "has the following visibility properties set for " << lang << ":\n" <<
       warnCMP0063 <<
       "For compatibility CMake is not honoring them for this target.";
-    target->Target->GetMakefile()->GetCMakeInstance()
+    target->GetLocalGenerator()->GetCMakeInstance()
       ->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
                      target->GetBacktrace());
     }
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index dae8aaf..e9dc9ff 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -188,7 +188,7 @@ GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
                                     ->GetSafeDefinition("CMAKE_BUILD_TYPE"));
     // Compute full path to object file directory for this target.
     std::string dir;
-    dir += gt->Makefile->GetCurrentBinaryDirectory();
+    dir += gt->LocalGenerator->GetCurrentBinaryDirectory();
     dir += "/";
     dir += this->GetTargetDirectory(gt);
     dir += "/";

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b45d4a883d10a8b3cd2ddfa2fc9fcbdfffbe8187
commit b45d4a883d10a8b3cd2ddfa2fc9fcbdfffbe8187
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Oct 18 17:06:14 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 21 21:59:55 2015 +0200

    Port to GetGeneratorTargets.

diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 03f4fdd..113c989 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -175,13 +175,12 @@ void cmComputeTargetDepends::CollectTargets()
     this->GlobalGenerator->GetLocalGenerators();
   for(unsigned int i = 0; i < lgens.size(); ++i)
     {
-    const cmTargets& targets = lgens[i]->GetMakefile()->GetTargets();
-    for(cmTargets::const_iterator ti = targets.begin();
+    const std::vector<cmGeneratorTarget*> targets =
+        lgens[i]->GetGeneratorTargets();
+    for(std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin();
         ti != targets.end(); ++ti)
       {
-      cmTarget const* target = &ti->second;
-      cmGeneratorTarget* gt =
-          this->GlobalGenerator->GetGeneratorTarget(target);
+      cmGeneratorTarget* gt = *ti;
       int index = static_cast<int>(this->Targets.size());
       this->TargetIndex[gt] = index;
       this->Targets.push_back(gt);
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 3bc76fa..a71b1cb 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -319,12 +319,12 @@ void cmExtraCodeBlocksGenerator
   for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
        lg!=lgs.end(); lg++)
     {
-    cmMakefile* makefile=(*lg)->GetMakefile();
-    cmTargets& targets=makefile->GetTargets();
-    for (cmTargets::iterator ti = targets.begin();
+    std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
          ti != targets.end(); ti++)
       {
-      switch(ti->second.GetType())
+      std::string targetName = (*ti)->GetName();
+      switch((*ti)->GetType())
         {
         case cmState::GLOBAL_TARGET:
           {
@@ -333,7 +333,7 @@ void cmExtraCodeBlocksGenerator
           if (strcmp((*lg)->GetCurrentBinaryDirectory(),
                      (*lg)->GetBinaryDirectory())==0)
             {
-            this->AppendTarget(fout, ti->first, 0,
+            this->AppendTarget(fout, targetName, 0,
                                make.c_str(), *lg, compiler.c_str());
             }
           }
@@ -341,15 +341,16 @@ void cmExtraCodeBlocksGenerator
         case cmState::UTILITY:
           // Add all utility targets, except the Nightly/Continuous/
           // Experimental-"sub"targets as e.g. NightlyStart
-          if (((ti->first.find("Nightly")==0)   &&(ti->first!="Nightly"))
-             || ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous"))
-             || ((ti->first.find("Experimental")==0)
-                                               && (ti->first!="Experimental")))
+          if (((targetName.find("Nightly")==0)   &&(targetName!="Nightly"))
+             || ((targetName.find("Continuous")==0)
+                 &&(targetName!="Continuous"))
+             || ((targetName.find("Experimental")==0)
+                                             && (targetName!="Experimental")))
             {
             break;
             }
 
-          this->AppendTarget(fout, ti->first, 0,
+          this->AppendTarget(fout, targetName, 0,
                                  make.c_str(), *lg, compiler.c_str());
           break;
         case cmState::EXECUTABLE:
@@ -358,11 +359,10 @@ void cmExtraCodeBlocksGenerator
         case cmState::MODULE_LIBRARY:
         case cmState::OBJECT_LIBRARY:
           {
-          cmGeneratorTarget* gt =
-              this->GlobalGenerator->GetGeneratorTarget(&ti->second);
-          this->AppendTarget(fout, ti->first, gt,
+          cmGeneratorTarget* gt = *ti;
+          this->AppendTarget(fout, targetName, gt,
                              make.c_str(), *lg, compiler.c_str());
-          std::string fastTarget = ti->first;
+          std::string fastTarget = targetName;
           fastTarget += "/fast";
           this->AppendTarget(fout, fastTarget, gt,
                              make.c_str(), *lg, compiler.c_str());
@@ -388,11 +388,11 @@ void cmExtraCodeBlocksGenerator
        lg!=lgs.end(); lg++)
     {
     cmMakefile* makefile=(*lg)->GetMakefile();
-    cmTargets& targets=makefile->GetTargets();
-    for (cmTargets::iterator ti = targets.begin();
+    std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
          ti != targets.end(); ti++)
       {
-      switch(ti->second.GetType())
+      switch((*ti)->GetType())
         {
         case cmState::EXECUTABLE:
         case cmState::STATIC_LIBRARY:
@@ -402,8 +402,7 @@ void cmExtraCodeBlocksGenerator
         case cmState::UTILITY: // can have sources since 2.6.3
           {
           std::vector<cmSourceFile*> sources;
-          cmGeneratorTarget* gt =
-              this->GlobalGenerator->GetGeneratorTarget(&ti->second);
+          cmGeneratorTarget* gt = *ti;
           gt->GetSourceFiles(sources,
                             makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
           for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
@@ -442,7 +441,7 @@ void cmExtraCodeBlocksGenerator
               }
 
             CbpUnit &cbpUnit = allFiles[fullPath];
-            cbpUnit.Targets.push_back(&(ti->second));
+            cbpUnit.Targets.push_back((*ti)->Target);
             }
           }
         default:  // intended fallthrough
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index 10f33be..f4a6537 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -155,12 +155,12 @@ void cmExtraCodeLiteGenerator
        lg!=lgs.end(); lg++)
     {
     cmMakefile* makefile=(*lg)->GetMakefile();
-    cmTargets& targets=makefile->GetTargets();
-    for (cmTargets::iterator ti = targets.begin();
+    std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
          ti != targets.end(); ti++)
       {
 
-      switch(ti->second.GetType())
+      switch((*ti)->GetType())
         {
         case cmState::EXECUTABLE:
           {
@@ -186,7 +186,7 @@ void cmExtraCodeLiteGenerator
           break;
         }
 
-      switch(ti->second.GetType())
+      switch((*ti)->GetType())
         {
         case cmState::EXECUTABLE:
         case cmState::STATIC_LIBRARY:
@@ -194,8 +194,7 @@ void cmExtraCodeLiteGenerator
         case cmState::MODULE_LIBRARY:
           {
           std::vector<cmSourceFile*> sources;
-          cmGeneratorTarget* gt =
-              this->GlobalGenerator->GetGeneratorTarget(&ti->second);
+          cmGeneratorTarget* gt = *ti;
           gt->GetSourceFiles(sources,
                             makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
           for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 1921f03..aedf6f4 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -536,13 +536,15 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
        ++lgIt)
     {
     cmMakefile* makefile = (*lgIt)->GetMakefile();
-    const cmTargets& targets = makefile->GetTargets();
+    const std::vector<cmGeneratorTarget*> targets =
+        (*lgIt)->GetGeneratorTargets();
 
-    for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end();++ti)
+    for(std::vector<cmGeneratorTarget*>::const_iterator ti=targets.begin();
+        ti!=targets.end();++ti)
       {
       std::string linkName2 = linkName;
       linkName2 += "/";
-      switch(ti->second.GetType())
+      switch((*ti)->GetType())
         {
         case cmState::EXECUTABLE:
         case cmState::STATIC_LIBRARY:
@@ -550,10 +552,10 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
         case cmState::MODULE_LIBRARY:
         case cmState::OBJECT_LIBRARY:
           {
-          const char* prefix = (ti->second.GetType()==cmState::EXECUTABLE ?
+          const char* prefix = ((*ti)->GetType()==cmState::EXECUTABLE ?
                                                           "[exe] " : "[lib] ");
           linkName2 += prefix;
-          linkName2 += ti->first;
+          linkName2 += (*ti)->GetName();
           this->AppendLinkedResource(fout, linkName2, "virtual:/virtual",
                                      VirtualFolder);
           if (!this->GenerateLinkedResources)
@@ -562,10 +564,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
             }
           std::vector<cmSourceGroup> sourceGroups=makefile->GetSourceGroups();
           // get the files from the source lists then add them to the groups
-          cmTarget* tgt = const_cast<cmTarget*>(&ti->second);
+          cmGeneratorTarget* gt = const_cast<cmGeneratorTarget*>(*ti);
           std::vector<cmSourceFile*> files;
-          cmGeneratorTarget* gt =
-              this->GlobalGenerator->GetGeneratorTarget(tgt);
           gt->GetSourceFiles(files,
                             makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
           for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin();
@@ -1030,7 +1030,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
        it != this->GlobalGenerator->GetLocalGenerators().end();
        ++it)
     {
-    const cmTargets& targets = (*it)->GetMakefile()->GetTargets();
+    const std::vector<cmGeneratorTarget*> targets =
+        (*it)->GetGeneratorTargets();
     std::string subdir = (*it)->Convert((*it)->GetCurrentBinaryDirectory(),
                            cmLocalGenerator::HOME_OUTPUT);
     if (subdir == ".")
@@ -1038,9 +1039,11 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
       subdir = "";
       }
 
-    for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti)
+    for(std::vector<cmGeneratorTarget*>::const_iterator ti =
+        targets.begin(); ti!=targets.end(); ++ti)
       {
-      switch(ti->second.GetType())
+      std::string targetName = (*ti)->GetName();
+      switch((*ti)->GetType())
         {
         case cmState::GLOBAL_TARGET:
           {
@@ -1048,22 +1051,22 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
           // not from the subdirs
           if (subdir.empty())
            {
-           this->AppendTarget(fout, ti->first, make, makeArgs, subdir, ": ");
+           this->AppendTarget(fout, targetName, make, makeArgs, subdir, ": ");
            }
          }
          break;
        case cmState::UTILITY:
          // Add all utility targets, except the Nightly/Continuous/
          // Experimental-"sub"targets as e.g. NightlyStart
-         if (((ti->first.find("Nightly")==0)   &&(ti->first!="Nightly"))
-          || ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous"))
-          || ((ti->first.find("Experimental")==0)
-                                            && (ti->first!="Experimental")))
+         if (((targetName.find("Nightly")==0)   &&(targetName!="Nightly"))
+          || ((targetName.find("Continuous")==0)&&(targetName!="Continuous"))
+          || ((targetName.find("Experimental")==0)
+                                            && (targetName!="Experimental")))
            {
            break;
            }
 
-         this->AppendTarget(fout, ti->first, make, makeArgs, subdir, ": ");
+         this->AppendTarget(fout, targetName, make, makeArgs, subdir, ": ");
          break;
        case cmState::EXECUTABLE:
        case cmState::STATIC_LIBRARY:
@@ -1071,10 +1074,10 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
        case cmState::MODULE_LIBRARY:
        case cmState::OBJECT_LIBRARY:
          {
-         const char* prefix = (ti->second.GetType()==cmState::EXECUTABLE ?
+         const char* prefix = ((*ti)->GetType()==cmState::EXECUTABLE ?
                                                           "[exe] " : "[lib] ");
-         this->AppendTarget(fout, ti->first, make, makeArgs, subdir, prefix);
-         std::string fastTarget = ti->first;
+         this->AppendTarget(fout, targetName, make, makeArgs, subdir, prefix);
+         std::string fastTarget = targetName;
          fastTarget += "/fast";
          this->AppendTarget(fout, fastTarget, make, makeArgs, subdir, prefix);
 
@@ -1083,21 +1086,20 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
           {
           std::string virtDir = "[Targets]/";
           virtDir += prefix;
-          virtDir += ti->first;
+          virtDir += targetName;
           std::string buildArgs = "-C \"";
           buildArgs += (*it)->GetBinaryDirectory();
           buildArgs += "\" ";
           buildArgs += makeArgs;
           this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "",
-                             ti->first.c_str());
+                             targetName.c_str());
 
           std::string cleanArgs = "-E chdir \"";
           cleanArgs += (*it)->GetCurrentBinaryDirectory();
           cleanArgs += "\" \"";
           cleanArgs += cmSystemTools::GetCMakeCommand();
           cleanArgs += "\" -P \"";
-          cmGeneratorTarget* gt =
-              this->GlobalGenerator->GetGeneratorTarget(&ti->second);
+          cmGeneratorTarget* gt = *ti;
           cleanArgs += (*it)->GetTargetDirectory(gt);
           cleanArgs += "/cmake_clean.cmake\"";
           this->AppendTarget(fout, "Clean", cmSystemTools::GetCMakeCommand(),
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index dc6421b..1741acf 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -119,14 +119,16 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
        it != this->GlobalGenerator->GetLocalGenerators().end();
        ++it)
     {
-    const cmTargets& targets = (*it)->GetMakefile()->GetTargets();
-    cmMakefile* makefile=(*it)->GetMakefile();
+    const std::vector<cmGeneratorTarget*> targets =
+        (*it)->GetGeneratorTargets();
     std::string currentDir = (*it)->GetCurrentBinaryDirectory();
     bool topLevel = (currentDir == (*it)->GetBinaryDirectory());
 
-    for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti)
+    for(std::vector<cmGeneratorTarget*>::const_iterator ti =
+        targets.begin(); ti!=targets.end(); ++ti)
       {
-      switch(ti->second.GetType())
+      std::string targetName = (*ti)->GetName();
+      switch((*ti)->GetType())
         {
         case cmState::GLOBAL_TARGET:
           {
@@ -138,9 +140,9 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
             insertTarget = true;
             // only add the "edit_cache" target if it's not ccmake, because
             // this will not work within the IDE
-            if (ti->first == "edit_cache")
+            if (targetName == "edit_cache")
               {
-              const char* editCommand = makefile->GetDefinition
+              const char* editCommand = (*it)->GetMakefile()->GetDefinition
               ("CMAKE_EDIT_COMMAND");
               if (editCommand == 0)
                 {
@@ -154,7 +156,7 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
             }
           if (insertTarget)
             {
-            this->AppendTarget(fout, ti->first, make, makeArgs,
+            this->AppendTarget(fout, targetName, make, makeArgs,
                                currentDir, homeOutputDir);
             }
         }
@@ -162,15 +164,16 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
         case cmState::UTILITY:
           // Add all utility targets, except the Nightly/Continuous/
           // Experimental-"sub"targets as e.g. NightlyStart
-          if (((ti->first.find("Nightly")==0)   &&(ti->first!="Nightly"))
-            || ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous"))
-            || ((ti->first.find("Experimental")==0)
-            && (ti->first!="Experimental")))
+          if (((targetName.find("Nightly")==0)   &&(targetName!="Nightly"))
+            || ((targetName.find("Continuous")==0)
+                &&(targetName!="Continuous"))
+            || ((targetName.find("Experimental")==0)
+            && (targetName!="Experimental")))
             {
               break;
             }
 
-            this->AppendTarget(fout, ti->first, make, makeArgs,
+            this->AppendTarget(fout, targetName, make, makeArgs,
                                currentDir, homeOutputDir);
           break;
         case cmState::EXECUTABLE:
@@ -179,9 +182,9 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
         case cmState::MODULE_LIBRARY:
         case cmState::OBJECT_LIBRARY:
         {
-          this->AppendTarget(fout, ti->first, make, makeArgs,
+          this->AppendTarget(fout, targetName, make, makeArgs,
                              currentDir, homeOutputDir);
-          std::string fastTarget = ti->first;
+          std::string fastTarget = targetName;
           fastTarget += "/fast";
           this->AppendTarget(fout, fastTarget, make, makeArgs,
                              currentDir, homeOutputDir);
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index ac0202b..47822e8 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -162,11 +162,12 @@ void cmExtraSublimeTextGenerator::
        lg!=lgs.end(); lg++)
     {
     cmMakefile* makefile=(*lg)->GetMakefile();
-    cmTargets& targets=makefile->GetTargets();
-    for (cmTargets::iterator ti = targets.begin();
+    std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
          ti != targets.end(); ti++)
       {
-      switch(ti->second.GetType())
+      std::string targetName = (*ti)->GetName();
+      switch((*ti)->GetType())
         {
         case cmState::GLOBAL_TARGET:
           {
@@ -175,7 +176,7 @@ void cmExtraSublimeTextGenerator::
           if (strcmp((*lg)->GetCurrentBinaryDirectory(),
                      (*lg)->GetBinaryDirectory())==0)
             {
-            this->AppendTarget(fout, ti->first, *lg, 0,
+            this->AppendTarget(fout, targetName, *lg, 0,
                                make.c_str(), makefile, compiler.c_str(),
                                sourceFileFlags, false);
             }
@@ -184,15 +185,16 @@ void cmExtraSublimeTextGenerator::
         case cmState::UTILITY:
           // Add all utility targets, except the Nightly/Continuous/
           // Experimental-"sub"targets as e.g. NightlyStart
-          if (((ti->first.find("Nightly")==0)   &&(ti->first!="Nightly"))
-             || ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous"))
-             || ((ti->first.find("Experimental")==0)
-                                               && (ti->first!="Experimental")))
+          if (((targetName.find("Nightly")==0)   &&(targetName!="Nightly"))
+             || ((targetName.find("Continuous")==0)
+                 &&(targetName!="Continuous"))
+             || ((targetName.find("Experimental")==0)
+                 && (targetName!="Experimental")))
             {
             break;
             }
 
-          this->AppendTarget(fout, ti->first, *lg, 0,
+          this->AppendTarget(fout, targetName, *lg, 0,
                              make.c_str(), makefile, compiler.c_str(),
                              sourceFileFlags, false);
           break;
@@ -202,12 +204,12 @@ void cmExtraSublimeTextGenerator::
         case cmState::MODULE_LIBRARY:
         case cmState::OBJECT_LIBRARY:
           {
-          this->AppendTarget(fout, ti->first, *lg, &ti->second,
+          this->AppendTarget(fout, targetName, *lg, (*ti)->Target,
                              make.c_str(), makefile, compiler.c_str(),
                              sourceFileFlags, false);
-          std::string fastTarget = ti->first;
+          std::string fastTarget = targetName;
           fastTarget += "/fast";
-          this->AppendTarget(fout, fastTarget, *lg, &ti->second,
+          this->AppendTarget(fout, fastTarget, *lg, (*ti)->Target,
                              make.c_str(), makefile, compiler.c_str(),
                              sourceFileFlags, false);
           }
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 13efc4c..d26cc34 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1468,34 +1468,34 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
 #ifdef CMAKE_BUILD_WITH_CMAKE
   for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
     {
-    cmTargets& targets =
-      this->LocalGenerators[i]->GetMakefile()->GetTargets();
+    std::vector<cmGeneratorTarget*> targets =
+      this->LocalGenerators[i]->GetGeneratorTargets();
     std::vector<cmGeneratorTarget*> filteredTargets;
     filteredTargets.reserve(targets.size());
-    for(cmTargets::iterator ti = targets.begin();
+    for(std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
         ti != targets.end(); ++ti)
       {
-      if (ti->second.GetType() == cmState::GLOBAL_TARGET)
+      if ((*ti)->GetType() == cmState::GLOBAL_TARGET)
         {
         continue;
         }
-      if(ti->second.GetType() != cmState::EXECUTABLE &&
-         ti->second.GetType() != cmState::STATIC_LIBRARY &&
-         ti->second.GetType() != cmState::SHARED_LIBRARY &&
-         ti->second.GetType() != cmState::MODULE_LIBRARY &&
-         ti->second.GetType() != cmState::OBJECT_LIBRARY)
+      if((*ti)->GetType() != cmState::EXECUTABLE &&
+         (*ti)->GetType() != cmState::STATIC_LIBRARY &&
+         (*ti)->GetType() != cmState::SHARED_LIBRARY &&
+         (*ti)->GetType() != cmState::MODULE_LIBRARY &&
+         (*ti)->GetType() != cmState::OBJECT_LIBRARY)
         {
         continue;
         }
-      if((!ti->second.GetPropertyAsBool("AUTOMOC")
-            && !ti->second.GetPropertyAsBool("AUTOUIC")
-            && !ti->second.GetPropertyAsBool("AUTORCC"))
-          || ti->second.IsImported())
+      if((!(*ti)->GetPropertyAsBool("AUTOMOC")
+            && !(*ti)->GetPropertyAsBool("AUTOUIC")
+            && !(*ti)->GetPropertyAsBool("AUTORCC"))
+          || (*ti)->IsImported())
         {
         continue;
         }
       // don't do anything if there is no Qt4 or Qt5Core (which contains moc):
-      cmMakefile* mf = ti->second.GetMakefile();
+      cmMakefile* mf = (*ti)->Target->GetMakefile();
       std::string qtMajorVersion = mf->GetSafeDefinition("QT_VERSION_MAJOR");
       if (qtMajorVersion == "")
         {
@@ -1506,7 +1506,7 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
         continue;
         }
 
-      cmGeneratorTarget* gt = this->GetGeneratorTarget(&ti->second);
+      cmGeneratorTarget* gt = *ti;
 
       cmQtAutoGeneratorInitializer::InitializeAutogenSources(gt);
       filteredTargets.push_back(gt);
@@ -2706,23 +2706,22 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
       {
       continue;
       }
-    cmMakefile* mf = (*i)->GetMakefile();
     // Get the targets in the makefile
-    cmTargets &tgts = mf->GetTargets();
+    std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets();
     // loop over all the targets
-    for (cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
+    for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+         l != tgts.end(); ++l)
       {
-      cmTarget* target = &l->second;
-      cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
-      if(this->IsRootOnlyTarget(gt) &&
-         target->GetMakefile() != root->GetMakefile())
+      cmGeneratorTarget* target = *l;
+      if(this->IsRootOnlyTarget(target) &&
+         target->GetLocalGenerator() != root)
         {
         continue;
         }
       // put the target in the set of original targets
-      originalTargets.insert(gt);
+      originalTargets.insert(target);
       // Get the set of targets that depend on target
-      this->AddTargetDepends(gt, projectTargets);
+      this->AddTargetDepends(target, projectTargets);
       }
     }
 }
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index 8659e34..7c6c48c 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -133,14 +133,13 @@ bool cmGlobalKdevelopGenerator
       }
 
     //get all sources
-    cmTargets& targets=makefile->GetTargets();
-    for (cmTargets::iterator ti = targets.begin();
+    std::vector<cmGeneratorTarget*> targets=(*it)->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
          ti != targets.end(); ti++)
       {
       std::vector<cmSourceFile*> sources;
-      cmGeneratorTarget* gt =
-          this->GlobalGenerator->GetGeneratorTarget(&ti->second);
-      gt->GetSourceFiles(sources, ti->second.GetMakefile()
+      cmGeneratorTarget* gt = *ti;
+      gt->GetSourceFiles(sources, gt->Target->GetMakefile()
                                     ->GetSafeDefinition("CMAKE_BUILD_TYPE"));
       for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
            si!=sources.end(); si++)
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 248701a..2a5b153 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -423,17 +423,18 @@ void cmGlobalUnixMakefileGenerator3
     {
     lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]);
     // for all of out targets
-    for (cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin();
-         l != lg->GetMakefile()->GetTargets().end(); l++)
+    std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+         l != tgts.end(); l++)
       {
-      if((l->second.GetType() == cmState::EXECUTABLE) ||
-         (l->second.GetType() == cmState::STATIC_LIBRARY) ||
-         (l->second.GetType() == cmState::SHARED_LIBRARY) ||
-         (l->second.GetType() == cmState::MODULE_LIBRARY) ||
-         (l->second.GetType() == cmState::OBJECT_LIBRARY) ||
-         (l->second.GetType() == cmState::UTILITY))
+      if(((*l)->GetType() == cmState::EXECUTABLE) ||
+         ((*l)->GetType() == cmState::STATIC_LIBRARY) ||
+         ((*l)->GetType() == cmState::SHARED_LIBRARY) ||
+         ((*l)->GetType() == cmState::MODULE_LIBRARY) ||
+         ((*l)->GetType() == cmState::OBJECT_LIBRARY) ||
+         ((*l)->GetType() == cmState::UTILITY))
         {
-        cmGeneratorTarget* gt = this->GetGeneratorTarget(&l->second);
+        cmGeneratorTarget* gt = *l;
         std::string tname = lg->GetRelativeTargetDirectory(gt);
         tname += "/DependInfo.cmake";
         cmSystemTools::ConvertToUnixSlashes(tname);
@@ -914,13 +915,11 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
       lgi != this->LocalGenerators.end(); ++lgi)
     {
     cmLocalGenerator* lg = *lgi;
-    cmMakefile* mf = lg->GetMakefile();
-    cmTargets const& targets = mf->GetTargets();
-    for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
+    std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets();
+    for(std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
+        t != targets.end(); ++t)
       {
-      cmTarget const& target = t->second;
-
-      cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
+      cmGeneratorTarget* gt = *t;
 
       cmLocalGenerator* tlg = gt->GetLocalGenerator();
 
@@ -1089,11 +1088,12 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
     if (lg2 == lg || lg->GetMakefile()->IsRootMakefile())
       {
       // for each target Generate the rule files for each target.
-      cmTargets& targets = lg2->GetMakefile()->GetTargets();
-      for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
+      std::vector<cmGeneratorTarget*> targets = lg2->GetGeneratorTargets();
+      for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+          t != targets.end(); ++t)
         {
-        cmTarget const& target = t->second;
-        cmState::TargetType type = target.GetType();
+        cmGeneratorTarget* target = *t;
+        cmState::TargetType type = target->GetType();
         if((type == cmState::EXECUTABLE) ||
            (type == cmState::STATIC_LIBRARY) ||
            (type == cmState::SHARED_LIBRARY) ||
@@ -1102,7 +1102,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
            (type == cmState::GLOBAL_TARGET) ||
            (type == cmState::UTILITY))
           {
-          std::string name = target.GetName();
+          std::string name = target->GetName();
           if(emittedTargets.insert(name).second)
             {
             path = "... ";
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 2c8cb56..8ab2262 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -375,11 +375,11 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
     for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
         i != gen.end(); ++i)
       {
-      cmTargets& targets = (*i)->GetMakefile()->GetTargets();
-      for(cmTargets::iterator ti = targets.begin();
+      std::vector<cmGeneratorTarget*> targets = (*i)->GetGeneratorTargets();
+      for(std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
           ti != targets.end(); ++ti)
         {
-        this->ComputeVSTargetDepends(ti->second);
+        this->ComputeVSTargetDepends(*(*ti)->Target);
         }
       }
     }
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index c06f503..fe115ac 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -510,17 +510,20 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
       continue;
       }
 
-    cmTargets& tgts = lg->GetMakefile()->GetTargets();
-    for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
+    std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
+    for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+        l != tgts.end(); l++)
       {
-      cmTarget& target = l->second;
+      cmTarget& target = *(*l)->Target;
 
       if (target.GetType() == cmState::GLOBAL_TARGET)
         {
         continue;
         }
 
-      if (regenerate && (l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET))
+      std::string targetName = target.GetName();
+
+      if (regenerate && (targetName != CMAKE_CHECK_BUILD_SYSTEM_TARGET))
         {
         target.AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
         }
@@ -1085,21 +1088,26 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
                                            targets)
 {
   this->SetCurrentLocalGenerator(gen);
-  cmTargets &tgts = this->CurrentMakefile->GetTargets();
-  typedef std::map<std::string, cmTarget*, cmCompareTargets> cmSortedTargets;
+  std::vector<cmGeneratorTarget*> tgts =
+      this->CurrentLocalGenerator->GetGeneratorTargets();
+  typedef std::map<std::string, cmGeneratorTarget*, cmCompareTargets>
+      cmSortedTargets;
   cmSortedTargets sortedTargets;
-  for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+      l != tgts.end(); l++)
     {
-    sortedTargets[l->first] = &l->second;
+    sortedTargets[(*l)->GetName()] = *l;
     }
   for(cmSortedTargets::iterator l = sortedTargets.begin();
       l != sortedTargets.end(); l++)
     {
-    cmTarget& cmtarget = *l->second;
-    cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
+    cmGeneratorTarget* gtgt = l->second;
+    cmTarget& cmtarget = *gtgt->Target;
+
+    std::string targetName = gtgt->GetName();
 
     // make sure ALL_BUILD, INSTALL, etc are only done once
-    if(this->SpecialTargetEmitted(l->first.c_str()))
+    if(this->SpecialTargetEmitted(targetName.c_str()))
       {
       continue;
       }
@@ -3062,10 +3070,11 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
       }
     cmMakefile* mf = (*i)->GetMakefile();
     std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups();
-    cmTargets &tgts = mf->GetTargets();
-    for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
+    std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets();
+    for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+        l != tgts.end(); l++)
       {
-      cmTarget& cmtarget = l->second;
+      cmTarget& cmtarget = *(*l)->Target;
 
       // Same skipping logic here as in CreateXCodeTargets so that we do not
       // end up with (empty anyhow) ALL_BUILD and XCODE_DEPEND_HELPER source
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 3658473..2166c09 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2510,28 +2510,29 @@ cmLocalGenerator
 {
   // Convert the old-style install specification from each target to
   // an install generator and run it.
-  cmTargets& tgts = this->Makefile->GetTargets();
-  for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+      l != tgts.end(); ++l)
     {
-    if (l->second.GetType() == cmState::INTERFACE_LIBRARY)
+    if ((*l)->GetType() == cmState::INTERFACE_LIBRARY)
       {
       continue;
       }
 
     // Include the user-specified pre-install script for this target.
-    if(const char* preinstall = l->second.GetProperty("PRE_INSTALL_SCRIPT"))
+    if(const char* preinstall = (*l)->GetProperty("PRE_INSTALL_SCRIPT"))
       {
       cmInstallScriptGenerator g(preinstall, false, 0);
       g.Generate(os, config, configurationTypes);
       }
 
     // Install this target if a destination is given.
-    if(l->second.GetInstallPath() != "")
+    if((*l)->Target->GetInstallPath() != "")
       {
       // Compute the full install destination.  Note that converting
       // to unix slashes also removes any trailing slash.
       // We also skip over the leading slash given by the user.
-      std::string destination = l->second.GetInstallPath().substr(1);
+      std::string destination = (*l)->Target->GetInstallPath().substr(1);
       cmSystemTools::ConvertToUnixSlashes(destination);
       if(destination.empty())
         {
@@ -2539,7 +2540,7 @@ cmLocalGenerator
         }
 
       // Generate the proper install generator for this target type.
-      switch(l->second.GetType())
+      switch((*l)->GetType())
         {
         case cmState::EXECUTABLE:
         case cmState::STATIC_LIBRARY:
@@ -2547,7 +2548,7 @@ cmLocalGenerator
           {
           // Use a target install generator.
           cmInstallTargetGeneratorLocal
-            g(this, l->first, destination.c_str(), false);
+            g(this, (*l)->GetName(), destination.c_str(), false);
           g.Generate(os, config, configurationTypes);
           }
           break;
@@ -2558,18 +2559,18 @@ cmLocalGenerator
           // to the normal destination and the DLL to the runtime
           // destination.
           cmInstallTargetGeneratorLocal
-            g1(this, l->first, destination.c_str(), true);
+            g1(this, (*l)->GetName(), destination.c_str(), true);
           g1.Generate(os, config, configurationTypes);
           // We also skip over the leading slash given by the user.
-          destination = l->second.GetRuntimeInstallPath().substr(1);
+          destination = (*l)->Target->GetRuntimeInstallPath().substr(1);
           cmSystemTools::ConvertToUnixSlashes(destination);
           cmInstallTargetGeneratorLocal
-            g2(this, l->first, destination.c_str(), false);
+            g2(this, (*l)->GetName(), destination.c_str(), false);
           g2.Generate(os, config, configurationTypes);
 #else
           // Use a target install generator.
           cmInstallTargetGeneratorLocal
-            g(this, l->first, destination.c_str(), false);
+            g(this, (*l)->GetName(), destination.c_str(), false);
           g.Generate(os, config, configurationTypes);
 #endif
           }
@@ -2580,7 +2581,7 @@ cmLocalGenerator
       }
 
     // Include the user-specified post-install script for this target.
-    if(const char* postinstall = l->second.GetProperty("POST_INSTALL_SCRIPT"))
+    if(const char* postinstall = (*l)->GetProperty("POST_INSTALL_SCRIPT"))
       {
       cmInstallScriptGenerator g(postinstall, false, 0);
       g.Generate(os, config, configurationTypes);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 07f763b..dae8aaf 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1762,43 +1762,43 @@ void cmLocalUnixMakefileGenerator3
   ruleFileStream
     << "# Targets provided globally by CMake.\n"
     << "\n";
-  cmTargets* targets = &(this->Makefile->GetTargets());
-  cmTargets::iterator glIt;
-  for ( glIt = targets->begin(); glIt != targets->end(); ++ glIt )
+  std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
+  std::vector<cmGeneratorTarget*>::iterator glIt;
+  for ( glIt = targets.begin(); glIt != targets.end(); ++ glIt )
     {
-    if ( glIt->second.GetType() == cmState::GLOBAL_TARGET )
+    if ( (*glIt)->GetType() == cmState::GLOBAL_TARGET )
       {
-      std::string targetString = "Special rule for the target " + glIt->first;
+      std::string targetString = "Special rule for the target " +
+          (*glIt)->GetName();
       std::vector<std::string> commands;
       std::vector<std::string> depends;
 
-      const char* text = glIt->second.GetProperty("EchoString");
+      const char* text = (*glIt)->GetProperty("EchoString");
       if ( !text )
         {
         text = "Running external command ...";
         }
-      depends.insert(depends.end(), glIt->second.GetUtilities().begin(),
-                     glIt->second.GetUtilities().end());
+      depends.insert(depends.end(), (*glIt)->Target->GetUtilities().begin(),
+                     (*glIt)->Target->GetUtilities().end());
       this->AppendEcho(commands, text,
                        cmLocalUnixMakefileGenerator3::EchoGlobal);
 
-      cmGeneratorTarget* gt = this->GlobalGenerator
-          ->GetGeneratorTarget(&glIt->second);
+      cmGeneratorTarget* gt = *glIt;
 
       // Global targets store their rules in pre- and post-build commands.
       this->AppendCustomDepends(depends,
-                                glIt->second.GetPreBuildCommands());
+                                gt->Target->GetPreBuildCommands());
       this->AppendCustomDepends(depends,
-                                glIt->second.GetPostBuildCommands());
+                                gt->Target->GetPostBuildCommands());
       this->AppendCustomCommands(commands,
-                                 glIt->second.GetPreBuildCommands(),
+                                 gt->Target->GetPreBuildCommands(),
                                  gt,
                                  cmLocalGenerator::START_OUTPUT);
       this->AppendCustomCommands(commands,
-                                 glIt->second.GetPostBuildCommands(),
+                                 gt->Target->GetPostBuildCommands(),
                                  gt,
                                  cmLocalGenerator::START_OUTPUT);
-      std::string targetName = glIt->second.GetName();
+      std::string targetName = gt->GetName();
       this->WriteMakeRule(ruleFileStream, targetString.c_str(),
                           targetName, depends, commands, true);
 
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 63fc283..c9d53fe 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -74,22 +74,23 @@ cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
 void cmLocalVisualStudio10Generator::Generate()
 {
 
-  cmTargets &tgts = this->Makefile->GetTargets();
-  for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+      l != tgts.end(); ++l)
     {
-    if(l->second.GetType() == cmState::INTERFACE_LIBRARY)
+    if((*l)->GetType() == cmState::INTERFACE_LIBRARY)
       {
       continue;
       }
     if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
-       ->TargetIsFortranOnly(l->second))
+       ->TargetIsFortranOnly(*(*l)->Target))
       {
-      this->CreateSingleVCProj(l->first.c_str(),l->second);
+      this->CreateSingleVCProj((*l)->GetName().c_str(), *(*l)->Target);
       }
     else
       {
       cmVisualStudio10TargetGenerator tg(
-        &l->second, static_cast<cmGlobalVisualStudio10Generator*>(
+        (*l)->Target, static_cast<cmGlobalVisualStudio10Generator*>(
           this->GetGlobalGenerator()));
       tg.Generate();
       }
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index a51eb67..773e555 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -82,12 +82,12 @@ private:
 
 void cmLocalVisualStudio6Generator::AddCMakeListsRules()
 {
-  cmTargets &tgts = this->Makefile->GetTargets();
-  for(cmTargets::iterator l = tgts.begin();
-      l != tgts.end(); l++)
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+      l != tgts.end(); ++l)
     {
-    if (l->second.GetType() == cmState::INTERFACE_LIBRARY
-        || l->second.GetType() == cmState::GLOBAL_TARGET)
+    if ((*l)->GetType() == cmState::INTERFACE_LIBRARY
+        || (*l)->GetType() == cmState::GLOBAL_TARGET)
       {
       continue;
       }
@@ -98,7 +98,7 @@ void cmLocalVisualStudio6Generator::AddCMakeListsRules()
       this->Makefile->GetDefinition("CMAKE_SUPPRESS_REGENERATION");
     if (!cmSystemTools::IsOn(suppRegenRule))
       {
-      this->AddDSPBuildRule(l->second);
+      this->AddDSPBuildRule(*(*l)->Target);
       }
     }
 }
@@ -124,54 +124,56 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
 
   // Create the DSP or set of DSP's for libraries and executables
 
-  cmTargets &tgts = this->Makefile->GetTargets();
-
-  // build any targets
-  for(cmTargets::iterator l = tgts.begin();
-      l != tgts.end(); l++)
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+      l != tgts.end(); ++l)
     {
-    switch(l->second.GetType())
+    switch((*l)->GetType())
       {
       case cmState::STATIC_LIBRARY:
       case cmState::OBJECT_LIBRARY:
-        this->SetBuildType(STATIC_LIBRARY, l->first.c_str(), l->second);
+        this->SetBuildType(STATIC_LIBRARY,
+                           (*l)->GetName().c_str(), *(*l)->Target);
         break;
       case cmState::SHARED_LIBRARY:
       case cmState::MODULE_LIBRARY:
-        this->SetBuildType(DLL, l->first.c_str(), l->second);
+        this->SetBuildType(DLL,
+                           (*l)->GetName().c_str(), *(*l)->Target);
         break;
       case cmState::EXECUTABLE:
-        this->SetBuildType(EXECUTABLE,l->first.c_str(), l->second);
+        this->SetBuildType(EXECUTABLE,
+                           (*l)->GetName().c_str(), *(*l)->Target);
         break;
       case cmState::UTILITY:
       case cmState::GLOBAL_TARGET:
-        this->SetBuildType(UTILITY, l->first.c_str(), l->second);
+        this->SetBuildType(UTILITY,
+                           (*l)->GetName().c_str(), *(*l)->Target);
         break;
       case cmState::INTERFACE_LIBRARY:
         continue;
       default:
-        cmSystemTools::Error("Bad target type: ", l->first.c_str());
+        cmSystemTools::Error("Bad target type: ", (*l)->GetName().c_str());
         break;
       }
     // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
     // so don't build a projectfile for it
     const char* path =
-      l->second.GetProperty("EXTERNAL_MSPROJECT");
+      (*l)->GetProperty("EXTERNAL_MSPROJECT");
     if(!path)
       {
       // check to see if the dsp is going into a sub-directory
-      std::string::size_type pos = l->first.rfind('/');
+      std::string::size_type pos = (*l)->GetName().rfind('/');
       if(pos != std::string::npos)
         {
         std::string dir = this->GetCurrentBinaryDirectory();
         dir += "/";
-        dir += l->first.substr(0, pos);
+        dir += (*l)->GetName().substr(0, pos);
         if(!cmSystemTools::MakeDirectory(dir.c_str()))
           {
           cmSystemTools::Error("Error creating directory: ", dir.c_str());
           }
         }
-      this->CreateSingleDSP(l->first.c_str(),l->second);
+      this->CreateSingleDSP((*l)->GetName().c_str(), *(*l)->Target);
       }
     }
 }
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 819998c..0f39ddb 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -67,19 +67,19 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator()
 void cmLocalVisualStudio7Generator::AddHelperCommands()
 {
   // Now create GUIDs for targets
-  cmTargets &tgts = this->Makefile->GetTargets();
-
-  for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+      l != tgts.end(); ++l)
     {
-    if(l->second.GetType() == cmState::INTERFACE_LIBRARY)
+    if((*l)->GetType() == cmState::INTERFACE_LIBRARY)
       {
       continue;
       }
-    const char* path = l->second.GetProperty("EXTERNAL_MSPROJECT");
+    const char* path = (*l)->GetProperty("EXTERNAL_MSPROJECT");
     if(path)
       {
       this->ReadAndStoreExternalGUID(
-        l->second.GetName().c_str(), path);
+        (*l)->GetName().c_str(), path);
       }
     }
 
@@ -95,7 +95,6 @@ void cmLocalVisualStudio7Generator::Generate()
 
 void cmLocalVisualStudio7Generator::AddCMakeListsRules()
 {
-  cmTargets &tgts = this->Makefile->GetTargets();
   // Create the regeneration custom rule.
   if(!this->Makefile->IsOn("CMAKE_SUPPRESS_REGENERATION"))
     {
@@ -104,17 +103,17 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules()
     if(cmSourceFile* sf = this->CreateVCProjBuildRule())
       {
       // Add the rule to targets that need it.
-      for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
+      std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+      for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+          l != tgts.end(); ++l)
         {
-        if (l->second.GetType() == cmState::GLOBAL_TARGET)
+        if ((*l)->GetType() == cmState::GLOBAL_TARGET)
           {
           continue;
           }
-        if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
+        if((*l)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
           {
-          cmGeneratorTarget* gt =
-              this->GlobalGenerator->GetGeneratorTarget(&l->second);
-          gt->AddSource(sf->GetFullPath());
+          (*l)->AddSource(sf->GetFullPath());
           }
         }
       }
@@ -126,11 +125,11 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
   // Visual Studio .NET 2003 Service Pack 1 will not run post-build
   // commands for targets in which no sources are built.  Add dummy
   // rules to force these targets to build.
-  cmTargets &tgts = this->Makefile->GetTargets();
-  for(cmTargets::iterator l = tgts.begin();
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
       l != tgts.end(); l++)
     {
-    cmTarget& tgt = l->second;
+    cmTarget& tgt = (*l)->Target;
     if(tgt.GetType() == cmState::GLOBAL_TARGET)
       {
       std::vector<std::string> no_depends;
@@ -150,9 +149,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
            force.c_str(), no_depends, no_main_dependency,
            force_commands, " ", 0, true))
         {
-        cmGeneratorTarget* gt =
-            this->GlobalGenerator->GetGeneratorTarget(&tgt);
-        gt->AddSource(file->GetFullPath());
+        (*l)->AddSource(file->GetFullPath());
         }
       }
     }
@@ -176,21 +173,21 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles()
     }
 
   // Get the set of targets in this directory.
-  cmTargets &tgts = this->Makefile->GetTargets();
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
 
   // Create the project file for each target.
-  for(cmTargets::iterator l = tgts.begin();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
       l != tgts.end(); l++)
     {
-    if(l->second.GetType() == cmState::INTERFACE_LIBRARY)
+    if((*l)->GetType() == cmState::INTERFACE_LIBRARY)
       {
       continue;
       }
     // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
     // so don't build a projectfile for it
-    if(!l->second.GetProperty("EXTERNAL_MSPROJECT"))
+    if(!(*l)->GetProperty("EXTERNAL_MSPROJECT"))
       {
-      this->CreateSingleVCProj(l->first.c_str(),l->second);
+      this->CreateSingleVCProj((*l)->GetName().c_str(), *(*l)->Target);
       }
     }
 }

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list