[CMake] CMake bundle app for OSX

as rmctodd at gmail.com
Fri Aug 28 18:38:07 EDT 2009


Hello:

I've been using CMake and CPack a bit on Linux. Now I have an
application that uses Qt and needs to be used on Linux and Mac OSX. I
want to create an installer using CMake / CPack for the application.
The application is called "following"

The following is from my CMakeLists.txt file

    set( MACOSX_RESOURCE_FILES ${CMAKE_SOURCE_DIR}/icons/ff.icns )

    set( MACOSX_BUNDLE_INFO_STRING "@EXE_NAME@ - Version ${VERSION}" )
    set( MACOSX_BUNDLE_BUNDLE_VERSION ${VERSION} )
    set( MACOSX_BUNDLE_ICON_FILE "ff.icns" )
    set( MACOSX_BUNDLE_GUI_IDENTIFIER "com.sri.aic" )
    set( MACOSX_BUNDLE_BUNDLE_NAME "@EXE_NAME@" )

    add_executable( ${MODULE} MACOSX_BUNDLE
        ${SOURCE_FILES}
        ${MOC_SOURCE_FILES}
        ${UI_SOURCE_FILES}
        ${RESOURCE_SOURCE_FILES}
        ${HEADER_FILES}
        ${MACOSX_RESOURCE_FILES}
        )
    target_link_libraries( ${MODULE} ${QT_LIBRARIES})
    set_source_files_properties(
      ${MACOSX_RESOURCE_FILES}
      PROPERTIES
      MACOSX_PACKAGE_LOCATION Resources
      )

This creates a folder called following.app/ with the appropriate
sub-directories and contents. I can zip it up and send it to the
perspn who needs to install it? My question is how do I create an
installer based on this? (for instance like a .dmg file or something?)
What are the CPACK variables I need to set? Does anybody have an
example file?

Thanks,
Aravind.

PS. I'm a newbie as far as OSX is concerned - so please bear with poor notation.


More information about the CMake mailing list