Reputation: 43
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?
Upvotes: 4
Views: 2312
Reputation: 41750
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)
Upvotes: 5