Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use OpenCV without running 'make install'?

I am new to cmake and OpenCV.

Is there a way that I can use OpenCV on my machine by just building the source code and not installing them to /usr/local/lib on my machine, i.e. without running make install after building the binaries?

like image 965
Rushabh K Avatar asked Oct 27 '25 06:10

Rushabh K


1 Answers

The solution would be to set CMAKE_INSTALL_PREFIX to a specific location:

# in opencv/build
cmake .. -DCMAKE_INSTALL_PREFIX=/home/user/path/to/deps/
cmake --build . --target install

Then, configure your project with the same prefix:

# in your project/build
cmake .. -DCMAKE_PREFIX_PATH=/home/user/path/to/deps/

In your cmake files, simply use find_package(OpenCV)

like image 148
Guillaume Racicot Avatar answered Oct 28 '25 22:10

Guillaume Racicot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!