summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx76
1 files changed, 42 insertions, 34 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 0e3af88..576827c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -460,6 +460,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
root->AddGeneratorTarget(allbuild, allBuildGt);
+ root->GetGlobalGenerator()->AddGeneratorTarget(allbuild, allBuildGt);
// Refer to the main build configuration file for easy editing.
std::string listfile = root->GetCurrentSourceDirectory();
@@ -495,6 +496,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
root->AddGeneratorTarget(check, checkGt);
+ root->GetGlobalGenerator()->AddGeneratorTarget(check, checkGt);
}
// now make the allbuild depend on all the non-utility targets
@@ -787,14 +789,16 @@ 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 =
- this->GetGeneratorTarget(&cmtarget)->GetTargetSourceFileFlags(sf);
+ gtgt->GetTargetSourceFileFlags(sf);
bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource;
// Is this a "private" or "public" framework header file?
// Set the ATTRIBUTES attribute appropriately...
//
- if(cmtarget.IsFrameworkOnApple())
+ if(gtgt->IsFrameworkOnApple())
{
if(tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader)
{
@@ -1193,9 +1197,9 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
}
// some build phases only apply to bundles and/or frameworks
- bool isFrameworkTarget = cmtarget.IsFrameworkOnApple();
+ bool isFrameworkTarget = gtgt->IsFrameworkOnApple();
bool isBundleTarget = cmtarget.GetPropertyAsBool("MACOSX_BUNDLE");
- bool isCFBundleTarget = cmtarget.IsCFBundleOnApple();
+ bool isCFBundleTarget = gtgt->IsCFBundleOnApple();
cmXCodeObject* buildFiles = 0;
@@ -1289,7 +1293,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
copyFilesBuildPhase->AddAttribute("dstSubfolderSpec",
this->CreateString("6"));
std::ostringstream ostr;
- if (cmtarget.IsFrameworkOnApple())
+ if (gtgt->IsFrameworkOnApple())
{
// dstPath in frameworks is relative to Versions/<version>
ostr << mit->first;
@@ -1467,8 +1471,10 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
std::vector<cmCustomCommand> postbuild
= cmtarget.GetPostBuildCommands();
+ cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
+
if(cmtarget.GetType() == cmState::SHARED_LIBRARY &&
- !cmtarget.IsFrameworkOnApple())
+ !gtgt->IsFrameworkOnApple())
{
cmCustomCommandLines cmd;
cmd.resize(1);
@@ -1500,7 +1506,6 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
}
std::vector<cmSourceFile*> classes;
- cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
if (!gtgt->GetConfigCommonSourceFiles(classes))
{
return;
@@ -1847,14 +1852,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName);
// Add shared-library flags if needed.
- this->CurrentLocalGenerator->AddCMP0018Flags(flags, &target,
+ this->CurrentLocalGenerator->AddCMP0018Flags(flags, gtgt,
lang, configName);
- this->CurrentLocalGenerator->AddVisibilityPresetFlags(flags, &target,
+ this->CurrentLocalGenerator->AddVisibilityPresetFlags(flags, gtgt,
lang);
this->CurrentLocalGenerator->
- AddCompileOptions(flags, &target, lang, configName);
+ AddCompileOptions(flags, gtgt, lang, configName);
}
std::string llang = gtgt->GetLinkerLanguage(configName);
@@ -1878,7 +1883,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->AppendDefines(ppDefs,
"CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\"");
}
- if(const char* exportMacro = target.GetExportMacro())
+ if(const char* exportMacro = gtgt->GetExportMacro())
{
// Add the export symbol definition for shared library objects.
this->AppendDefines(ppDefs, exportMacro);
@@ -1917,7 +1922,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CurrentLocalGenerator
->GetStaticLibraryFlags(extraLinkOptions,
cmSystemTools::UpperCase(configName),
- &target);
+ gtgt);
}
else
{
@@ -1976,7 +1981,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
const char* version = target.GetProperty("VERSION");
const char* soversion = target.GetProperty("SOVERSION");
- if(!gtgt->HasSOName(configName) || target.IsFrameworkOnApple())
+ if(!gtgt->HasSOName(configName) || gtgt->IsFrameworkOnApple())
{
version = 0;
soversion = 0;
@@ -2023,7 +2028,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
pndir = gtgt->GetDirectory(configName);
}
- if(target.IsFrameworkOnApple() || target.IsCFBundleOnApple())
+ if(gtgt->IsFrameworkOnApple() || gtgt->IsCFBundleOnApple())
{
pnprefix = "";
}
@@ -2076,7 +2081,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
buildSettings->AddAttribute("LIBRARY_STYLE",
this->CreateString("BUNDLE"));
- if (target.IsCFBundleOnApple())
+ if (gtgt->IsCFBundleOnApple())
{
// It turns out that a BUNDLE is basically the same
// in many ways as an application bundle, as far as
@@ -2095,7 +2100,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// a per-configuration Info.plist file. The cfbundle plist
// is very similar to the application bundle plist
this->CurrentLocalGenerator
- ->GenerateAppleInfoPList(&target, "$(EXECUTABLE_NAME)",
+ ->GenerateAppleInfoPList(gtgt, "$(EXECUTABLE_NAME)",
plist.c_str());
std::string path =
this->ConvertToRelativeForXCode(plist.c_str());
@@ -2144,7 +2149,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// so let it replace the framework name. This avoids creating
// a per-configuration Info.plist file.
this->CurrentLocalGenerator
- ->GenerateFrameworkInfoPList(&target, "$(EXECUTABLE_NAME)",
+ ->GenerateFrameworkInfoPList(gtgt, "$(EXECUTABLE_NAME)",
plist.c_str());
std::string path =
this->ConvertToRelativeForXCode(plist.c_str());
@@ -2187,7 +2192,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// so let it replace the executable name. This avoids creating
// a per-configuration Info.plist file.
this->CurrentLocalGenerator
- ->GenerateAppleInfoPList(&target, "$(EXECUTABLE_NAME)",
+ ->GenerateAppleInfoPList(gtgt, "$(EXECUTABLE_NAME)",
plist.c_str());
std::string path =
this->ConvertToRelativeForXCode(plist.c_str());
@@ -2454,7 +2459,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
int patch;
// VERSION -> current_version
- target.GetTargetVersion(false, major, minor, patch);
+ gtgt->GetTargetVersion(false, major, minor, patch);
std::ostringstream v;
// Xcode always wants at least 1.0.0 or nothing
@@ -2466,7 +2471,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString(v.str().c_str()));
// SOVERSION -> compatibility_version
- target.GetTargetVersion(true, major, minor, patch);
+ gtgt->GetTargetVersion(true, major, minor, patch);
std::ostringstream vso;
// Xcode always wants at least 1.0.0 or nothing
@@ -2671,23 +2676,24 @@ cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(cmTarget const& cmtarget) const
}
//----------------------------------------------------------------------------
-const char* cmGlobalXCodeGenerator::GetTargetFileType(cmTarget& cmtarget)
+const char* cmGlobalXCodeGenerator::GetTargetFileType(
+ cmGeneratorTarget* target)
{
- switch(cmtarget.GetType())
+ switch(target->GetType())
{
case cmState::OBJECT_LIBRARY:
case cmState::STATIC_LIBRARY:
return "archive.ar";
case cmState::MODULE_LIBRARY:
- if (cmtarget.IsXCTestOnApple())
+ if (target->IsXCTestOnApple())
return "wrapper.cfbundle";
- else if (cmtarget.IsCFBundleOnApple())
+ else if (target->IsCFBundleOnApple())
return "wrapper.plug-in";
else
return ((this->XcodeVersion >= 22)?
"compiled.mach-o.executable" : "compiled.mach-o.dylib");
case cmState::SHARED_LIBRARY:
- return (cmtarget.GetPropertyAsBool("FRAMEWORK")?
+ return (target->GetPropertyAsBool("FRAMEWORK")?
"wrapper.framework" : "compiled.mach-o.dylib");
case cmState::EXECUTABLE:
return "compiled.mach-o.executable";
@@ -2697,28 +2703,29 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(cmTarget& cmtarget)
}
//----------------------------------------------------------------------------
-const char* cmGlobalXCodeGenerator::GetTargetProductType(cmTarget& cmtarget)
+const char* cmGlobalXCodeGenerator::GetTargetProductType(
+ cmGeneratorTarget* target)
{
- switch(cmtarget.GetType())
+ switch(target->GetType())
{
case cmState::OBJECT_LIBRARY:
case cmState::STATIC_LIBRARY:
return "com.apple.product-type.library.static";
case cmState::MODULE_LIBRARY:
- if (cmtarget.IsXCTestOnApple())
+ if (target->IsXCTestOnApple())
return "com.apple.product-type.bundle.unit-test";
- else if (cmtarget.IsCFBundleOnApple())
+ else if (target->IsCFBundleOnApple())
return "com.apple.product-type.bundle";
else
return ((this->XcodeVersion >= 22)?
"com.apple.product-type.tool" :
"com.apple.product-type.library.dynamic");
case cmState::SHARED_LIBRARY:
- return (cmtarget.GetPropertyAsBool("FRAMEWORK")?
+ return (target->GetPropertyAsBool("FRAMEWORK")?
"com.apple.product-type.framework" :
"com.apple.product-type.library.dynamic");
case cmState::EXECUTABLE:
- return (cmtarget.GetPropertyAsBool("MACOSX_BUNDLE")?
+ return (target->GetPropertyAsBool("MACOSX_BUNDLE")?
"com.apple.product-type.application" :
"com.apple.product-type.tool");
default: break;
@@ -2759,9 +2766,11 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
target->AddAttribute("name", this->CreateString(cmtarget.GetName()));
target->AddAttribute("productName",this->CreateString(cmtarget.GetName()));
+ cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&cmtarget);
+
cmXCodeObject* fileRef =
this->CreateObject(cmXCodeObject::PBXFileReference);
- if(const char* fileType = this->GetTargetFileType(cmtarget))
+ if(const char* fileType = this->GetTargetFileType(gtgt))
{
fileRef->AddAttribute("explicitFileType", this->CreateString(fileType));
}
@@ -2774,7 +2783,6 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
}
else
{
- cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&cmtarget);
fullName = gtgt->GetFullName(defConfig.c_str());
}
fileRef->AddAttribute("path", this->CreateString(fullName.c_str()));
@@ -2784,7 +2792,7 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
fileRef->SetComment(cmtarget.GetName().c_str());
target->AddAttribute("productReference",
this->CreateObjectReference(fileRef));
- if(const char* productType = this->GetTargetProductType(cmtarget))
+ if(const char* productType = this->GetTargetProductType(gtgt))
{
target->AddAttribute("productType", this->CreateString(productType));
}