OPENCV_GENERATE_PKGCONFIG -
pkg-config --modversion opencv4
pkg-config --modversion opencv4
1. opencv/CMakeLists.txt
https://github.com/opencv/opencv
https://github.com/opencv/opencv/blob/master/CMakeLists.txt
OpenCV 4 配置默认不产生 opencv4.pc
。
OCV_OPTION(OPENCV_GENERATE_PKGCONFIG "Generate .pc file for pkg-config build tool (deprecated)" OFF)
deprecate [ˈdeprəkeɪt]:vt. 反对,抨击,轻视,声明不赞成
OpenCV 2 / 3 查看安装的 OpenCV 版本
pkg-config --modversion opencv
OpenCV 4 查看安装的 OpenCV 版本
pkg-config --modversion opencv4
2. Generate pkg-config info
运行 cmake 添加 -D OPENCV_GENERATE_PKGCONFIG=ON
cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_GENERATE_PKGCONFIG=ON -D CMAKE_INSTALL_PREFIX=/usr/local ..
- Add this flag when running CMake:
-DOPENCV_GENERATE_PKGCONFIG=ON
- Will generate the
.pc
file forpkg-config
and install it. - Useful if not using CMake in projects that use OpenCV
- Installed as
opencv4
, usage:pkg-config --cflags --libs opencv4