diff -up OpenCV-2.4.2/cmake/OpenCVGenPkgconfig.cmake.pkgcmake OpenCV-2.4.2/cmake/OpenCVGenPkgconfig.cmake
--- OpenCV-2.4.2/cmake/OpenCVGenPkgconfig.cmake.pkgcmake 2012-06-29 00:55:15.000000000 +0200
+++ OpenCV-2.4.2/cmake/OpenCVGenPkgconfig.cmake 2012-07-09 14:53:33.338597708 +0200
@@ -10,7 +10,7 @@
# -------------------------------------------------------------------------------------------
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "\${prefix}")
-set(libdir "") #TODO: need link paths for OpenCV_EXTRA_COMPONENTS
+set(libdir "\${prefix}/${OPENCV_LIB_INSTALL_PATH}")
set(includedir "\${prefix}/${OPENCV_INCLUDE_INSTALL_PATH}")
set(VERSION ${OPENCV_VERSION})
@@ -36,7 +36,7 @@ ocv_list_reverse(OpenCV_LIB_COMPONENTS)
ocv_list_reverse(OpenCV_EXTRA_COMPONENTS)
#build the list of components
-set(OpenCV_LIB_COMPONENTS_ "")
+set(OpenCV_LIB_COMPONENTS_ "-L\${libdir}")
foreach(CVLib ${OpenCV_LIB_COMPONENTS})
get_target_property(libpath ${CVLib} LOCATION_${CMAKE_BUILD_TYPE})
get_filename_component(libname "${libpath}" NAME)
@@ -51,8 +51,10 @@ foreach(CVLib ${OpenCV_LIB_COMPONENTS})
else()
set(installDir "${OPENCV_LIB_INSTALL_PATH}")
endif()
-
- set(OpenCV_LIB_COMPONENTS_ "${OpenCV_LIB_COMPONENTS_} \${exec_prefix}/${installDir}/${libname}")
+ string(REPLACE "libopencv" "-lopencv" libname "${libname}")
+ string(REPLACE ".so" "" libname "${libname}")
+ string(REPLACE ".dylib" "" libname "${libname}")
+ set(OpenCV_LIB_COMPONENTS_ "${OpenCV_LIB_COMPONENTS_} ${libname}")
endforeach()
# add extra dependencies required for OpenCV