[CMake] Mac application bundles & resources

Axel Roebel Axel.Roebel at ircam.fr
Fri Nov 3 08:46:37 EST 2006


On Friday 03 November 2006 14:03, cmake-request at cmake.org wrote:

> Message: 1
> Date: Thu, 2 Nov 2006 21:44:32 +0000
> From: Matthew J Smith <indigojo at blogistan.co.uk>
> Subject: [CMake] Mac application bundles & resources
> To: cmake at cmake.org
> Message-ID: <3EB607FF-F677-47B9-AF55-777C32453042 at blogistan.co.uk>
> Content-Type: text/plain; charset="us-ascii"
>
> Hi everyone,
>
> I've been approached to get a Mac application bundle built for the
> Speedcrunch calculator app (speedcrunch.digitalfanatics.org).  The
> app uses Qt 4 and is normally built using qmake, but the developers
> have started using CMake, which for the X11 install model (binaries
> in /usr/bin, resources in /usr/share) works fine.  However, although
> I can get CMake to build an application bundle, I can't find any
> instructions as to how to get the resources to install in the
> Resources directory within the bundle.
>
> Does CMake even have this feature, and if so, can anyone tell me how
> to do this?  I'm using version 2.4.3.  I've attached my CMakeLists.txt.
>
> Matt Smith
> --
>
> http://www.blogistan.co.uk/qt/
>

I don't think that exists. 

Here a hand made solution:

What I do to install an icon file is

SET(EXECUTABLE_OUTPUT_PATH ...)
ADD_EXECUTABLE(svp_kernel_app  MACOSX_BUNDLE  ${prgSOURCES} ${SHOW_VERSION_PRG_K} )
ADD_CUSTOM_TARGET(svp_kernel COMMAND  cp  ${CMAKE_CURRENT_SOURCE_DIR}/../../distribution/supervp.icns ${EXECUTABLE_OUTPUT_PATH}/supervp${DEBUGEXT}.app/Contents/
Resources)
ADD_DEPENDENCIES(svp_kernel svp_kernel_app)

This means a bundle target is used to create the binaries in the app
and the custom target is used to copy the icon. The only target I use during the build stage
is svp_kernel which  first creates the bundle binary and then copies the icon.

You may as well try to use configure_file to put the resources in place.
It seems to me cmake is creating the bundle directory during cmake run time
and the make system will never touch these directories later again.
So I suppose  you can call configure_file to put
all resources in the right place when running cmake.

You need to know where and how to put them correctly
using command line tools though.


-- 
Axel Roebel    
IRCAM Analysis/Synthesis Team
Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540


More information about the CMake mailing list