I'm building an app on Mac, Linux, and Win.

My application requires that a helper application, built outside of my project, 
be installed along with it.  On Linux and Win, its sufficient to copy the 
helper app to the same directory as my app.  On Mac, it needs to be copied into 
the bundle in the same location as my runtime, in the Contents/Macos/ bundle 
directory.

I can't get the helper app to be packaged correctly on Mac.  I've tried two 
approaches that have come close but failed.

First I tried adding the helper as a target, then using install(TARGETS...):
----------------------------------------
ADD_EXECUTABLE(myapp MACOSX_BUNDLE [...])

SET(helperpath [...])
SET(IMPORTED_LOCATION ${helperpath})
ADD_EXECUTABLE(myhelper IMPORTED)

INSTALL(TARGETS myapp 
    BUNDLE DESTINATION .
    RUNTIME DESTINATION bin
)

INSTALL(TARGETS myhelper 
    BUNDLE DESTINATION .
    RUNTIME DESTINATION bin
)
----------------------------------------

This fails in cmake with a message: "install TARGETS given target "myhelper" 
which does not exist in this directory."

If  I alter the INSTALL with a fully qualified path to myhelper I get the same 
message, with the fully qualified myhelper path.

Next, I tried using INSTALL(PROGRAMS...) with something like:
----------------------------------------
ADD_EXECUTABLE(myapp MACOSX_BUNDLE [...])

SET(helperpath [...])

INSTALL(TARGETS myapp 
    BUNDLE DESTINATION .
    RUNTIME DESTINATION bin
)

INSTALL(PROGRAMS ${helperpath}/myhelper 
    DESTINATION .
)
----------------------------------------

But this form PROGRAMS does not support the kind-of qualifiers (BUNDLE, 
RUNTIME), so helperapp gets copied next to the bundle on Mac, not into it where 
it needs to be.

What am I doing wrong?

KC Jones
kc.jo...@skype.net
SkypeId: bernalkc

_______________________________________________
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