[Cmake-commits] [cmake-commits] king committed cmGlobalXCodeGenerator.cxx 1.197 1.198 cmLocalGenerator.cxx 1.283 1.284 cmLocalGenerator.h 1.104 1.105 cmMakefileLibraryTargetGenerator.cxx 1.63 1.64 cmMakefileLibraryTargetGenerator.h 1.8 1.9 cmTarget.cxx 1.224 1.225

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Sep 2 12:06:34 EDT 2008


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

Modified Files:
	cmGlobalXCodeGenerator.cxx cmLocalGenerator.cxx 
	cmLocalGenerator.h cmMakefileLibraryTargetGenerator.cxx 
	cmMakefileLibraryTargetGenerator.h cmTarget.cxx 
Log Message:
ENH: Create Info.plist files in OS X Frameworks

A Mac OS X Framework should provide a Resources/Info.plist file
containing meta-data about the framework.  This change generates a
default Info.plist for frameworks and provides an interface for users to
customize it.


Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.283
retrieving revision 1.284
diff -C 2 -d -r1.283 -r1.284
*** cmLocalGenerator.cxx	21 Aug 2008 13:54:36 -0000	1.283
--- cmLocalGenerator.cxx	2 Sep 2008 16:06:32 -0000	1.284
***************
*** 2864,2865 ****
--- 2864,2905 ----
    mf->PopScope();
  }
+ 
+ //----------------------------------------------------------------------------
+ void cmLocalGenerator::GenerateFrameworkInfoPList(cmTarget* target,
+                                                   const char* targetName,
+                                                   const char* fname)
+ {
+   // Find the Info.plist template.
+   const char* in = target->GetProperty("MACOSX_FRAMEWORK_INFO_PLIST");
+   std::string inFile = (in && *in)? in : "MacOSXFrameworkInfo.plist.in";
+   if(!cmSystemTools::FileIsFullPath(inFile.c_str()))
+     {
+     std::string inMod = this->Makefile->GetModulesFile(inFile.c_str());
+     if(!inMod.empty())
+       {
+       inFile = inMod;
+       }
+     }
+   if(!cmSystemTools::FileExists(inFile.c_str(), true))
+     {
+     cmOStringStream e;
+     e << "Target " << target->GetName() << " Info.plist template \""
+       << inFile << "\" could not be found.";
+     cmSystemTools::Error(e.str().c_str());
+     return;
+     }
+ 
+   // Convert target properties to variables in an isolated makefile
+   // scope to configure the file.  If properties are set they will
+   // override user make variables.  If not the configuration will fall
+   // back to the directory-level values set by the user.
+   cmMakefile* mf = this->Makefile;
+   mf->PushScope();
+   mf->AddDefinition("MACOSX_FRAMEWORK_NAME", targetName);
+   cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_ICON_FILE");
+   cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_IDENTIFIER");
+   cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_SHORT_VERSION_STRING");
+   cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_BUNDLE_VERSION");
+   mf->ConfigureFile(inFile.c_str(), fname, false, false, false);
+   mf->PopScope();
+ }

Index: cmLocalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.h,v
retrieving revision 1.104
retrieving revision 1.105
diff -C 2 -d -r1.104 -r1.105
*** cmLocalGenerator.h	21 Aug 2008 13:54:36 -0000	1.104
--- cmLocalGenerator.h	2 Sep 2008 16:06:32 -0000	1.105
***************
*** 276,279 ****
--- 276,286 ----
    void GenerateAppleInfoPList(cmTarget* target, const char* targetName,
                                const char* fname);
+ 
+   /**
+    * Generate a Mac OS X framework Info.plist file.
+    */
+   void GenerateFrameworkInfoPList(cmTarget* target,
+                                   const char* targetName,
+                                   const char* fname);
  protected:
    /** Construct a comment for a custom command.  */

Index: cmGlobalXCodeGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.cxx,v
retrieving revision 1.197
retrieving revision 1.198
diff -C 2 -d -r1.197 -r1.198
*** cmGlobalXCodeGenerator.cxx	2 Sep 2008 14:27:15 -0000	1.197
--- cmGlobalXCodeGenerator.cxx	2 Sep 2008 16:06:31 -0000	1.198
***************
*** 1437,1440 ****
--- 1437,1452 ----
        buildSettings->AddAttribute("FRAMEWORK_VERSION",
                                    this->CreateString(version.c_str()));
