summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-10-26 17:13:04 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-10-26 17:13:04 (GMT)
commitd288b216af6864567354ccb05e85466fb57d46b0 (patch)
tree2e3709b4e47c9a9f2cd2983661423668ce7a4064 /Source/cmGlobalXCodeGenerator.cxx
parentd71920c45763fe15fa93c2fc1f5aceabba23975e (diff)
parent6cac952b9ed8ad202286ddee7246d9ef7ed8f22d (diff)
downloadCMake-d288b216af6864567354ccb05e85466fb57d46b0.zip
CMake-d288b216af6864567354ccb05e85466fb57d46b0.tar.gz
CMake-d288b216af6864567354ccb05e85466fb57d46b0.tar.bz2
Merge topic 'use-generator-target'
6cac952b VS: Port interface to cmGeneratorTarget 97b37688 VS: Port WriteUtilityDepends to cmGeneratorTarget 600af01d VS: Port utility depends to cmGeneratorTarget 330bfa83 VS: Port target depends to cmGeneratorTarget b13e26e2 VS: Port ProjectDepends to cmGeneratorTarget. 8ac8739b VS: Port TargetIsFortranOnly to cmGeneratorTarget 84fb579f VS: Port WriteProject to cmGeneratorTarget 1eff421a VS: Port loop to cmGeneratorTarget 94fd5a5a VS: Port ImplibDir to cmGeneratorTarget ce9e9a92 VS: Port LinkClosure to cmGeneratorTarget 26e23e84 VS: Port ComputeLongestObjectDirectory to cmGeneratorTarget 01c26986 VS7: Port to cmGeneratorTarget 459c8910 VS10: Port to cmGeneratorTarget. 7f8bb857 VS6: Port to cmGeneratorTarget. a0ebd69b Graphviz: Port to cmGeneratorTarget. bcee21ce C::B: Port API to cmGeneratorTarget. ...
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx400
1 files changed, 198 insertions, 202 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 576827c..eecc82b 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -459,7 +459,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
"echo", "Build all projects");
cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
- root->AddGeneratorTarget(allbuild, allBuildGt);
+ root->AddGeneratorTarget(allBuildGt);
root->GetGlobalGenerator()->AddGeneratorTarget(allbuild, allBuildGt);
// Refer to the main build configuration file for easy editing.
@@ -495,7 +495,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
"make", "-f", file.c_str());
cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
- root->AddGeneratorTarget(check, checkGt);
+ root->AddGeneratorTarget(checkGt);
root->GetGlobalGenerator()->AddGeneratorTarget(check, checkGt);
}
@@ -510,19 +510,22 @@ 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;
+ cmGeneratorTarget* target = *l;
- if (target.GetType() == cmState::GLOBAL_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);
+ target->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
}
// make all exe, shared libs and modules
@@ -530,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,
@@ -551,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());
}
}
}
@@ -710,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;
@@ -720,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)
{
@@ -737,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());
@@ -750,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;
@@ -780,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 =
@@ -790,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;
@@ -925,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)
{
@@ -1006,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);
}
//----------------------------------------------------------------------------
@@ -1085,34 +1085,38 @@ 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;
+
+ 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;
}
- 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);
+ cmXCodeObject* t = this->CreateUtilityTarget(gtgt);
if (!t)
{
return false;
@@ -1140,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");
@@ -1191,14 +1195,14 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
{
std::string obj = *oi;
cmXCodeObject* xsf =
- this->CreateXCodeSourceFileFromPath(obj, cmtarget, "", 0);
+ this->CreateXCodeSourceFileFromPath(obj, gtgt, "", 0);
externalObjFiles.push_back(xsf);
}
}
// 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;
@@ -1314,7 +1318,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
{
cmXCodeObject* xsf =
this->CreateXCodeSourceFile(this->CurrentLocalGenerator,
- *sfIt, cmtarget);
+ *sfIt, gtgt);
buildFiles->AddObject(xsf);
}
contentBuildPhases.push_back(copyFilesBuildPhase);
@@ -1348,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;
}
@@ -1362,22 +1366,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; }
@@ -1393,11 +1397,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);
@@ -1425,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)
{
@@ -1445,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;
}
@@ -1462,18 +1466,16 @@ 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();
+ = gtgt->Target->GetPostBuildCommands();
- cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
-
- if(cmtarget.GetType() == cmState::SHARED_LIBRARY &&
+ if(gtgt->GetType() == cmState::SHARED_LIBRARY &&
!gtgt->IsFrameworkOnApple())
{
cmCustomCommandLines cmd;
@@ -1482,13 +1484,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);
@@ -1524,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
@@ -1652,7 +1654,7 @@ std::string cmGlobalXCodeGenerator::ExtractFlagRegex(const char* exp,
//----------------------------------------------------------------------------
void
cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
- cmTarget& target,
+ cmGeneratorTarget* target,
std::vector<cmCustomCommand>
const & commands,
const char* name)
@@ -1662,7 +1664,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";
@@ -1696,7 +1698,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator
::CreateCustomRulesMakefile(const char* makefileBasename,
- cmTarget& target,
+ cmGeneratorTarget* target,
std::vector<cmCustomCommand>
const & commands,
const std::string& configName)
@@ -1713,7 +1715,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";
@@ -1742,7 +1744,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()];
}
}
@@ -1820,26 +1822,25 @@ void cmGlobalXCodeGenerator
}
//----------------------------------------------------------------------------
-void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
+void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
cmXCodeObject* buildSettings,
const std::string& configName)
{
- if(target.GetType() == cmState::INTERFACE_LIBRARY)
+ 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();
@@ -1867,7 +1868,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;
}
@@ -1896,15 +1897,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";
}
@@ -1916,8 +1917,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,
@@ -1926,7 +1927,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->
@@ -1936,7 +1937,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);
@@ -1979,8 +1980,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;
@@ -2007,10 +2008,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)
{
@@ -2038,16 +2039,16 @@ 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)
{
std::string pncdir = this->GetObjectsNormalDirectory(
- this->CurrentProject, configName, &target);
+ this->CurrentProject, configName, gtgt);
buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
this->CreateString(pncdir.c_str()));
}
@@ -2056,7 +2057,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 +2068,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:
@@ -2094,7 +2095,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
@@ -2138,13 +2139,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
}
case cmState::SHARED_LIBRARY:
{
- if(target.GetPropertyAsBool("FRAMEWORK"))
+ 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.
@@ -2185,9 +2186,9 @@ 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);
+ 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.
@@ -2349,7 +2350,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;
@@ -2364,7 +2365,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 +2427,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(""));
@@ -2452,7 +2453,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;
@@ -2485,7 +2486,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)
{
@@ -2534,7 +2535,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
//----------------------------------------------------------------------------
cmXCodeObject*
-cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
+cmGlobalXCodeGenerator::CreateUtilityTarget(cmGeneratorTarget* gtgt)
{
cmXCodeObject* shellBuildPhase =
this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase);
@@ -2558,16 +2559,16 @@ 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;
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
{
@@ -2575,22 +2576,21 @@ 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 =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("dependencies", dependencies);
- target->AddAttribute("name", this->CreateString(cmtarget.GetName()));
- target->AddAttribute("productName",this->CreateString(cmtarget.GetName()));
- target->SetTarget(&cmtarget);
- this->XCodeObjectMap[&cmtarget] = target;
+ target->AddAttribute("name", this->CreateString(gtgt->GetName()));
+ target->AddAttribute("productName",this->CreateString(gtgt->GetName()));
+ target->SetTarget(gtgt);
+ this->XCodeObjectMap[gtgt] = 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;
@@ -2601,20 +2601,20 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
{
if(!(*i)->GetPropertyAsBool("GENERATED"))
{
- this->CreateXCodeFileReference(*i, cmtarget);
+ this->CreateXCodeFileReference(*i, gtgt);
}
}
}
target->SetId(this->GetOrCreateId(
- cmtarget.GetName(), target->GetId()).c_str());
+ gtgt->GetName(), target->GetId()).c_str());
return target;
}
//----------------------------------------------------------------------------
std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
- cmTarget& cmtarget)
+ cmGeneratorTarget* gtgt)
{
std::string configTypes =
this->CurrentMakefile->GetRequiredDefinition("CMAKE_CONFIGURATION_TYPES");
@@ -2630,7 +2630,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",
@@ -2642,7 +2642,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());
@@ -2660,12 +2660,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";
}
@@ -2735,10 +2735,10 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(
//----------------------------------------------------------------------------
cmXCodeObject*
-cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
+cmGlobalXCodeGenerator::CreateXCodeTarget(cmGeneratorTarget* gtgt,
cmXCodeObject* buildPhases)
{
- if(cmtarget.GetType() == cmState::INTERFACE_LIBRARY)
+ if(gtgt->GetType() == cmState::INTERFACE_LIBRARY)
{
return 0;
}
@@ -2750,23 +2750,21 @@ 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 =
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);
@@ -2775,10 +2773,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
@@ -2789,29 +2787,30 @@ 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))
{
target->AddAttribute("productType", this->CreateString(productType));
}
- target->SetTarget(&cmtarget);
- this->XCodeObjectMap[&cmtarget] = target;
+ target->SetTarget(gtgt);
+ this->XCodeObjectMap[gtgt] = target;
target->SetId(this->GetOrCreateId(
- cmtarget.GetName(), target->GetId()).c_str());
+ 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())
{
@@ -2948,23 +2947,22 @@ void cmGlobalXCodeGenerator
void cmGlobalXCodeGenerator
::AddDependAndLinkInformation(cmXCodeObject* target)
{
- cmTarget* cmtarget = target->GetTarget();
- if(cmtarget->GetType() == cmState::INTERFACE_LIBRARY)
+ cmGeneratorTarget* gt = target->GetTarget();
+ if(!gt)
{
+ cmSystemTools::Error("Error no target on xobject\n");
return;
}
- if(!cmtarget)
+ if(gt->GetType() == cmState::INTERFACE_LIBRARY)
{
- cmSystemTools::Error("Error no target on xobject\n");
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)
{
- if(cmXCodeObject* dptarget = this->FindXCodeTarget((*i)->Target))
+ if(cmXCodeObject* dptarget = this->FindXCodeTarget(*i))
{
this->AddDependTarget(target, dptarget);
}
@@ -2984,7 +2982,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)
{
@@ -2993,20 +2991,19 @@ void cmGlobalXCodeGenerator
linkObjs += this->XCodeEscapePath(oi->c_str());
}
this->AppendBuildSettingAttribute(
- target, this->GetTargetLinkFlagsVar(*cmtarget),
+ target, this->GetTargetLinkFlagsVar(gt),
linkObjs.c_str(), configName);
}
// 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;
@@ -3074,7 +3071,7 @@ void cmGlobalXCodeGenerator
}
}
this->AppendBuildSettingAttribute(
- target, this->GetTargetLinkFlagsVar(*cmtarget),
+ target, this->GetTargetLinkFlagsVar(gt),
linkLibs.c_str(), configName);
}
}
@@ -3094,31 +3091,30 @@ 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;
+ 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);
mf->GetOrCreateSource(plist, true);
gtgt->AddSource(plist);
}
@@ -3138,14 +3134,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, sourceGroup);
+ std::string key = GetGroupMapKey(gtgt, 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)
{
@@ -3153,8 +3149,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, sourceGroup);
+ std::string key = GetGroupMapKeyFromPath(gtgt, source);
this->GroupMap[key] = pbxgroup;
}
}
@@ -3185,16 +3181,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 =
@@ -3584,10 +3580,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/";
@@ -3661,24 +3657,23 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
i != targets.end(); ++i)
{
cmXCodeObject* target = *i;
- cmTarget* t =target->GetTarget();
- cmGeneratorTarget *gt = this->GetGeneratorTarget(t);
+ cmGeneratorTarget* gt =target->GetTarget();
- 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());
@@ -3723,7 +3718,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)
@@ -4066,12 +4061,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;
}
@@ -4097,7 +4093,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)/";