Ticket #32528: patch-OpenCVConfig.cmake.in.diff

File patch-OpenCVConfig.cmake.in.diff, 1.5 KB (added by marin.saric@…, 13 years ago)
  • OpenCVConfig.cmake.in

    old new  
    4040# Some additional settings are required if OpenCV is built as static libs
    4141set(OpenCV_SHARED @BUILD_SHARED_LIBS@)
    4242
     43# OpenCV can exist for both shared and static libraries
     44set(OPENCV_BUILT_SHARED_AND_STATIC @OPENCV_BUILT_SHARED_AND_STATIC@)
     45if(OPENCV_BUILT_SHARED_AND_STATIC)
     46    if (DEFINED BUILD_SHARED_LIBS AND NOT BUILD_SHARED_LIBS)
     47        set(OpenCV_SHARED OFF)
     48    else()
     49        set(OpenCV_SHARED ON)
     50    endif()
     51endif(OPENCV_BUILT_SHARED_AND_STATIC)
     52
    4353# Enables mangled install paths, that help with side by side installs
    4454set(OpenCV_USE_MANGLED_PATHS @OPENCV_MANGLED_INSTALL_PATHS@)
    4555
     
    101111      endif()
    102112  endforeach()
    103113else()
     114  # Let cmake properly locate each OpenCV library
    104115  foreach(__CVLIB ${OpenCV_LIB_COMPONENTS})
    105     SET(OpenCV_LIBS ${OpenCV_LIBS} ${__CVLIB})
     116    FIND_LIBRARY(${__CVLIB}_LIBRARY
     117      NAMES ${__CVLIB}
     118      PATHS ${OpenCV_LIB_DIR})
     119    SET(OpenCV_LIBS ${OpenCV_LIBS} ${${__CVLIB}_LIBRARY})
    106120  endforeach()
    107121endif()
    108122
     
    139153    endif()
    140154   
    141155    if (APPLE)
    142         set(OpenCV_LIBS ${OpenCV_LIBS} "-lbz2" "-framework Cocoa" "-framework QuartzCore" "-framework QTKit")
     156        FIND_LIBRARY(BZ2_LIBRARY NAMES bz2 REQUIRED)
     157
     158        list(APPEND OpenCV_LIBS ${BZ2_LIBRARY} "-framework Cocoa" "-framework QuartzCore" "-framework QTKit")
    143159    endif()
    144160ENDIF()
    145161