Tentative fix to using FIND_PACKAGE(OpenCV) from external apps after last atomic bomb commit!

Fixed for OpenCV compiled whereever and NOT "make install"ed. This second case must be checked later, since I'm not sure of the pretended include dirs layout after "make install". 
If all include dirs go to the same target install directory, it should work as is right now.
This commit is contained in:
Jose Luis Blanco 2010-05-14 09:35:39 +00:00
parent a2e158aeb8
commit 4833f15b22
2 changed files with 16 additions and 0 deletions

View File

@ -917,6 +917,7 @@ endif()
# Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${CMAKE_CURRENT_SOURCE_DIR}/include\" \"${CMAKE_CURRENT_SOURCE_DIR}/include/opencv\"")
set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"${CMAKE_CURRENT_SOURCE_DIR}\"")
set(CMAKE_LIB_DIRS_CONFIGCMAKE "${LIBRARY_OUTPUT_PATH}")
@ -928,6 +929,8 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINA
# Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/include/opencv")
set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"\"")
set(CMAKE_LIB_DIRS_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/lib")
#exec_program(${CMAKE_COMMAND} ARGS "-E make_directory \"${CMAKE_BINARY_DIR}/unix-install/\"")
@ -947,6 +950,7 @@ if(WIN32)
# This will expand to, for example, <program files>/OpenCV 1.1.0/include
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/include\" \"\${THIS_OPENCV_CONFIG_PATH}/include/opencv\"")
set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"${THIS_OPENCV_CONFIG_PATH}\"")
# This will expand to, for example, <program files>/OpenCV 1.1.0/lib
set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/lib\"")

View File

@ -56,6 +56,18 @@ foreach(__CVLIB ${OPENCV_LIB_COMPONENTS})
endif(CMAKE_MAJOR_VERSION GREATER 2 OR CMAKE_MINOR_VERSION GREATER 4)
endforeach(__CVLIB)
# ==============================================================
# Extra include directories, needed by OpenCV 2 new structure
# ==============================================================
if(NOT @CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@ STREQUAL "")
SET(BASEDIR @CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@)
foreach(__CVLIB ${OPENCV_LIB_COMPONENTS})
# We only need the "core",... part here: "opencv_core" -> "core"
STRING(REGEX REPLACE "opencv_(.*)" "\\1" MODNAME ${__CVLIB})
INCLUDE_DIRECTORIES("${BASEDIR}/modules/${MODNAME}/include")
endforeach(__CVLIB)
endif(NOT @CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@ STREQUAL "")
# For OpenCV built as static libs, we need the user to link against
# many more dependencies:
IF (NOT @OPENCV_BUILD_SHARED_LIB@)