[CMake] CPack OS X bundle : generator expression for CPACK_BUNDLE_STARTUP_COMMAND

Nicholas Yue yue.nicholas at gmail.com
Tue Nov 28 19:50:28 EST 2017


I am using CMake 3.10

I can't seems to find a way to tell the OS X bundle where to find the
compiled binary.

I get the following errors:

Run CPack packaging tool...
CPack: Create package using Bundle
CPack: Install projects
CPack: - Run preinstall target for: OSXBundle
CPack: - Install project: OSXBundle
CPack: Create package
CPack Error: Error copying $<TARGET_FILE:myapp> to
/Users/nicholas/projects/OSX_BundleRPath/build/_CPack_Packages/Darwin/Bundle/OSXBundle-0.1.1-Darwin/MyApp.app/Contents/MacOS/MyApp
CPack Error: Error copying startup command.  Check the value of
CPACK_BUNDLE_STARTUP_COMMAND.
CPack Error: Problem compressing the directory
CPack Error: Error when generating package: OSXBundle
make: *** [package] Error 1


I have the following CMakeLists.txt:

CMAKE_MINIMUM_REQUIRED(VERSION 3.8)

PROJECT (OSXBundle)

FIND_PACKAGE (Boost REQUIRED)

ADD_EXECUTABLE (myapp
  src/main.cpp
  )

INSTALL ( TARGETS
  myapp
  DESTINATION
  ./bin
  )

IF (APPLE)
  # GET_TARGET_PROPERTY ( APP_LOCATION myapp LOCATION )
  SET ( APP_LOCATION "$<TARGET_FILE:myapp>" )

  SET ( CPACK_BUNDLE_NAME "MyApp" )

  SET ( CPACK_GENERATOR "Bundle" )
  SET ( CPACK_BUNDLE_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/Info.plist
)
  SET ( CPACK_BUNDLE_ICON ${CMAKE_CURRENT_SOURCE_DIR}/resources/MyApp.icns )
  SET ( CPACK_PACKAGE_ICON ${CMAKE_CURRENT_SOURCE_DIR}/resources/MyApp.icns
)
  SET ( CPACK_BUNDLE_STARTUP_COMMAND ${APP_LOCATION} )
ENDIF ()

INCLUDE ( CPack )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171129/f0a17695/attachment.html>


More information about the CMake mailing list