summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileLibraryTargetGenerator.cxx
diff options
context:
space:
mode:
authorRichard Bateman <taxilian@gmail.com>2010-10-07 02:43:04 (GMT)
committerDavid Cole <david.cole@kitware.com>2011-01-11 17:54:44 (GMT)
commit5457b8254cb43e002fe90b7c81ae65134ec12b24 (patch)
tree5eddb832a213487dd64cd8adb5c2ea88bb3d2baa /Source/cmMakefileLibraryTargetGenerator.cxx
parent6754b26bf0bb69ad6d65249bf4122dbbda446922 (diff)
downloadCMake-5457b8254cb43e002fe90b7c81ae65134ec12b24.zip
CMake-5457b8254cb43e002fe90b7c81ae65134ec12b24.tar.gz
CMake-5457b8254cb43e002fe90b7c81ae65134ec12b24.tar.bz2
Add support for CFBundle targets on the Mac (#11295)
This commit enables building, for example, plugin bundles to be loaded by web browsers.
Diffstat (limited to 'Source/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx49
1 files changed, 49 insertions, 0 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 049a338..1e9a670 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -26,6 +26,12 @@ cmMakefileLibraryTargetGenerator
::cmMakefileLibraryTargetGenerator(cmTarget* target):
cmMakefileTargetGenerator(target)
{
+ if(this->Target->IsCFBundleOnApple())
+ {
+ target->SetProperty("PREFIX", "");
+ target->SetProperty("SUFFIX", "");
+ }
+
this->CustomCommandDriver = OnDepends;
this->Target->GetLibraryNames(
this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
@@ -41,6 +47,20 @@ cmMakefileLibraryTargetGenerator
this->MacContentDirectory += this->FrameworkVersion;
this->MacContentDirectory += "/";
}
+ else if(this->Target->IsCFBundleOnApple())
+ {
+ this->MacContentDirectory = this->Target->GetDirectory(this->ConfigName);
+ this->MacContentDirectory += "/";
+ this->MacContentDirectory += this->TargetNameOut;
+ this->MacContentDirectory += ".";
+ const char *ext = this->Target->GetProperty("BUNDLE_EXTENSION");
+ if (!ext)
+ {
+ ext = "bundle";
+ }
+ this->MacContentDirectory += ext;
+ this->MacContentDirectory += "/Contents/";
+ }
}
//----------------------------------------------------------------------------
@@ -301,6 +321,27 @@ cmMakefileLibraryTargetGenerator
}
//----------------------------------------------------------------------------
+void
+cmMakefileLibraryTargetGenerator::CreateCFBundle(std::string& targetName,
+ std::string& outpath)
+{
+ // Compute bundle directory names.
+ outpath = this->MacContentDirectory;
+ outpath += "MacOS";
+ cmSystemTools::MakeDirectory(outpath.c_str());
+ this->Makefile->AddCMakeOutputFile(outpath.c_str());
+ outpath += "/";
+
+ // Configure the Info.plist file. Note that it needs the executable name
+ // to be set.
+ std::string plist = this->MacContentDirectory + "Info.plist";
+ this->LocalGenerator->GenerateAppleInfoPList(this->Target,
+ targetName.c_str(),
+ plist.c_str());
+ this->Makefile->AddCMakeOutputFile(plist.c_str());
+}
+
+//----------------------------------------------------------------------------
void cmMakefileLibraryTargetGenerator::WriteLibraryRules
(const char* linkRuleVar, const char* extraFlags, bool relink)
{
@@ -354,6 +395,12 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
outpath = this->MacContentDirectory;
this->CreateFramework(targetName);
}
+ else if(this->Target->IsCFBundleOnApple())
+ {
+ outpath = this->Target->GetDirectory(this->ConfigName);
+ outpath += "/";
+ this->CreateCFBundle(targetName, outpath);
+ }
else if(relink)
{
outpath = this->Makefile->GetStartOutputDirectory();
@@ -417,6 +464,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
buildEcho += " shared library ";
break;
case cmTarget::MODULE_LIBRARY:
+ if (this->Target->IsCFBundleOnApple())
+ buildEcho += " CFBundle";
buildEcho += " shared module ";
break;
default: