Also, if it's a Qt app, look into the relatively new (in 2.8.7 and later, I think) module "DeployQt4" [ <a href="http://cmake.org/cmake/help/v2.8.9/cmake.html#module:DeployQt4">http://cmake.org/cmake/help/v2.8.9/cmake.html#module:DeployQt4</a> ] which is based on BundleUtilities.<br>
<br>Here's a blog post about using it:<div><a href="http://mikemcquaid.com/2012/01/04/deploying-qt-applications-with-deployqt4/">http://mikemcquaid.com/2012/01/04/deploying-qt-applications-with-deployqt4/</a><br><br><br>
HTH,</div><div>David</div><div><br></div><div><br><div class="gmail_quote">On Mon, Oct 1, 2012 at 7:29 AM, Michael Jackson <span dir="ltr"><<a href="mailto:mike.jackson@bluequartz.net" target="_blank">mike.jackson@bluequartz.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Look into "BundleUtilities" and the add_executable with MACOSX_BUNDLE argument. BundleUtilities implicitly relies on the .app bundle structure already being in place. I have a Shell script that runs before BundleUtilities to setup some additional resource movement (icons, qt.conf...). I do all this from "Makefiles" generated for either Eclipse or QtCreator.<br>
___________________________________________________________<br>
Mike Jackson Principal Software Engineer<br>
BlueQuartz Software Dayton, Ohio<br>
<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a> <a href="http://www.bluequartz.net" target="_blank">www.bluequartz.net</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Oct 1, 2012, at 5:16 AM, Jonatan Magnusson wrote:<br>
<br>
> Hi<br>
><br>
> I'm a new OSX developer with many years of experience developing<br>
> applications using Emacs and Makefiles and I'm not happy about<br>
> resorting to Xcode on OSX. So I'm trying to compile and create OSX<br>
> bundles using CMake. Getting the application I'm currently working on<br>
> to build was no problem - it required just a few tweaks, since I have<br>
> happily used CMake to build on Linux for years.<br>
><br>
> But I'm not sure how to handle bundle creation!<br>
><br>
> I have two uses for bundles - first I have to create a bundle for<br>
> running the application during development, and second I have to<br>
> create a bundle for distribution. They could probably be the same, but<br>
> I'm mostly concerned about the first for now. So my problem is not<br>
> including library dependencies in the bundle, but rather to include<br>
> the application libraries, executables, plugins and resources for<br>
> testing the application after each code change.<br>
><br>
> There are a lot of alternatives to do this it seems: using<br>
> MACOSX_BUNDLE for the add_executable function call, using CPack or<br>
> creating the directory structure "by hand".<br>
><br>
> So, my directory structure looks something like this:<br>
><br>
> /plugins/plugin-A - Code for plugin A (shared library)<br>
> /plugins/plugin-B - Code for plugin B (shared library)<br>
> /libapp - Application logic code<br>
> /ui - User interface code (contains the main() function)<br>
> /data/pictures - Picture resources<br>
> /data/settings - XML-files etc<br>
><br>
> I have a root CMakeLists.txt that just declares the top project, sets<br>
> some variables and calls add_subdirectory() for each subdirectory<br>
> (plugins, libapp, ui, data).<br>
><br>
> The "plugin" and "libapp" subdirectories contains CMakeLists.txt that<br>
> create (shared and static) libraries.<br>
><br>
> The "ui" subdirectory contains the add_executable() function call that<br>
> builds the executable and links to "libapp".<br>
><br>
> Also, each directory has a CMakeLists.txt that contains installation<br>
> instructions for standard unix installation.<br>
><br>
> Now, the easiest way to create a bundle is to add MACOSX_BUNDLE to<br>
> add_executable in "ui". This creates a new bundle "/ui/ui.app" that<br>
> contains an Info.plist and the executable. But I must also add plugins<br>
> and resources to this bundle before I'm able to run it. What's the<br>
> best way to handle this? I don't like the idea that it is the<br>
> add_executable-function that creates the bundle - the bundle should be<br>
> for the entire project, not just that executable.<br>
><br>
> Since each subdirectory include an install() function call the<br>
> information about what to put in the bundle is more or less there<br>
> already: the same files should be put in the bundle as would be<br>
> installed on other Unix-systems (but in a different directory<br>
> structure).<br>
><br>
> I've played around with setting LIBRARY_OUTPUT_DIRECTORY to<br>
> "/theapp.app/Contents/PlugIns" for each plugin and similar for the<br>
> executable, and it kinda works, but it feels hackish. And I'm not sure<br>
> how to add resources in the same way. And Info.plist is not created<br>
> automatically, so I have to create it myself or perhaps set the output<br>
> path of the bundle created by MACOSX_BUNDLE to the same path …<br>
><br>
> Best practices? Is there even anyone doing it this way, or is everyone<br>
> using Xcode?<br>
><br>
> Regards,<br>
> Jonatan Magnusson<br>
><br>
> (I've sent this mail before, last week, but it never got out on the<br>
> mailing list, so I'm sending again. Sorry about any duplicates.)<br>
> --<br>
><br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br></div>