diff options
author | Brad King <brad.king@kitware.com> | 2008-02-14 20:31:08 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-02-14 20:31:08 (GMT) |
commit | 67f8c0fd104fe6ec1b6c1df2ebce6fdb9b2c811f (patch) | |
tree | 6b51fadf24500dea382988525e51e9c0e6d449bb /Source/cmLocalGenerator.cxx | |
parent | 7b1c305d864977a524e21b7b837a8582eb487d7c (diff) | |
download | CMake-67f8c0fd104fe6ec1b6c1df2ebce6fdb9b2c811f.zip CMake-67f8c0fd104fe6ec1b6c1df2ebce6fdb9b2c811f.tar.gz CMake-67f8c0fd104fe6ec1b6c1df2ebce6fdb9b2c811f.tar.bz2 |
ENH: Allow multiple OS X applications bundles to be created in a single build directory. Converted Info.plist files to be generated directly instead of configured with make variables. The MACOSX_BUNDLE_* variables are now properties (and vars for compatibility).
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 100b613..abf4a30 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 << + "<?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" + ; +} |