summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-02-22 19:30:58 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-02-22 19:30:58 (GMT)
commit64d997a78c1f2a24a8fd1978856a2b5f4a97a0f9 (patch)
treea3b002c20c5717e463455b985c031e02b12b861f /Source/cmGlobalXCodeGenerator.cxx
parent6ec1ae2108afb8d9a72783fe945ad2410f08b4c1 (diff)
parentcabc407912bb3bc0bb954e317a999cb2ee64de57 (diff)
downloadCMake-64d997a78c1f2a24a8fd1978856a2b5f4a97a0f9.zip
CMake-64d997a78c1f2a24a8fd1978856a2b5f4a97a0f9.tar.gz
CMake-64d997a78c1f2a24a8fd1978856a2b5f4a97a0f9.tar.bz2
Merge topic 'fix-11295-support-plugin-bundles-on-mac'
cabc407 CFBundle Test: Add PATHS for finding Rez (#11295) 5457b82 Add support for CFBundle targets on the Mac (#11295)
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx55
1 files changed, 48 insertions, 7 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 358721f..df679ea 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -578,6 +578,12 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
}
}
+ if(cmtarget.IsCFBundleOnApple())
+ {
+ cmtarget.SetProperty("PREFIX", "");
+ cmtarget.SetProperty("SUFFIX", "");
+ }
+
// Add the fileRef to the top level Resources group/folder if it is not
// already there.
//
@@ -812,6 +818,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
// some build phases only apply to bundles and/or frameworks
bool isFrameworkTarget = cmtarget.IsFrameworkOnApple();
bool isBundleTarget = cmtarget.GetPropertyAsBool("MACOSX_BUNDLE");
+ bool isCFBundleTarget = cmtarget.IsCFBundleOnApple();
cmXCodeObject* buildFiles = 0;
@@ -857,7 +864,8 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
// create resource build phase - only for framework or bundle targets
cmXCodeObject* resourceBuildPhase = 0;
- if (!resourceFiles.empty() && (isFrameworkTarget || isBundleTarget))
+ if (!resourceFiles.empty() &&
+ (isFrameworkTarget || isBundleTarget || isCFBundleTarget))
{
resourceBuildPhase =
this->CreateObject(cmXCodeObject::PBXResourcesBuildPhase);
@@ -878,7 +886,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
// create vector of "non-resource content file" build phases - only for
// framework or bundle targets
std::vector<cmXCodeObject*> contentBuildPhases;
- if (isFrameworkTarget || isBundleTarget)
+ if (isFrameworkTarget || isBundleTarget || isCFBundleTarget)
{
typedef std::map<cmStdString, std::vector<cmSourceFile*> >
mapOfVectorOfSourceFiles;
@@ -1605,7 +1613,33 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
buildSettings->AddAttribute("LIBRARY_STYLE",
this->CreateString("BUNDLE"));
- if(this->XcodeVersion >= 22)
+ if (target.GetPropertyAsBool("BUNDLE"))
+ {
+ // It turns out that a BUNDLE is basically the same
+ // in many ways as an application bundle, as far as
+ // link flags go
+ std::string createFlags =
+ this->LookupFlags("CMAKE_SHARED_MODULE_CREATE_", lang, "_FLAGS",
+ "-bundle");
+ if(!createFlags.empty())
+ {
+ extraLinkOptions += " ";
+ extraLinkOptions += createFlags;
+ }
+ std::string plist = this->ComputeInfoPListLocation(target);
+ // 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
+ // is very similar to the application bundle plist
+ this->CurrentLocalGenerator
+ ->GenerateAppleInfoPList(&target, "$(EXECUTABLE_NAME)",
+ plist.c_str());
+ std::string path =
+ this->ConvertToRelativeForXCode(plist.c_str());
+ buildSettings->AddAttribute("INFOPLIST_FILE",
+ this->CreateString(path.c_str()));
+ }
+ else if(this->XcodeVersion >= 22)
{
buildSettings->AddAttribute("MACH_O_TYPE",
this->CreateString("mh_bundle"));
@@ -1644,7 +1678,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
std::string plist = this->ComputeInfoPListLocation(target);
// Xcode will create the final version of Info.plist at build time,
- // so let it replace the framework name. This avoids creating
+ // so let it replace the framework name. This avoids creating
// a per-configuration Info.plist file.
this->CurrentLocalGenerator
->GenerateFrameworkInfoPList(&target, "$(EXECUTABLE_NAME)",
@@ -2043,7 +2077,10 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(cmTarget& cmtarget)
case cmTarget::STATIC_LIBRARY:
return "archive.ar";
case cmTarget::MODULE_LIBRARY:
- return ((this->XcodeVersion >= 22)?
+ if (cmtarget.IsCFBundleOnApple())
+ return "wrapper.plug-in";
+ else
+ return ((this->XcodeVersion >= 22)?
"compiled.mach-o.executable" : "compiled.mach-o.dylib");
case cmTarget::SHARED_LIBRARY:
return (cmtarget.GetPropertyAsBool("FRAMEWORK")?
@@ -2063,8 +2100,12 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(cmTarget& cmtarget)
case cmTarget::STATIC_LIBRARY:
return "com.apple.product-type.library.static";
case cmTarget::MODULE_LIBRARY:
- return ((this->XcodeVersion >= 22)? "com.apple.product-type.tool" :
- "com.apple.product-type.library.dynamic");
+ if (cmtarget.IsCFBundleOnApple())
+ return "com.apple.product-type.bundle";
+ else
+ return ((this->XcodeVersion >= 22)?
+ "com.apple.product-type.tool" :
+ "com.apple.product-type.library.dynamic");
case cmTarget::SHARED_LIBRARY:
return (cmtarget.GetPropertyAsBool("FRAMEWORK")?
"com.apple.product-type.framework" :