[cmake-commits] king committed cmExportBuildFileGenerator.cxx 1.1 1.2 cmExportFileGenerator.cxx 1.4 1.5 cmExportInstallFileGenerator.cxx 1.2 1.3 cmInstallCommand.cxx 1.41 1.42 cmInstallCommand.h 1.26 1.27 cmInstallTargetGenerator.cxx 1.52 1.53 cmTarget.cxx 1.181 1.182 cmTarget.h 1.98 1.99

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Jan 28 14:46:18 EST 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv26285/Source

Modified Files:
	cmExportBuildFileGenerator.cxx cmExportFileGenerator.cxx 
	cmExportInstallFileGenerator.cxx cmInstallCommand.cxx 
	cmInstallCommand.h cmInstallTargetGenerator.cxx cmTarget.cxx 
	cmTarget.h 
Log Message:
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


Index: cmExportFileGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmExportFileGenerator.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cmExportFileGenerator.cxx	28 Jan 2008 18:37:59 -0000	1.4
+++ cmExportFileGenerator.cxx	28 Jan 2008 19:46:16 -0000	1.5
@@ -282,14 +282,19 @@
        << " 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";
 }
 

Index: cmInstallCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallCommand.cxx,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- cmInstallCommand.cxx	28 Jan 2008 18:05:58 -0000	1.41
+++ cmInstallCommand.cxx	28 Jan 2008 19:46:16 -0000	1.42
@@ -451,9 +451,9 @@
         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 @@
           }
         else
           {
+          // Executables use the RUNTIME properties.
           if (!runtimeArgs.GetDestination().empty())
             {
             runtimeGenerator = CreateInstallTargetGenerator(target, 

Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- cmTarget.h	28 Jan 2008 18:05:58 -0000	1.98
+++ cmTarget.h	28 Jan 2008 19:46:16 -0000	1.99
@@ -324,6 +324,9 @@
       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.

Index: cmInstallCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallCommand.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- cmInstallCommand.h	28 Jan 2008 18:05:58 -0000	1.26
+++ cmInstallCommand.h	28 Jan 2008 19:46:16 -0000	1.27
@@ -99,7 +99,7 @@
       "\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 @@
       "           [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 "

Index: cmExportBuildFileGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmExportBuildFileGenerator.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cmExportBuildFileGenerator.cxx	28 Jan 2008 13:38:35 -0000	1.1
+++ cmExportBuildFileGenerator.cxx	28 Jan 2008 19:46:16 -0000	1.2
@@ -84,6 +84,11 @@
   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;
   }
 

Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- cmInstallTargetGenerator.cxx	28 Jan 2008 18:05:58 -0000	1.52
+++ cmInstallTargetGenerator.cxx	28 Jan 2008 19:46:16 -0000	1.53
@@ -176,8 +176,7 @@
       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.

Index: cmExportInstallFileGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmExportInstallFileGenerator.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cmExportInstallFileGenerator.cxx	28 Jan 2008 18:05:58 -0000	1.2
+++ cmExportInstallFileGenerator.cxx	28 Jan 2008 19:46:16 -0000	1.3
@@ -160,8 +160,8 @@
                                     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 @@
   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;

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -d -r1.181 -r1.182
--- cmTarget.cxx	28 Jan 2008 18:05:58 -0000	1.181
+++ cmTarget.cxx	28 Jan 2008 19:46:16 -0000	1.182
@@ -205,6 +205,8 @@
      "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::IsAppBundleOnApple()
+{
+  return (this->GetType() == cmTarget::EXECUTABLE &&
+          this->Makefile->IsOn("APPLE") &&
+          this->GetPropertyAsBool("MACOSX_BUNDLE"));
+}
+
+//----------------------------------------------------------------------------
 class cmTargetTraceDependencies
 {
 public:



More information about the Cmake-commits mailing list