[CMake] CPack OS X bundle : generator expression for CPACK_BUNDLE_STARTUP_COMMAND
Oleksii Vilchanskyi
oleksii.vilchanskyi at gmail.com
Tue Nov 28 22:18:07 EST 2017
Hi,
`set()` is evaluated at configuration time and as of CMake 3.10 does not
accept genexps. You can refer to this diagram for better understanding
of the general CMake pipeline:
<https://cgold.readthedocs.io/en/latest/_images/cmake-environment.png>
Therefore,
> SET ( APP_LOCATION "$<TARGET_FILE:myapp>" )
> SET ( CPACK_BUNDLE_STARTUP_COMMAND ${APP_LOCATION} )
is interpreted exactly how it's written:
> CPack Error: Error copying $<TARGET_FILE:myapp> to...
Due to this limitation your [probably] sole option to introduce genxps
in CPack config would be to use `file(GENERATE)`. Otherwise, use
single-configuration generators and you won't have
configuration-dependent paths.
On 29.11.2017 01:50, Nicholas Yue wrote:
> 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 )
>
>
>
--
Regards,
Oleksii Vilchanskyi
PGP:0x8D3A0E046BDE941F2A53867CE3FD952D48C0B338
***
All the world's a pipeline,
And all the men and women merely instructions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171129/d8388e2f/attachment.sig>
More information about the CMake
mailing list