]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
- Generation of a third OpenCVConfig.cmake file in BIN_DIR/win-install: This file...
authorjlblanco <jlblanco@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Wed, 11 Feb 2009 22:26:50 +0000 (22:26 +0000)
committerjlblanco <jlblanco@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Wed, 11 Feb 2009 22:26:50 +0000 (22:26 +0000)
- Added OpenCV_VERSION* variables to OpenCVConfig.cmake
- Default CMAKE_INSTALL_PREFIX in Windows changed CMAKE_SOURCE_DIR -> CMAKE_BINARY_DIR (I guess this was the original intention, right?)

git-svn-id: https://code.ros.org/svn/opencv/trunk@1590 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

opencv/CMakeLists.txt
opencv/OpenCVConfig.cmake.in

index d0e9ce8703f0c92e6df97588b19c4e4f125dfbb6..61c871f384093835e8083be8a7410d3151a923e2 100644 (file)
@@ -14,7 +14,7 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
 # 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()
@@ -534,8 +534,9 @@ add_subdirectory(3rdparty)
 
 # --------------------------------------------------------------------------------------------
 #   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
 # -------------------------------------------------------------------------------------------
 
 # -------------------------------------------------------------------------------------------
@@ -554,7 +555,7 @@ list(APPEND CMAKE_INCLUDE_DIRS_CONFIGCMAKE "${CMAKE_SOURCE_DIR}/include/opencv")
 
 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"
@@ -566,13 +567,30 @@ set(CMAKE_LIB_DIRS_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/lib")
 
 #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"
index 807fecfe7ed7dee9632d27a29745168f24c59c96..8ce45df96d93700245cb98624238d1d9301bceab 100644 (file)
@@ -1,4 +1,4 @@
-# =========================================================================
+# ===================================================================================
 #  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@)