[CMake] Mac OS X app Bundles & Opening Files
Geoffrey Hutchison
geoff at geoffhutchison.net
Wed Mar 28 13:46:45 EST 2007
On Mar 28, 2007, at 2:10 PM, Mike Jackson wrote:
> has a review of what might be needed. I have no idea what version
> of Qt is used in the examples. I'll leave it as an exercise for the
> reader.
Aha. Forgot about that! For future reference, that was for Qt-3.x.
Here's the updated version for Qt-4.x:
http://doc.trolltech.com/qq/qq18-macfeatures.html
That took about 2 minutes. Thanks!
> Also.. Could you post your cmake files and other associated scripts/
> settings that you use to create the .app package? I have to hack
> stuff together for every project. I would be nice to have a good
> example of how to do this.
In my src/ directory, I have a mac/ subdir with my "atom.icns" file
and a local copy of the "MacOSXBundleInfo.plist.in" from CMake/
Modules. (Do a "locate" command and it'll turn up.) The .plist.in
file has been edited to our needs.
Then in CMakeLists.txt: (there may be mail wrapping -- things should
be on one line)
# ...
IF( APPLE )
SET( MACOSX_BUNDLE_INFO_STRING "Avogadro - version 0.0.3" )
SET( MACOSX_BUNDLE_BUNDLE_VERSION "0.0.3" )
# Change following line to point to actual icns file in bundle.
SET( MACOSX_BUNDLE_ICON_FILE "atom.icns" )
SET( MACOSX_BUNDLE_GUI_IDENTIFIER "net.sourceforge" )
SET( MACOSX_BUNDLE_BUNDLE_NAME "Avogadro" )
# Need to copy the icon file
EXEC_PROGRAM( "mkdir -p ${avogadro_BINARY_DIR}/src/
Avogadro.app/Contents/Resources")
EXEC_PROGRAM( "cp ${avogadro_SOURCE_DIR}/src/mac/atom.icns $
{avogadro_BINARY_DIR}/src/Avogadro.app/Contents/Resources")
# Overload the Info.plist default
SET( CMAKE_MODULE_PATH ${avogadro_SOURCE_DIR}/src/mac $
{CMAKE_MODULE_PATH} )
ENDIF( APPLE)
add_executable(avogadro-app WIN32 MACOSX_BUNDLE
# ...
There are other MACOSX_BUNDLE settings which I should use, but it's
an early development version. :-)
http://www.cmake.org/Wiki/CMake:Bundles_And_Frameworks
Cheers,
-Geoff
More information about the CMake
mailing list