How to install relevant shared libraries along with executionable using cmake

Hi,
i’m trying to build and install an executionable file that uses OpenCV. To build, install and package I use CMake and CPack. Here is my problem:

In the cmake list, i have added the executionable, open cv is found and linked.

find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS}) 
add_executable(MyApp src/MyApp.cpp) 
target_link_libraries(MyApp ${OpenCV_LIBS}) 

The project can build, however the shared libraries are not installed. I would love for the build/install folder to look something like this:

bin/
    MyApp
lib/
    libopencv-calib3d.so
    ...

Right now only the bin folder is created when I run the installation.
Hope someone can help.

Kind regards
Peter

Hi, I’m trying to do the same thing but I can’t find a way to do it. I can successfully package my program but then when I go to install it I get an error saying

Error: 
 Problem: conflicting requests
  - nothing provides libopencv_core.so.405()(64bit) needed by MyProgram-0.1.0-1.x86_64

It’s really frustrating that there’s absolutely no documentation on how to package opencv as a dependency.

typo? I would expect 455 (current version). no idea what 405 could mean.