How to install relevant shared libraries along with executionable using cmake

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)
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:


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

Kind regards

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

 Problem: conflicting requests
  - nothing provides 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.