summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-28 19:46:16 (GMT)
committerBrad King <brad.king@kitware.com>2008-01-28 19:46:16 (GMT)
commite3b1bdb058ac23bc535b941fc2ed66a410932d74 (patch)
tree9cecfe783ed59bb4995c206967b5416c0ee689dc /Source
parent437043bb04da113bf822aa42d5cf3a3cc3366be1 (diff)
downloadCMake-e3b1bdb058ac23bc535b941fc2ed66a410932d74.zip
CMake-e3b1bdb058ac23bc535b941fc2ed66a410932d74.tar.gz
CMake-e3b1bdb058ac23bc535b941fc2ed66a410932d74.tar.bz2
ENH: Support exporting/importing of AppBundle targets.
- Imported bundles have the MACOSX_BUNDLE property set - Added cmTarget::IsAppBundleOnApple method to simplify checks - Document BUNDLE keyword in INSTALL command - Updated IMPORTED_LOCATION property documentation for bundles - Updated ExportImport test to test bundles
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExportBuildFileGenerator.cxx5
-rw-r--r--Source/cmExportFileGenerator.cxx13
-rw-r--r--Source/cmExportInstallFileGenerator.cxx11
-rw-r--r--Source/cmInstallCommand.cxx5
-rw-r--r--Source/cmInstallCommand.h10
-rw-r--r--Source/cmInstallTargetGenerator.cxx3
-rw-r--r--Source/cmTarget.cxx10
-rw-r--r--Source/cmTarget.h3
8 files changed, 45 insertions, 15 deletions
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 0412c90..3b634e6 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -84,6 +84,11 @@ cmExportBuildFileGenerator
std::string prop = "IMPORTED_LOCATION";
prop += suffix;
std::string value = target->GetFullPath(config, false);
+ if(target->IsAppBundleOnApple())
+ {
+ value += ".app/Contents/MacOS/";
+ value += target->GetFullName(config, false);
+ }
properties[prop] = value;
}
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index d2c8ccb..6cf30c9 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -282,14 +282,19 @@ cmExportFileGenerator
<< " PROPERTY ENABLE_EXPORTS 1)\n";
}
- // Mark the imported framework. This is done even on non-Apple
- // platforms for reference and consistency purposes.
- if(target->GetType() == cmTarget::SHARED_LIBRARY &&
- target->GetPropertyAsBool("FRAMEWORK"))
+ // Mark the imported library if it is a framework.
+ if(target->IsFrameworkOnApple())
{
os << "SET_PROPERTY(TARGET " << targetName
<< " PROPERTY FRAMEWORK 1)\n";
}
+
+ // Mark the imported executable if it is an application bundle.
+ if(target->IsAppBundleOnApple())
+ {
+ os << "SET_PROPERTY(TARGET " << targetName
+ << " PROPERTY MACOSX_BUNDLE 1)\n";
+ }
os << "\n";
}
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index f378106..fe6cdb5 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -160,8 +160,8 @@ cmExportInstallFileGenerator
te->RuntimeGenerator, properties);
this->SetImportLocationProperty(config, suffix,
te->FrameworkGenerator, properties);
-
- // TODO: Bundles?
+ this->SetImportLocationProperty(config, suffix,
+ te->BundleGenerator, properties);
// If any file location was set for the target add it to the
// import file.
@@ -227,12 +227,17 @@ cmExportInstallFileGenerator
std::string fname = itgen->GetInstallFilename(config);
value += fname;
- // Fix name for frameworks.
+ // Fix name for frameworks and bundles.
if(itgen->GetTarget()->IsFrameworkOnApple())
{
value += ".framework/";
value += fname;
}
+ else if(itgen->GetTarget()->IsAppBundleOnApple())
+ {
+ value += ".app/Contents/MacOS/";
+ value += fname;
+ }
// Store the property.
properties[prop] = value;
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 863f138..056e276 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -451,9 +451,9 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
break;
case cmTarget::EXECUTABLE:
{
- // Executables use the RUNTIME properties.
- if(target.GetPropertyAsBool("MACOSX_BUNDLE"))
+ if(target.IsAppBundleOnApple())
{
+ // Application bundles use the BUNDLE properties.
if (!bundleArgs.GetDestination().empty())
{
bundleGenerator = CreateInstallTargetGenerator(target, bundleArgs,
@@ -470,6 +470,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
else
{
+ // Executables use the RUNTIME properties.
if (!runtimeArgs.GetDestination().empty())
{
runtimeGenerator = CreateInstallTargetGenerator(target,
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index ed3a3a2..e93c1f7 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -99,7 +99,7 @@ public:
"\n"
"The TARGETS signature:\n"
" install(TARGETS targets... [EXPORT <export-name>]\n"
- " [[ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK]\n"
+ " [[ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK|BUNDLE]\n"
" [DESTINATION <dir>]\n"
" [PERMISSIONS permissions...]\n"
" [CONFIGURATIONS [Debug|Release|...]]\n"
@@ -107,10 +107,12 @@ public:
" [OPTIONAL]\n"
" ] [...])\n"
"The TARGETS form specifies rules for installing targets from a "
- "project. There are four kinds of target files that may be "
- "installed: archive, library, runtime, and framework. "
+ "project. There are five kinds of target files that may be "
+ "installed: archive, library, runtime, framework, and bundle. "
- "Executables are always treated as runtime targets. "
+ "Executables are treated as runtime targets, except that those "
+ "marked with the MACOSX_BUNDLE property are treated as bundle "
+ "targets on OS X. "
"Static libraries are always treated as archive targets. "
"Module libraries are always treated as library targets. "
"For non-DLL platforms shared libraries are treated as library "
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index ae16288..2cbb31e 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -176,8 +176,7 @@ cmInstallTargetGenerator
from1 += targetName;
// Handle OSX Bundles.
- if(this->Target->GetMakefile()->IsOn("APPLE") &&
- this->Target->GetPropertyAsBool("MACOSX_BUNDLE"))
+ if(this->Target->IsAppBundleOnApple())
{
// Compute the source locations of the bundle executable and
// Info.plist file.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 39b8a4e..5e37ced 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -205,6 +205,8 @@ void cmTarget::DefineProperties(cmake *cm)
"Full path to the main file on disk for an IMPORTED target.",
"Specifies the location of an IMPORTED target file on disk. "
"For executables this is the location of the executable file. "
+ "For bundles on OS X this is the location of the executable file "
+ "inside Contents/MacOS under the application bundle folder. "
"For static libraries and modules this is the location of the "
"library or module. "
"For shared libraries on non-DLL platforms this is the location of "
@@ -606,6 +608,14 @@ bool cmTarget::IsFrameworkOnApple()
}
//----------------------------------------------------------------------------
+bool cmTarget::IsAppBundleOnApple()
+{
+ return (this->GetType() == cmTarget::EXECUTABLE &&
+ this->Makefile->IsOn("APPLE") &&
+ this->GetPropertyAsBool("MACOSX_BUNDLE"));
+}
+
+//----------------------------------------------------------------------------
class cmTargetTraceDependencies
{
public:
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 45359bb..c1de1a3 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -324,6 +324,9 @@ public:
Apple. */
bool IsFrameworkOnApple();
+ /** Return whether this target is an executable Bundle on Apple. */
+ bool IsAppBundleOnApple();
+
private:
/**
* A list of direct dependencies. Use in conjunction with DependencyMap.