MACOSX_BUNDLE and dynlibs

Hi. I am new to MacOSX and I am pulling my hair.

I am creating an application on MacOSX that relies on multiple dynlibs
and frameworks that get pulled from FindXXX.cmake or from direct linking
them.

I am looking for a way to create a bundle with all the dynlibs in them
ready for deployment. I tried cpack but it did not work. It created a
bundle with my application with the stop symbol in it, as if it was
missing something.

Ideally I am looking for a simple solution that just dumps all my
dynlibs into a lib directory and then I can use the
DYLD_FALLBACK_LIBRARY_PATH to find them in a startup script.

Also, is there a way to have the executable be placed in a bin/
directory instead of the Contents/MacOS/ one, so that I can place my
startup script in the MacOS directory with the name of the executable?

I have made some progress.

I found out that OSX does not like executables with the -v1.0 in their names. Once I removed them, the stop sign disappeared.

I have this working.

I have this working. I had to set:

set(CPACK_BUNDLE_STARTUP_COMMAND ${PROJECT_BINARY_DIR}/startup.sh)

and the startup.sh script got renamed with the name of my application and placed in the name.app/Contents/MacOS directory.

However, I am still facing another issue regarding executable permissions. The real executable gets placed in name.app/Contents/Resources/bin/name.app/Contents/MacOS/name. I do not know why it is placed on another name.app directory and, more importantly, why it does not have executable permissions.

I’m not sure about executable permissions, but the Contents/MacOS directory is where the “main” binary for a .app bundle belongs. Do you have a custom install() command for this or is it an add_executable() target in your project?