We build an OS X application, released in a .app bundle. The build management is implemented using CMake. This application depends on both CMake target libraries (possibly imported) and libraries available in the xxx_LIBRARIES
variables populated by Findxxx.cmake scripts. An outline of the CMakeLists.txt could be:
project(OSX_Bundle)
add_executable(${PROJECT_NAME} MACOSX_BUNDLE main.mm )
target_include_directories(${PROJECT_NAME} PRIVATE
${LibA_INCLUDE_DIRS} )
target_link_libraries(${PROJECT_NAME}
${LibA_LIBRARIES}
LibB
"-framework Cocoa" )
Now, we need to copy both LibA.dylib and LibB.dylib into the canonical OSX_Bundle.app/Contents/Frameworks. This copy should be done for the app in the build tree, as well as in the install tree. Even though it would appear as a basic task, we cannot find a good resource online explaining the best way(s) of solving this issue.