diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2006-01-05 14:13:06 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2006-01-05 14:13:06 (GMT) |
commit | 7b1440ab9fef6d240eb5beb333ac606f966486a4 (patch) | |
tree | 6726bf3178e42757fedb06ce1623c76f29d7eb59 /Source | |
parent | 11cd7b0b3f20b384220e65c4ef9de5afea0b1618 (diff) | |
download | CMake-7b1440ab9fef6d240eb5beb333ac606f966486a4.zip CMake-7b1440ab9fef6d240eb5beb333ac606f966486a4.tar.gz CMake-7b1440ab9fef6d240eb5beb333ac606f966486a4.tar.bz2 |
ENH: fix bundles for Mac and Xcode
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmAddExecutableCommand.cxx | 23 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 28 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 21 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 1 |
4 files changed, 50 insertions, 23 deletions
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index f70e790..71e338d 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -64,29 +64,6 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args) if ( use_macbundle) { tgt->SetProperty("MACOSX_BUNDLE", "ON"); -#ifdef __APPLE__ - std::string f1 = m_Makefile->GetModulesFile("MacOSXBundleInfo.plist.in"); - if ( f1.size() == 0 ) - { - this->SetError("could not find Mac OSX bundle template file."); - return false; - } - std::string macdir = m_Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); - if ( macdir.size() == 0 ) - { - macdir = m_Makefile->GetCurrentOutputDirectory(); - } - if(macdir.size() && macdir[macdir.size()-1] != '/') - { - macdir += "/"; - } - macdir += exename + ".app/Contents/"; - std::string f2 = macdir + "Info.plist"; - macdir += "MacOS"; - cmSystemTools::MakeDirectory(macdir.c_str()); - m_Makefile->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", exename.c_str()); - m_Makefile->ConfigureFile(f1.c_str(), f2.c_str(), false, false, false); -#endif } return true; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e4754b3..f8c4f5a 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -505,6 +505,10 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, { sourcecode += ".cpp.objc"; } + else if(ext == "plist") + { + sourcecode += ".text.plist"; + } else if(!lang) { sourcecode += ext; @@ -1146,7 +1150,20 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, fileType = "compiled.mach-o.executable"; if(target.GetPropertyAsBool("MACOSX_BUNDLE")) { + std::string f1 = m_CurrentMakefile->GetModulesFile("MacOSXBundleInfo.plist.in"); + if ( f1.size() == 0 ) + { + cmSystemTools::Error("could not find Mac OSX bundle template file."); + } + std::string f2 = m_CurrentMakefile->GetCurrentOutputDirectory(); + f2 += "/Info.plist"; + m_CurrentMakefile->ConfigureFile(f1.c_str(), f2.c_str(), false, false, false); productType = "com.apple.product-type.application"; + std::string path = + this->ConvertToRelativeForXCode(f2.c_str()); + buildSettings->AddAttribute("INFOPLIST_FILE", + this->CreateString(path.c_str())); + } else { @@ -1777,6 +1794,17 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { cmTarget& cmtarget = l->second; + // add the soon to be generated Info.plist file as a source for a MACOSX_BUNDLE + // file + if(cmtarget.GetPropertyAsBool("MACOSX_BUNDLE")) + { + cmSourceFile file; + file.SetName("Info.plist", m_CurrentMakefile->GetCurrentOutputDirectory(), + m_CurrentMakefile->GetSourceExtensions(), + m_CurrentMakefile->GetHeaderExtensions()); + cmtarget.GetSourceFiles().push_back(m_CurrentMakefile->AddSource(file)); + } + std::vector<cmSourceFile*> & classes = cmtarget.GetSourceFiles(); for(std::vector<cmSourceFile*>::const_iterator s = classes.begin(); s != classes.end(); s++) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 7eb32d2..b8d080a 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1373,6 +1373,27 @@ cmLocalUnixMakefileGenerator3 // Make bundle directories outpath += target.GetName(); outpath += ".app/Contents/MacOS/"; + std::string f1 = m_Makefile->GetModulesFile("MacOSXBundleInfo.plist.in"); + if ( f1.size() == 0 ) + { + cmSystemTools::Error("could not find Mac OSX bundle template file."); + } + std::string macdir = m_Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); + if ( macdir.size() == 0 ) + { + macdir = m_Makefile->GetCurrentOutputDirectory(); + } + if(macdir.size() && macdir[macdir.size()-1] != '/') + { + macdir += "/"; + } + macdir += target.GetName(); + macdir += ".app/Contents/"; + std::string f2 = macdir + "Info.plist"; + macdir += "MacOS"; + cmSystemTools::MakeDirectory(macdir.c_str()); + m_Makefile->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", target.GetName()); + m_Makefile->ConfigureFile(f1.c_str(), f2.c_str(), false, false, false); } #endif std::string targetFullPath = outpath + targetName; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 2745905..dc4c2ea 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -73,6 +73,7 @@ cmMakefile::cmMakefile() "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|m|mm|rc|def|r|odl|idl|hpj|bat)$"); this->AddSourceGroup("Header Files", "\\.(h|h\\+\\+|hm|hpp|hxx|in|txx|inl)$"); this->AddSourceGroup("CMake Rules", "\\.rule$"); + this->AddSourceGroup("Resources", "\\.plist$"); this->AddDefaultDefinitions(); m_cmDefineRegex.compile("#cmakedefine[ \t]+([A-Za-z_0-9]*)"); m_cmDefine01Regex.compile("#cmakedefine01[ \t]+([A-Za-z_0-9]*)"); |