[CMake] Problems on OS X with fixup_bundle

Ed sbfreddie at comcast.net
Sun Feb 17 22:45:10 EST 2013


All:
I am trying to fix one last problem with the bundle being created with Cmake.
This problem is unique to OS X, as the app is being created for Windows, and Linux with no problems.
After all the pieces are built and assembled together into the .app bundle we call fixup_bundle like so:

IF(APPLE)
# -- Run the BundleUtilities cmake code
  SET(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/buildosx/Info.plist")

  SET(APPS "\${CMAKE_INSTALL_PREFIX}/OpenCPN.app")
  SET(DIRS "")

  SET(LIBS "\${CMAKE_INSTALL_PREFIX}/OpenCPN.app/Contents/PlugIns/libdashboard_pi.dylib")
  SET(LIBS
      ${LIBS} "\${CMAKE_INSTALL_PREFIX}/OpenCPN.app/Contents/PlugIns/libgrib_pi.dylib")

  INSTALL(CODE "
   include(BundleUtilities)
   fixup_bundle(\"${APPS}\"   \"${LIBS}\"   \"${DIRS}\")
   " COMPONENT Runtime)

Previously we have copied into the .app bundle at location OpenCPN.app/Contents/PlugIns the plugins .dylibs with this command:

	foreach(pi ${CMAKE_CURRENT_BINARY_DIR}/plugins/dashboard_pi/libdashboard_pi.dylib;${CMAKE_CURRENT_BINARY_DIR}/plugins/grib_pi/libgrib_pi.dylib)
		install(PROGRAMS ${pi}
		DESTINATION "${MACOSX_PACKAGE_LOCATION}/${PACKAGE_NAME}.app/Contents/PlugIns"
        )
	endforeach()

So far so good, when fixup_bundle runs it completes without any errors.  All the .dylibs and the main app have had the paths fixed so they all refer to each other or the systems libs which are common to all Macs.

But the plugins .dylibs still have the paths for all dependencies (which are wxWidgets .dylibs) still pointing to the place were they were originally built, which was built using homebrew.
My question is can I tell Cmake to fix these paths or do I have to do it manually with the systems command "install_name_tool".

TIA,
Ed



More information about the CMake mailing list