Ver código fonte

Xcode: Prefer to get target state from cmGeneratorTarget.

Stephen Kelly 10 anos atrás
pai
commit
effe874d25
1 arquivos alterados com 68 adições e 69 exclusões
  1. 68 69
      Source/cmGlobalXCodeGenerator.cxx

+ 68 - 69
Source/cmGlobalXCodeGenerator.cxx

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