# it _must_ go before PROJECT(OpenCV) in order to work
if (NOT CMAKE_INSTALL_PREFIX)
if (WIN32)
- set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR} CACHE INTERNAL "" FORCE)
+ set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE INTERNAL "" FORCE)
elseif()
set(CMAKE_INSTALL_PREFIX "/usr" CACHE INTERNAL "" FORCE)
endif()
# --------------------------------------------------------------------------------------------
# Installation for CMake Module: OpenCVConfig.cmake
-# Part 1/2: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"
-# Part 2/2: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use with "make install"
+# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"
+# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use with "make install"
+# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages
# -------------------------------------------------------------------------------------------
# -------------------------------------------------------------------------------------------
set(CMAKE_LIB_DIRS_CONFIGCMAKE ${LIBRARY_OUTPUT_PATH})
-configure_file("${CMAKE_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" IMMEDIATE)
+configure_file("${CMAKE_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" IMMEDIATE @ONLY)
# --------------------------------------------------------------------------------------------
# Part 2/2: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install"
#exec_program(${CMAKE_COMMAND} ARGS "-E make_directory \"${CMAKE_BINARY_DIR}/unix-install/\"")
exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/unix-install/\"")
-configure_file("${CMAKE_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" IMMEDIATE)
+configure_file("${CMAKE_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" IMMEDIATE @ONLY)
if(UNIX)
# For a command "FIND_PACKAGE(FOO)", CMake will look at the directory /usr/share|lib/FOO/FOOConfig.cmake, so:
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/opencv/)
endif()
+# --------------------------------------------------------------------------------------------
+# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages
+# -------------------------------------------------------------------------------------------
+if(WIN32)
+ # Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:
+
+ # This will expand to, for example, <program files>/OpenCV 1.1.0/include
+ set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/include\"")
+
+ # This will expand to, for example, <program files>/OpenCV 1.1.0/lib
+ set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/lib\"")
+
+ #exec_program(${CMAKE_COMMAND} ARGS "-E make_directory \"${CMAKE_BINARY_DIR}/win-install/\"")
+ exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/win-install/\"")
+ configure_file("${CMAKE_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" IMMEDIATE @ONLY)
+endif()
+
# --------------------------------------------------------------------------------------------
# Part 2/2: ${BIN_DIR}/unix-install/opencv.pc -> For use *with* "make install"
-# =========================================================================
+# ===================================================================================
# The OpenCV CMake configuration file
#
# ** File generated automatically, do not modify **
# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS})
#
# This file will define the following variables:
-# - OpenCV_LIBS: The list of libraries to links against.
+# - OpenCV_LIBS : The list of libraries to links against.
+# - OpenCV_VERSION : The version of this OpenCV build. Example: "1.2.0"
+# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "1"
+# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "2"
+# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "0"
#
-# =========================================================================
+# ===================================================================================
+# Extract the directory where *this* file has been installed (determined at cmake run-time)
+# This variable may or may not be used below, depending on the parsing of OpenCVConfig.cmake
+get_filename_component(THIS_OPENCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
# ======================================================
# Include directories to add to the user project:
# ======================================================
-INCLUDE_DIRECTORIES(${CMAKE_INCLUDE_DIRS_CONFIGCMAKE})
+INCLUDE_DIRECTORIES(@CMAKE_INCLUDE_DIRS_CONFIGCMAKE@)
# ======================================================
# Link directories to add to the user project:
# ======================================================
-LINK_DIRECTORIES(${CMAKE_LIB_DIRS_CONFIGCMAKE})
+LINK_DIRECTORIES(@CMAKE_LIB_DIRS_CONFIGCMAKE@)
# ======================================================
# Link libraries: e.g. cxcore110.so
# ======================================================
-SET(OpenCV_LIBS cxcore${OPENCV_DLLVERSION} cv${OPENCV_DLLVERSION} ml${OPENCV_DLLVERSION} highgui${OPENCV_DLLVERSION} cvaux${OPENCV_DLLVERSION})
+SET(OpenCV_LIBS cxcore@OPENCV_DLLVERSION@ cv@OPENCV_DLLVERSION@ ml@OPENCV_DLLVERSION@ highgui@OPENCV_DLLVERSION@ cvaux@OPENCV_DLLVERSION@)
+
+# ======================================================
+# Version variables:
+# ======================================================
+SET(OpenCV_VERSION @OPENCV_VERSION@)
+SET(OpenCV_VERSION_MAJOR @OPENCV_VERSION_MAJOR@)
+SET(OpenCV_VERSION_MINOR @OPENCV_VERSION_MINOR@)
+SET(OpenCV_VERSION_PATCH @OPENCV_VERSION_PATCH@)