diff --git a/Modules/MacOSXBundleInfo.plist.in b/Modules/MacOSXBundleInfo.plist.in
deleted file mode 100644
index a466dc7c4..000000000
--- a/Modules/MacOSXBundleInfo.plist.in
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- English
- CFBundleExecutable
- ${MACOSX_BUNDLE_EXECUTABLE_NAME}
- CFBundleGetInfoString
- ${MACOSX_BUNDLE_INFO_STRING}
- CFBundleIconFile
- ${MACOSX_BUNDLE_ICON_FILE}
- CFBundleIdentifier
- ${MACOSX_BUNDLE_GUI_IDENTIFIER}
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleLongVersionString
- ${MACOSX_BUNDLE_LONG_VERSION_STRING}
- CFBundleName
- ${MACOSX_BUNDLE_BUNDLE_NAME}
- CFBundlePackageType
- APPL
- CFBundleShortVersionString
- ${MACOSX_BUNDLE_SHORT_VERSION_STRING}
- CFBundleSignature
- ????
- CFBundleVersion
- ${MACOSX_BUNDLE_BUNDLE_VERSION}
- CSResourcesFileMapped
-
- LSRequiresCarbon
-
- NSHumanReadableCopyright
- ${MACOSX_BUNDLE_COPYRIGHT}
-
-
diff --git a/Modules/MacOSXFrameworkInfo.plist.in b/Modules/MacOSXFrameworkInfo.plist.in
deleted file mode 100644
index 46287aa10..000000000
--- a/Modules/MacOSXFrameworkInfo.plist.in
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- English
- CFBundleExecutable
- ${MACOSX_FRAMEWORK_NAME}
- CFBundleGetInfoString
- ${MACOSX_FRAMEWORK_INFO_STRING}
- CFBundleIdentifier
- ${MACOSX_FRAMEWORK_IDENTIFIER}
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundlePackageType
- FMWK
- CFBundleShortVersionString
- ${MACOSX_FRAMEWORK_SHORT_VERSION_STRING}
- CFBundleSignature
- ????
- CFBundleVersion
- ${MACOSX_FRAMEWORK_BUNDLE_VERSION}
- CSResourcesFileMapped
-
- NSHumanReadableCopyright
- ${MACOSX_FRAMEWORK_COPYRIGHT}
-
-
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index c2b055849..de62e8f86 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1482,18 +1482,15 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
if(target.GetPropertyAsBool("MACOSX_BUNDLE"))
{
productType = "com.apple.product-type.application";
- std::string f1 =
- this->CurrentMakefile->GetModulesFile("MacOSXBundleInfo.plist.in");
- if ( f1.size() == 0 )
- {
- cmSystemTools::Error("could not find Mac OSX bundle template file.");
- }
- std::string f2 = this->CurrentMakefile->GetCurrentOutputDirectory();
- f2 += "/Info.plist";
- this->CurrentMakefile->ConfigureFile(f1.c_str(), f2.c_str(),
- false, false, false);
- std::string path =
- this->ConvertToRelativeForXCode(f2.c_str());
+ std::string plist = this->CurrentMakefile->GetCurrentOutputDirectory();
+ plist += cmake::GetCMakeFilesDirectory();
+ plist += "/";
+ plist += target.GetName();
+ plist += "Info.plist";
+ this->CurrentLocalGenerator
+ ->GenerateAppleInfoPList(&target, productName.c_str(), plist.c_str());
+ std::string path =
+ this->ConvertToRelativeForXCode(plist.c_str());
buildSettings->AddAttribute("INFOPLIST_FILE",
this->CreateString(path.c_str()));
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 100b613da..abf4a303f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2732,3 +2732,86 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
// Assume it is supported.
return true;
}
+
+//----------------------------------------------------------------------------
+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);
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target,
+ const char* targetName,
+ 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 <<
+ "\n"
+ "\n"
+ "\n"
+ "\n"
+ "\tCFBundleDevelopmentRegion\n"
+ "\tEnglish\n"
+ "\tCFBundleExecutable\n"
+ "\t" << info_EXECUTABLE_NAME << "\n"
+ "\tCFBundleGetInfoString\n"
+ "\t" << info_INFO_STRING << "\n"
+ "\tCFBundleIconFile\n"
+ "\t" << info_ICON_FILE << "\n"
+ "\tCFBundleIdentifier\n"
+ "\t" << info_GUI_IDENTIFIER << "\n"
+ "\tCFBundleInfoDictionaryVersion\n"
+ "\t6.0\n"
+ "\tCFBundleLongVersionString\n"
+ "\t" << info_LONG_VERSION_STRING << "\n"
+ "\tCFBundleName\n"
+ "\t" << info_BUNDLE_NAME << "\n"
+ "\tCFBundlePackageType\n"
+ "\tAPPL\n"
+ "\tCFBundleShortVersionString\n"
+ "\t" << info_SHORT_VERSION_STRING << "\n"
+ "\tCFBundleSignature\n"
+ "\t????" /* break string to avoid trigraph */ "\n"
+ "\tCFBundleVersion\n"
+ "\t" << info_BUNDLE_VERSION << "\n"
+ "\tCSResourcesFileMapped\n"
+ "\t\n"
+ "\tLSRequiresCarbon\n"
+ "\t\n"
+ "\tNSHumanReadableCopyright\n"
+ "\t" << info_COPYRIGHT << "\n"
+ "\n"
+ "\n"
+ ;
+}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index c55f6a332..6b3b7ea63 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -269,6 +269,12 @@ public:
bool NeedBackwardsCompatibility(unsigned int major,
unsigned int minor,
unsigned int patch = 0xFFu);
+
+ /**
+ * Generate a Mac OS X application bundle Info.plist file.
+ */
+ void GenerateAppleInfoPList(cmTarget* target, const char* targetName,
+ const char* fname);
protected:
/** Construct a comment for a custom command. */
std::string ConstructComment(const cmCustomCommand& cc,
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index bb54f265c..0114fa579 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -133,13 +133,6 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
outpath += "/";
// Make bundle directories
- std::string f1 =
- this->Makefile->GetModulesFile("MacOSXBundleInfo.plist.in");
- if ( f1.size() == 0 )
- {
- cmSystemTools::Error("could not find Mac OSX bundle template file.");
- }
-
std::vector::const_iterator sourceIt;
for ( sourceIt = this->Target->GetSourceFiles().begin();
sourceIt != this->Target->GetSourceFiles().end();
@@ -162,11 +155,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Configure the Info.plist file. Note that it needs the executable name
// to be set.
- std::string f2 = macdir + "Info.plist";
- this->Makefile->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME",
- targetName.c_str());
- this->Makefile->ConfigureFile(f1.c_str(), f2.c_str(),
- false, false, false);
+ std::string plist = macdir + "Info.plist";
+ this->LocalGenerator->GenerateAppleInfoPList(this->Target,
+ targetName.c_str(),
+ plist.c_str());
}
#endif
std::string outpathImp;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index d0e2fcbfb..f6115622b 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -364,22 +364,6 @@ void cmMakefileLibraryTargetGenerator::CreateFramework(
//cmSystemTools::MakeDirectory((macdir + "Libraries").c_str());
cmSystemTools::MakeDirectory((macdir + "Headers").c_str());
- // Configure the Info.plist file. Note that it needs the executable name
- // to be set
- std::string rsrcDir = macdir + "Resources/";
- cmSystemTools::MakeDirectory(rsrcDir.c_str());
- this->Makefile->AddDefinition("MACOSX_FRAMEWORK_NAME",
- targetName.c_str());
- std::string f1 =
- this->Makefile->GetModulesFile("MacOSXFrameworkInfo.plist.in");
- if ( f1.size() == 0 )
- {
- cmSystemTools::Error(
- "could not find Mac OSX framework Info.plist template file.");
- }
- std::string f2 = rsrcDir + "Info.plist";
- this->Makefile->ConfigureFile(f1.c_str(), f2.c_str(),
- false, false, false);
this->CopyFrameworkSources(targetName, outpath, version,
"PRIVATE_HEADER", "PrivateHeaders");
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index c043eceb7..0422ffc3f 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -510,7 +510,19 @@ void cmTarget::DefineProperties(cmake *cm)
"When this property is set to true the executable when built "
"on Mac OS X will be created as an application bundle. "
"This makes it a GUI executable that can be launched from "
- "the Finder.");
+ "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"
+ " MACOSX_BUNDLE_GUI_IDENTIFIER\n"
+ " MACOSX_BUNDLE_LONG_VERSION_STRING\n"
+ " MACOSX_BUNDLE_BUNDLE_NAME\n"
+ " MACOSX_BUNDLE_SHORT_VERSION_STRING\n"
+ " MACOSX_BUNDLE_BUNDLE_VERSION\n"
+ " MACOSX_BUNDLE_COPYRIGHT\n"
+ );
cm->DefineProperty
("ENABLE_EXPORTS", cmProperty::TARGET,