Если я запускаю прямую установку OpenCV, как это:
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX="/some/path" ..
make install
opencv создает ошибочный файл pkg-config, например так:
# Package Information for pkg-config
prefix=/some/path
exec_prefix=${prefix}
libdir=
includedir_old=${prefix}/include/opencv
includedir_new=${prefix}/include
Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.4.10
Libs: ${exec_prefix}/lib/libopencv_calib3d.so ${exec_prefix}/lib/libopencv_contrib.so ${exec_prefix}/lib/libopencv_core.so ${exec_prefix}/lib/libopencv_features2d.so ${exec_prefix}/lib/libopencv_flann.so ${exec_prefix}/lib/libopencv_gpu.so ${exec_prefix}/lib/libopencv_highgui.so ${exec_prefix}/lib/libopencv_imgproc.so ${exec_prefix}/lib/libopencv_legacy.so ${exec_prefix}/lib/libopencv_ml.so ${exec_prefix}/lib/libopencv_nonfree.so ${exec_prefix}/lib/libopencv_objdetect.so ${exec_prefix}/lib/libopencv_ocl.so ${exec_prefix}/lib/libopencv_photo.so ${exec_prefix}/lib/libopencv_stitching.so ${exec_prefix}/lib/libopencv_superres.so ${exec_prefix}/lib/libopencv_ts.a ${exec_prefix}/lib/libopencv_video.so ${exec_prefix}/lib/libopencv_videostab.so -lrt -lpthread -lm -ldl
Cflags: -I${includedir_old} -I${includedir_new}
Который производит выходные данные, которые не могут быть использованы непосредственно для компилятора или cmake:
$ pkg-config opencv --libs
/sct/homes3/opencv/opencv_2_4_10/lib/libopencv_calib3d.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_contrib.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_core.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_features2d.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_flann.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_gpu.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_highgui.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_imgproc.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_legacy.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_ml.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_nonfree.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_objdetect.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_ocl.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_photo.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_stitching.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_superres.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_ts.a /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_video.so /sct/homes3/opencv/opencv_2_4_10/lib/libopencv_videostab.so -lrt -lpthread -lm -ldl
Вы можете видеть, что библиотеки opencv задаются своим полным путем, а флаги компилятора не указываются.
Правильная версия opencv.pc
должен выглядеть так:
# Package Information for pkg-config
prefix=/some/path
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir_old=${prefix}/include/opencv
includedir_new=${prefix}/include
Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.4.10
Libs: -L${libdir} -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -lrt -lpthread -lm -ldl
Cflags: -I${includedir_old} -I${includedir_new}
Так почему же opencv / cmake создает такой файл pkg-config?
Или я делаю что-то не так с make install
?
Задача ещё не решена.