user3079474
user3079474

Reputation: 1793

Clarification of steps while generating of OpenCV libraries using CMake

I have generated the OpenCV libraries using CMake a couple of times using tutorials available online, albeit without completely understanding the process. Here is the process that I follow

  1. Configure CMake to build the OpenCV binaries (eg with QT, TBB, without CUDA, OpenCL etc)
  2. Generate the binaries using CMake
  3. The folder where the binaries are built has a number of .sln files. I open the file OpenCV.sln and run the project ALL_BUILD for both Debug and Release configurations.
  4. There is a new folder created. bin which contains the libraries (both .lib and .dll for the release and debug versions.
  5. (Optional) Sometimes I have also build the project named INSTALL (in the same solution), just out of curiosity. I noticed that it creates another folder, that contains the library files in almost the same pattern as the prebuilt libraries that come with the OpenCV package. Interestingly, my programs in MSVC or Qt work equally well if I link with either the libraries in the install folder or the bin/lib folder.

My questions are

  1. What is the function of the install solution?
  2. How are the libraries generated by the install solution different from the ones found in the bin and lib folders?
  3. Why is the install solution not built when the ALL_BUILD solution is built

Upvotes: 4

Views: 950

Answers (1)

Antonio
Antonio

Reputation: 20296

  1. What is the function of the install solution?

It packages/collects the build output into a portable set of libraries and headers that you know you can move around in your pc, or to another machine.

  1. How are the libraries generated by the install solution different from the ones found in the bin and lib folders?

They are not. You have probably built first shared and then (by reconfiguring with cmake) static libraries, but than the target install only installs the one you have currently selected (in your cmake-gui?)

  1. Why is the install solution not built when the ALL_BUILD solution is built

install is a special target for cmake. In fact, by default install triggers all and only actually executes when all has successfully terminated, but the viceversa is not true.

Upvotes: 3

Related Questions