+ 
+       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
+       // a per-configuration Info.plist file.
+       this->CurrentLocalGenerator
+         ->GenerateFrameworkInfoPList(&target, "$(EXECUTABLE_NAME)",
+                                      plist.c_str());
+       std::string path =
+         this->ConvertToRelativeForXCode(plist.c_str());
+       buildSettings->AddAttribute("INFOPLIST_FILE",
+                                   this->CreateString(path.c_str()));
        }
      else

Index: cmMakefileLibraryTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileLibraryTargetGenerator.cxx,v
retrieving revision 1.63
retrieving revision 1.64
diff -C 2 -d -r1.63 -r1.64
*** cmMakefileLibraryTargetGenerator.cxx	4 Aug 2008 15:37:19 -0000	1.63
--- cmMakefileLibraryTargetGenerator.cxx	2 Sep 2008 16:06:32 -0000	1.64
***************
*** 236,241 ****
  
  //----------------------------------------------------------------------------
! void cmMakefileLibraryTargetGenerator::CreateFramework()
  {
    // TODO: Use the cmMakefileTargetGenerator::ExtraFiles vector to
    // drive rules to create these files at build time.
--- 236,250 ----
  
  //----------------------------------------------------------------------------
! void
! cmMakefileLibraryTargetGenerator
! ::CreateFramework(std::string const& targetName)
  {
+   // Configure the Info.plist file into the Resources directory.
+   this->MacContentFolders.insert("Resources");
+   std::string plist = this->MacContentDirectory + "Resources/Info.plist";
+   this->LocalGenerator->GenerateFrameworkInfoPList(this->Target,
+                                                    targetName.c_str(),
+                                                    plist.c_str());
+ 
    // TODO: Use the cmMakefileTargetGenerator::ExtraFiles vector to
    // drive rules to create these files at build time.
***************
*** 389,393 ****
      {
      outpath = this->MacContentDirectory;
!     this->CreateFramework();
      }
    else if(relink)
--- 398,402 ----
      {
      outpath = this->MacContentDirectory;
!     this->CreateFramework(targetName);
      }
    else if(relink)

Index: cmMakefileLibraryTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileLibraryTargetGenerator.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C 2 -d -r1.8 -r1.9
*** cmMakefileLibraryTargetGenerator.h	9 Jul 2008 14:09:46 -0000	1.8
--- cmMakefileLibraryTargetGenerator.h	2 Sep 2008 16:06:32 -0000	1.9
***************
*** 38,42 ****
    // MacOSX Framework support methods
    void WriteFrameworkRules(bool relink);
!   void CreateFramework();
  
    // Store the computd framework version for OS X Frameworks.
--- 38,42 ----
    // MacOSX Framework support methods
    void WriteFrameworkRules(bool relink);
!   void CreateFramework(std::string const& targetName);
  
    // Store the computd framework version for OS X Frameworks.

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.224
retrieving revision 1.225
diff -C 2 -d -r1.224 -r1.225
*** cmTarget.cxx	19 Aug 2008 15:43:51 -0000	1.224
--- cmTarget.cxx	2 Sep 2008 16:06:32 -0000	1.225
***************
*** 590,593 ****
--- 590,613 ----
  
    cm->DefineProperty
+     ("MACOSX_FRAMEWORK_INFO_PLIST", cmProperty::TARGET,
+      "Specify a custom Info.plist template for a Mac OS X Framework.",
+      "An library target with FRAMEWORK enabled will be built as a "
+      "framework on Mac OS X.  "
+      "By default its Info.plist file is created by configuring a template "
+      "called MacOSXFrameworkInfo.plist.in located in the CMAKE_MODULE_PATH.  "
+      "This property specifies an alternative template file name which "
+      "may be a full path.\n"
+      "The following target properties may be set to specify content to "
+      "be configured into the file:\n"
+      "  MACOSX_FRAMEWORK_ICON_FILE\n"
+      "  MACOSX_FRAMEWORK_IDENTIFIER\n"
+      "  MACOSX_FRAMEWORK_SHORT_VERSION_STRING\n"
+      "  MACOSX_FRAMEWORK_BUNDLE_VERSION\n"
+      "CMake variables of the same name may be set to affect all targets "
+      "in a directory that do not have each specific property set.  "
+      "If a custom Info.plist is specified by this property it may of course "
+      "hard-code all the settings instead of using the target properties.");
+ 
+   cm->DefineProperty
      ("ENABLE_EXPORTS", cmProperty::TARGET,
       "Specify whether an executable exports symbols for loadable modules.",



More information about the Cmake-commits mailing list