-1

I am currently building a basic application in c ++ under macOs, this one uses the following several libraries / frameworks :

FIND_LIBRARY(COCOA_LIBRARY Cocoa)
target_link_libraries(glDiscoverProject
    "-framework OpenGL"
    "-framework CoreVideo"
    "-framework IOKit"
    "${COCOA_LIBRARY}"
    "glfw3"
    "boost_system"
    "boost_filesystem")

I wish I could send my compiled application to a friend, and that he can launch it without having to install those different libraries.

So I inquired and found that CMake could be specified a file where to store the libraries.

link_directories(${CMAKE_SOURCE_DIR}/build/lib)

How to make all those dynamic libraries present in this file AND work on any machine under macOs?

Command "otool -L" on the executable :

/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.5.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 22.0.0)
/usr/local/opt/boost/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/boost/lib/libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.5.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1504.83.101)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1349.8.0)
/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1070.22.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 775.19.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1349.91.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

I am looking for a solution that I could apply to all my future project to deploy.

EDIT :

Found solution from super answer.

Neok
  • 221
  • 2
  • 17

1 Answers1

1

What you want is an App Bundle. This is basically a folder that holds all the resources (images, sounds, libraries, framworks, app info ect.) together with the binary/binaries.

You can do this with CMake. You could also do it directly in XCode if you are using that. No matter what IDE or build system you use you will have to specialize this to some extent depending on the App you are making, and what resources it needs.

You can read some more about the apple bundles here.

super
  • 12,335
  • 2
  • 19
  • 29