[Cmake-commits] [cmake-commits] king committed cmLocalGenerator.cxx 1.274 1.275 cmTarget.cxx 1.217 1.218
cmake-commits at cmake.org
cmake-commits at cmake.org
Sat May 17 12:53:58 EDT 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv15849/Source
Modified Files:
cmLocalGenerator.cxx cmTarget.cxx
Log Message:
ENH: Allow users to specify a custom Info.plist template
- Create MACOSX_BUNDLE_INFO_PLIST target property to specify template.
- Look for MacOSXBundleInfo.plist.in in CMAKE_MODULE_PATH by default.
- See issue #6983.
Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.274
retrieving revision 1.275
diff -C 2 -d -r1.274 -r1.275
*** cmLocalGenerator.cxx 30 Apr 2008 17:26:03 -0000 1.274
--- cmLocalGenerator.cxx 17 May 2008 16:53:56 -0000 1.275
***************
*** 2777,2790 ****
//----------------------------------------------------------------------------
! static std::string cmLGInfoProp(cmTarget* target, const char* prop)
{
if(const char* val = target->GetProperty(prop))
{
! return val;
! }
! else
! {
! // For compatibility check for a variable.
! return target->GetMakefile()->GetSafeDefinition(prop);
}
}
--- 2777,2785 ----
//----------------------------------------------------------------------------
! static void cmLGInfoProp(cmMakefile* mf, cmTarget* target, const char* prop)
{
if(const char* val = target->GetProperty(prop))
{
! mf->AddDefinition(prop, val);
}
}
***************
*** 2795,2859 ****
const char* fname)
{
! std::string info_EXECUTABLE_NAME = targetName;
!
! // Lookup the properties.
! std::string info_INFO_STRING =
! cmLGInfoProp(target, "MACOSX_BUNDLE_INFO_STRING");
! std::string info_ICON_FILE =
! cmLGInfoProp(target, "MACOSX_BUNDLE_ICON_FILE");
! std::string info_GUI_IDENTIFIER =
! cmLGInfoProp(target, "MACOSX_BUNDLE_GUI_IDENTIFIER");
! std::string info_LONG_VERSION_STRING =
! cmLGInfoProp(target, "MACOSX_BUNDLE_LONG_VERSION_STRING");
! std::string info_BUNDLE_NAME =
! cmLGInfoProp(target, "MACOSX_BUNDLE_BUNDLE_NAME");
! std::string info_SHORT_VERSION_STRING =
! cmLGInfoProp(target, "MACOSX_BUNDLE_SHORT_VERSION_STRING");
! std::string info_BUNDLE_VERSION =
! cmLGInfoProp(target, "MACOSX_BUNDLE_BUNDLE_VERSION");
! std::string info_COPYRIGHT =
! cmLGInfoProp(target, "MACOSX_BUNDLE_COPYRIGHT");
! // Generate the file.
! cmGeneratedFileStream fout(fname);
! fout.SetCopyIfDifferent(true);
! fout <<
! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
! "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"\n"
! " \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
! "<plist version=\"1.0\">\n"
! "<dict>\n"
! "\t<key>CFBundleDevelopmentRegion</key>\n"
! "\t<string>English</string>\n"
! "\t<key>CFBundleExecutable</key>\n"
! "\t<string>" << info_EXECUTABLE_NAME << "</string>\n"
! "\t<key>CFBundleGetInfoString</key>\n"
! "\t<string>" << info_INFO_STRING << "</string>\n"
! "\t<key>CFBundleIconFile</key>\n"
! "\t<string>" << info_ICON_FILE << "</string>\n"
! "\t<key>CFBundleIdentifier</key>\n"
! "\t<string>" << info_GUI_IDENTIFIER << "</string>\n"
! "\t<key>CFBundleInfoDictionaryVersion</key>\n"
! "\t<string>6.0</string>\n"
! "\t<key>CFBundleLongVersionString</key>\n"
! "\t<string>" << info_LONG_VERSION_STRING << "</string>\n"
! "\t<key>CFBundleName</key>\n"
! "\t<string>" << info_BUNDLE_NAME << "</string>\n"
! "\t<key>CFBundlePackageType</key>\n"
! "\t<string>APPL</string>\n"
! "\t<key>CFBundleShortVersionString</key>\n"
! "\t<string>" << info_SHORT_VERSION_STRING << "</string>\n"
! "\t<key>CFBundleSignature</key>\n"
! "\t<string>????" /* break string to avoid trigraph */ "</string>\n"
! "\t<key>CFBundleVersion</key>\n"
! "\t<string>" << info_BUNDLE_VERSION << "</string>\n"
! "\t<key>CSResourcesFileMapped</key>\n"
! "\t<true/>\n"
! "\t<key>LSRequiresCarbon</key>\n"
! "\t<true/>\n"
! "\t<key>NSHumanReadableCopyright</key>\n"
! "\t<string>" << info_COPYRIGHT << "</string>\n"
! "</dict>\n"
! "</plist>\n"
! ;
}
--- 2790,2829 ----
const char* fname)
{
! // Find the Info.plist template.
! const char* in = target->GetProperty("MACOSX_BUNDLE_INFO_PLIST");
! std::string inFile = (in && *in)? in : "MacOSXBundleInfo.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_BUNDLE_EXECUTABLE_NAME", targetName);
! cmLGInfoProp(mf, target, "MACOSX_BUNDLE_INFO_STRING");
! cmLGInfoProp(mf, target, "MACOSX_BUNDLE_ICON_FILE");
! cmLGInfoProp(mf, target, "MACOSX_BUNDLE_GUI_IDENTIFIER");
! cmLGInfoProp(mf, target, "MACOSX_BUNDLE_LONG_VERSION_STRING");
! cmLGInfoProp(mf, target, "MACOSX_BUNDLE_BUNDLE_NAME");
! cmLGInfoProp(mf, target, "MACOSX_BUNDLE_SHORT_VERSION_STRING");
! cmLGInfoProp(mf, target, "MACOSX_BUNDLE_BUNDLE_VERSION");
! cmLGInfoProp(mf, target, "MACOSX_BUNDLE_COPYRIGHT");
! mf->ConfigureFile(inFile.c_str(), fname, false, false, false);
! mf->PopScope();
}
Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.217
retrieving revision 1.218
diff -C 2 -d -r1.217 -r1.218
*** cmTarget.cxx 14 May 2008 15:54:52 -0000 1.217
--- cmTarget.cxx 17 May 2008 16:53:56 -0000 1.218
***************
*** 548,555 ****
"on Mac OS X will be created as an application bundle. "
"This makes it a GUI executable that can be launched from "
! "the Finder.\n"
! "The bundle Info.plist file is generated automatically. "
! "The following target properties may be set to specify "
! "its content:"
" MACOSX_BUNDLE_INFO_STRING\n"
" MACOSX_BUNDLE_ICON_FILE\n"
--- 548,566 ----
"on Mac OS X will be created as an application bundle. "
"This makes it a GUI executable that can be launched from "
! "the Finder. "
! "See the MACOSX_BUNDLE_INFO_PLIST target property for information "
! "about creation of the Info.plist file for the application bundle.");
!
! cm->DefineProperty
! ("MACOSX_BUNDLE_INFO_PLIST", cmProperty::TARGET,
! "Specify a custom Info.plist template for a Mac OS X App Bundle.",
! "An executable target with MACOSX_BUNDLE enabled will be built as an "
! "application bundle on Mac OS X. "
! "By default its Info.plist file is created by configuring a template "
! "called MacOSXBundleInfo.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_BUNDLE_INFO_STRING\n"
" MACOSX_BUNDLE_ICON_FILE\n"
***************
*** 560,564 ****
" MACOSX_BUNDLE_BUNDLE_VERSION\n"
" MACOSX_BUNDLE_COPYRIGHT\n"
! );
cm->DefineProperty
--- 571,578 ----
" MACOSX_BUNDLE_BUNDLE_VERSION\n"
" MACOSX_BUNDLE_COPYRIGHT\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
More information about the Cmake-commits
mailing list