Opencv_world.dll on windows

I build opencv with this parameter

      -DBUILD_SHARED_LIBS=ON `
      -DBUILD_PERF_TESTS=OFF `
      -DBUILD_TESTS=OFF `
      -DBUILD_DOCS=OFF `
      -DWITH_CUDA=OFF `
      -DBUILD_EXAMPLES=OFF `
      -DINSTALL_CREATE_DISTRIB=ON

Q1.
I write a foo library that use opencv. When I use the foo, my program will show can not found opencv_world.dll.

I dont want to depend on the opencv_world.dll. How can I do?

Q2.
main project bar will call the foo
where foo is a library and it use the opencv.

Does it mean when I use the foo libraray, I must be put opencv_world.dll on my main project (same folder)

Why? If you build a static version of OpenCV it will be the same size as including opencv_world.dll with your application so there will be no difference apart from the number of files you include. i.e. One large application file or one smaller application file and one opencv_world.dll.

This was answered in your previous post

To clarify you can

  1. Include in your project directory
  2. Add to the the location to your system/user path
  3. Build a static version of OpenCV and link against that but you need to clarify why you would want to do that and why option 1 and 2 are not suitable solutions for you?

Do you have the example to package (cmake) the project about opencv

No but you should be able to use CPack.