Hi all,

I am trying to extend my CMake setup to properly make a max osx application bundle.

I figured out how to use SET_SOURCE_FILES_PROPERTIES with MACOSX_PACKAGE_LOCATION and SET_TARGET_PROPERTIES for doing most of the stuff. However, I can not get my generated Xcode project to copy plugins into the application bundle. I was wondering what I am doing wrong?

The CMake snippet below sketch the steps that I am doing. Could somebody please tell me what is wrong? or if there is an easier way of doing this?

best regards

Kenny

-----------------------------------------------------------------------------

IF(APPLE)

  # Mac OS X bundle specific settings
  set(MACOSX_BUNDLE true)
  set(MACOSX_BUNDLE_BUNDLE_NAME ${MY_APP_NAME})
  set(MACOSX_BUNDLE_INFO_STRING "${MY_APP_NAME} ${MY_APP_VERSION}")
  set(MACOSX_BUNDLE_LONG_VERSION_STRING "${MY_APP_VERSION}")
  set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${MY_APP_VERSION}")
  set(MACOSX_BUNDLE_BUNDLE_VERSION "${MY_APP_VERSION}")
  set(MACOSX_BUNDLE_ICON_FILE "${PROJECT_SOURCE_DIR}/${MY_APP_NAME}.icns")

  # Locate all recourses
  FILE(GLOB COPY_RESOURCES ${PROJECT_SOURCE_DIR}/bin/*.cfg)
  SET_SOURCE_FILES_PROPERTIES(
    "${COPY_RESOURCES}"
    PROPERTIES
    MACOSX_PACKAGE_LOCATION Resources
  )

  # Find all frameworks
  FIND_LIBRARY(
    OGRE_FWK  Ogre
    ${OGRE_FRAMEWORK_PATH}
    DOC "The path to Ogre.Framework"
    )
  FIND_LIBRARY(
    OIS_FWK  OIS
    ${OIS_FRAMEWORK_PATH}
    DOC "The path to OIS.Framework"
    )
  SET(COPY_FRAMEWORKS  ${OGRE_FWK} ${OIS_FWK})
  SET_SOURCE_FILES_PROPERTIES(
    ${COPY_FRAMEWORKS}
    PROPERTIES
    MACOSX_PACKAGE_LOCATION Frameworks
    )

  # Find all plugins
  SET(
    PLUGING_NAMES
    "RenderSystem_GL"
    "Plugin_ParticleFX"
    "Plugin_BSPSceneManager"
    "Plugin_CgProgramManager"
    "Plugin_PCZSceneManager"
    "Plugin_OctreeZone"
    "Plugin_OctreeSceneManager"
    )
  FOREACH(name ${PLUGING_NAMES})
    IF(EXISTS ${OGRE_${name}_LIBRARY_REL})
      SET(COPY_PLUGINS  ${COPY_PLUGINS} ${OGRE_${name}_LIBRARY_REL})
    ENDIF()
    IF(EXISTS ${OGRE_${name}_LIBRARY_DBG})
      SET(COPY_PLUGINS  ${COPY_PLUGINS} ${OGRE_${name}_LIBRARY_DBG})
    ENDIF()
  ENDFOREACH(name)

  # Kenny : This does not quite seem to work as it should with Xcode?
  SET_SOURCE_FILES_PROPERTIES(
    "${COPY_PLUGINS}"
    PROPERTIES
    MACOSX_PACKAGE_LOCATION PlugIns
    )

ENDIF(APPLE)


INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR} )

FILE(GLOB SRCS *.cpp )
FILE(GLOB  HDRS *.h  )

ADD_EXECUTABLE(
  ${MY_APP_NAME}
  MACOSX_BUNDLE
  ${SRCS}
  ${HDRS}
  ${COPY_RESOURCES}
  ${COPY_FRAMEWORKS}
  ${COPY_PLUGINS}
  )

IF(APPLE)

  # Add resources to application bundle target
  SET_TARGET_PROPERTIES(
    ${MY_APP_NAME}
    PROPERTIES
    RESOURCE "${COPY_RESOURCES}"
    )

ENDIF(APPLE)

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to