0

Is there a way to specify the shared library path from CMakeLists.txt? I want to make an executable which uses OpenCV but I don't want the final user to install OpenCV. Instead I would like to deliver a folder containing my executable and the shared libraries it needs. The final structure should be something like

Delivery

  • MyApp
  • OpenCV (folder containing opencv dylibs)

In the end MyApp should search for the shared libs in OpenCV folder. I tried to use the info from https://cmake.org/Wiki/CMake_RPATH_handling but for some reason I don't seem to understand what i really have to do to achieve what I want.

I tried to set CMAKE_INSTALL_RPATH to @loader_path or @executable_path but don't see any change. It still searches for opencv libs in /lib folder.

Running otool -L MyApp results in:

lib/libopencv_imgproc.3.1.dylib (compatibility version 3.1.0, current version 3.1.0) lib/libopencv_imgcodecs.3.1.dylib (compatibility version 3.1.0, current version 3.1.0) lib/libopencv_highgui.3.1.dylib (compatibility version 3.1.0, current version 3.1.0) lib/libopencv_core.3.1.dylib (compatibility version 3.1.0, current version 3.1.0)

/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)

lorenzo
  • 1
  • 1
  • 1
    Is there any reason to provide OpenCV header files in your installation? Using the link you pointed, what have you tried so far (edit your post with a minimal example and what goes wrong)? – rocambille Aug 17 '16 at 11:59
  • You are right. Only OpenCV dylibs should be delivered. I updated the original post. – lorenzo Aug 17 '16 at 12:40

0 Answers0