Also, if it&#39;s a Qt app, look into the relatively new (in 2.8.7 and later, I think) module &quot;DeployQt4&quot; [ <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&#39;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">&lt;<a href="mailto:mike.jackson@bluequartz.net" target="_blank">mike.jackson@bluequartz.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Look into &quot;BundleUtilities&quot; 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 &quot;Makefiles&quot; 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>
&gt; Hi<br>
&gt;<br>
&gt; I&#39;m a new OSX developer with many years of experience developing<br>
&gt; applications using Emacs and Makefiles and I&#39;m not happy about<br>
&gt; resorting to Xcode on OSX. So I&#39;m trying to compile and create OSX<br>
&gt; bundles using CMake. Getting the application I&#39;m currently working on<br>
&gt; to build was no problem - it required just a few tweaks, since I have<br>
&gt; happily used CMake to build on Linux for years.<br>
&gt;<br>
&gt; But I&#39;m not sure how to handle bundle creation!<br>
&gt;<br>
&gt; I have two uses for bundles - first I have to create a bundle for<br>
&gt; running the application during development, and second I have to<br>
&gt; create a bundle for distribution. They could probably be the same, but<br>
&gt; I&#39;m mostly concerned about the first for now. So my problem is not<br>
&gt; including library dependencies in the bundle, but rather to include<br>
&gt; the application libraries, executables, plugins and resources for<br>
&gt; testing the application after each code change.<br>
&gt;<br>
&gt; There are a lot of alternatives to do this it seems: using<br>
&gt; MACOSX_BUNDLE for the add_executable function call, using CPack or<br>
&gt; creating the directory structure &quot;by hand&quot;.<br>
&gt;<br>
&gt; So, my directory structure looks something like this:<br>
&gt;<br>
&gt; /plugins/plugin-A - Code for plugin A (shared library)<br>
&gt; /plugins/plugin-B - Code for plugin B (shared library)<br>
&gt; /libapp           - Application logic code<br>
&gt; /ui               - User interface code (contains the main() function)<br>
&gt; /data/pictures    - Picture resources<br>
&gt; /data/settings    - XML-files etc<br>
&gt;<br>
&gt; I have a root CMakeLists.txt that just declares the top project, sets<br>
&gt; some variables and calls add_subdirectory() for each subdirectory<br>
&gt; (plugins, libapp, ui, data).<br>
&gt;<br>
&gt; The &quot;plugin&quot; and &quot;libapp&quot; subdirectories contains CMakeLists.txt that<br>
&gt; create (shared and static) libraries.<br>
&gt;<br>
&gt; The &quot;ui&quot; subdirectory contains the add_executable() function call that<br>
&gt; builds the executable and links to &quot;libapp&quot;.<br>
&gt;<br>
&gt; Also, each directory has a CMakeLists.txt that contains installation<br>
&gt; instructions for standard unix installation.<br>
&gt;<br>
&gt; Now, the easiest way to create a bundle is to add MACOSX_BUNDLE to<br>
&gt; add_executable in &quot;ui&quot;. This creates a new bundle &quot;/ui/ui.app&quot; that<br>
&gt; contains an Info.plist and the executable. But I must also add plugins<br>
&gt; and resources to this bundle before I&#39;m able to run it. What&#39;s the<br>
&gt; best way to handle this? I don&#39;t like the idea that it is the<br>
&gt; add_executable-function that creates the bundle - the bundle should be<br>
&gt; for the entire project, not just that executable.<br>
&gt;<br>
&gt; Since each subdirectory include an install() function call the<br>
&gt; information about what to put in the bundle is more or less there<br>
&gt; already: the same files should be put in the bundle as would be<br>
&gt; installed on other Unix-systems (but in a different directory<br>
&gt; structure).<br>
&gt;<br>
&gt; I&#39;ve played around with setting LIBRARY_OUTPUT_DIRECTORY to<br>
&gt; &quot;/theapp.app/Contents/PlugIns&quot; for each plugin and similar for the<br>
&gt; executable, and it kinda works, but it feels hackish. And I&#39;m not sure<br>
&gt; how to add resources in the same way. And Info.plist is not created<br>
&gt; automatically, so I have to create it myself or perhaps set the output<br>
&gt; path of the bundle created by MACOSX_BUNDLE to the same path …<br>
&gt;<br>
&gt; Best practices? Is there even anyone doing it this way, or is everyone<br>
&gt; using Xcode?<br>
&gt;<br>
&gt; Regards,<br>
&gt; Jonatan Magnusson<br>
&gt;<br>
&gt; (I&#39;ve sent this mail before, last week, but it never got out on the<br>
&gt; mailing list, so I&#39;m sending again. Sorry about any duplicates.)<br>
&gt; --<br>
&gt;<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <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>