* Install path share/opencv is renamed to share/OpenCV.
authorAndrey Kamaev <no@email>
Mon, 27 Jun 2011 13:59:03 +0000 (13:59 +0000)
committerAndrey Kamaev <no@email>
Mon, 27 Jun 2011 13:59:03 +0000 (13:59 +0000)
* Fixed zlib search.
* Fixed compiler/linker flags caching bug.
* Fixed OpenCVConfig.cmake generation (currently tested only on Unix).

3rdparty/libjasper/CMakeLists.txt
3rdparty/libjpeg/CMakeLists.txt
3rdparty/libpng/CMakeLists.txt
3rdparty/libtiff/CMakeLists.txt
3rdparty/zlib/CMakeLists.txt
CMakeLists.txt
OpenCVConfig.cmake.in
data/CMakeLists.txt
modules/java/CMakeLists.txt
modules/python/CMakeLists.txt

index 9b894da..a381dbe 100644 (file)
@@ -54,5 +54,5 @@ endif()
     
 if(NOT BUILD_SHARED_LIBS)
     install(TARGETS ${the_target}
-           ARCHIVE DESTINATION share/opencv/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
+           ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
 endif()
index dfb5a8a..b432701 100644 (file)
@@ -46,5 +46,5 @@ endif()
     
 if(NOT BUILD_SHARED_LIBS)
     install(TARGETS ${the_target}
-           ARCHIVE DESTINATION share/opencv/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
+           ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
 endif()
index 5602023..e7e91da 100644 (file)
@@ -47,5 +47,5 @@ endif()
     
 if(NOT BUILD_SHARED_LIBS)
     install(TARGETS ${the_target}
-           ARCHIVE DESTINATION share/opencv/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
+           ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
 endif()
index c79f4a0..924c22e 100644 (file)
@@ -101,5 +101,5 @@ endif()
 
 if(NOT BUILD_SHARED_LIBS)
     install(TARGETS ${the_target}
-           ARCHIVE DESTINATION share/opencv/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
+           ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
 endif()
index ae1887f..1964af0 100644 (file)
@@ -38,5 +38,5 @@ endif()
        
 if(NOT BUILD_SHARED_LIBS)
     install(TARGETS ${the_target}
-           ARCHIVE DESTINATION share/opencv/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
+           ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
 endif()
index 525d209..acc7270 100644 (file)
@@ -571,6 +571,10 @@ if(WITH_JASPER AND NOT JASPER_FOUND)
     set(JASPER_LIBRARIES libjasper)
 endif()
 
+if(NOT ZLIB_FOUND)
+    set(ZLIB_LIBRARY zlib)
+endif()
+
 #message(STATUS "Graphic libraries: ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES}")
 
 if(WITH_OPENEXR)
@@ -1120,19 +1124,19 @@ endif()
 if(NOT BUILD_SHARED_LIBS)
     if(CMAKE_COMPILER_IS_GNUCXX)
         set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} stdc++)
-        set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -fPIC")
+        set(OPENCV_EXTRA_C_FLAGS "-fPIC ${OPENCV_EXTRA_C_FLAGS}")
     endif()
 endif()
 
 
 # Add user supplied extra options (optimization, etc...)
 # ==========================================================
-set(OPENCV_EXTRA_C_FLAGS "" CACHE STRING "Extra compiler options")
-set(OPENCV_EXTRA_C_FLAGS_RELEASE "" CACHE STRING "Extra compiler options for Release build")
-set(OPENCV_EXTRA_C_FLAGS_DEBUG "" CACHE STRING "Extra compiler options for Debug build")
-set(OPENCV_EXTRA_EXE_LINKER_FLAGS "" CACHE STRING "Extra linker flags" FORCE)
-set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "" CACHE STRING "Extra linker flags for Release build" FORCE)
-set(OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG "" CACHE STRING "Extra linker flags for Debug build" FORCE)
+set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS}" CACHE STRING "Extra compiler options")
+set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE}" CACHE STRING "Extra compiler options for Release build")
+set(OPENCV_EXTRA_C_FLAGS_DEBUG "${OPENCV_EXTRA_C_FLAGS_DEBUG}" CACHE STRING "Extra compiler options for Debug build")
+set(OPENCV_EXTRA_EXE_LINKER_FLAGS "${OPENCV_EXTRA_EXE_LINKER_FLAGS}" CACHE STRING "Extra linker flags" FORCE)
+set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "Extra linker flags for Release build" FORCE)
+set(OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG "${OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING "Extra linker flags for Debug build" FORCE)
 
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${OPENCV_EXTRA_C_FLAGS}")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_C_FLAGS} ${OPENCV_EXTRA_C_FLAGS}")
@@ -1189,7 +1193,7 @@ set(OPENCV_DOC_INSTALL_PATH doc)
 elseif(WIN32)
 set(OPENCV_DOC_INSTALL_PATH doc)
 else()
-set(OPENCV_DOC_INSTALL_PATH share/opencv/doc)
+set(OPENCV_DOC_INSTALL_PATH share/OpenCV/doc)
 endif()
 
 if(ANDROID)
@@ -1209,64 +1213,48 @@ endif()
 # -------------------------------------------------------------------------------------------
 #  Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake              -> For use *without* "make install"
 # -------------------------------------------------------------------------------------------
-
-# Name of libraries is: libcv.so.1.1.0, etc...
-#  OPENCV_DLLVERSION must be set to "110", etc..
-# Already done above.
-
-# 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_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE "${CMAKE_CURRENT_SOURCE_DIR}")
 set(CMAKE_LIB_DIRS_CONFIGCMAKE "${LIBRARY_OUTPUT_PATH}")
+set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"")
 
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" IMMEDIATE @ONLY)
 
 # --------------------------------------------------------------------------------------------
 #  Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install"
 # -------------------------------------------------------------------------------------------
-# Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:
-
-set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/../../include/opencv" "\${THIS_OPENCV_CONFIG_PATH}/../../include\"")
-set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"\"")
-
-set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/../../lib\"")
+set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/include/opencv" "\${OpenCV_INSTALL_PATH}/include\"")
+set(CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE "")
+if(ANDROID)
+    set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/libs/\${ARMEABI_NDK_NAME}\"")
+    set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/share/OpenCV/3rdparty/libs/\${ARMEABI_NDK_NAME}\"")
+else()
+    set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_LIB_INSTALL_PATH}\"")
+    set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"")
+endif()
 
 exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/unix-install/\"" OUTPUT_VARIABLE RET_VAL)
 configure_file("${CMAKE_CURRENT_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/cmake/FOO/FOOConfig.cmake, so:
-    install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake DESTINATION share/cmake/OpenCV/)
+    # 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 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:
-    # support for 3rdparty libraries.
-    # 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\" 
-                                        \"\${THIS_OPENCV_CONFIG_PATH}/3rdparty/include\"")
-
-    set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}\"")
+    set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/include\" \"\${OpenCV_CONFIG_PATH}/include/opencv\" \"\${OpenCV_CONFIG_PATH}/3rdparty/include\"")
+    set(CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE "\${THIS_OPENCV_CONFIG_PATH}")
+    set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/${OPENCV_LIB_INSTALL_PATH}\" \"\${OpenCV_CONFIG_PATH}/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"")
+    set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"")
 
-    # This will expand to, for example, <program files>/OpenCV 1.1.0/lib
-    # support for 3rdparty libraries.
-    set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/lib\" 
-                                    \"\${THIS_OPENCV_CONFIG_PATH}/3rdparty/lib\"")
-
-    #exec_program(${CMAKE_COMMAND} ARGS "-E make_directory \"${CMAKE_BINARY_DIR}/win-install/\"")
     exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/win-install/\"" OUTPUT_VARIABLE RET_VAL)
     configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" IMMEDIATE @ONLY)
+
     # Install the OpenCVConfig.cmake file which has the right paths pointing to the install directory 
     install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/") 
-
-    # Add the OpenCV configuration header to the install path
-    # Useful for instance if a client application checks against the features OpenCV has been compiled with
-    install(FILES "${CMAKE_BINARY_DIR}/cvconfig.h" DESTINATION "${CMAKE_INSTALL_PREFIX}/include")
 endif()
 
 # --------------------------------------------------------------------------------------------
@@ -1312,7 +1300,7 @@ if(ANDROID)
     set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "")
     set(CMAKE_LIB_DIRS_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../../lib")
     configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk" IMMEDIATE @ONLY)
-    install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk DESTINATION share/opencv/)
+    install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk DESTINATION share/OpenCV/)
 endif(ANDROID)
 
 # --------------------------------------------------------------------------------------------
@@ -1335,7 +1323,7 @@ if(UNIX AND NOT ANDROID)
 endif()
 
 if(ANDROID)
-    install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/android/android.toolchain.cmake" DESTINATION share/opencv)
+    install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/android/android.toolchain.cmake" DESTINATION share/OpenCV)
 endif()
 
 # ----------------------------------------------------------------------------
index 360f48f..f79be01 100644 (file)
 #                                      with this path is NOT needed.\r
 #      - OpenCV_INCLUDE_DIRS         : The OpenCV include directories.\r
 #      - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability\r
-#      - OpenCV_VERSION              : The version of this OpenCV build. Example: "1.2.0"\r
-#      - OpenCV_VERSION_MAJOR        : Major version part of OpenCV_VERSION. Example: "1"\r
-#      - OpenCV_VERSION_MINOR        : Minor version part of OpenCV_VERSION. Example: "2"\r
+#      - OpenCV_VERSION              : The version of this OpenCV build. Example: "2.3.0"\r
+#      - OpenCV_VERSION_MAJOR        : Major version part of OpenCV_VERSION. Example: "2"\r
+#      - OpenCV_VERSION_MINOR        : Minor version part of OpenCV_VERSION. Example: "3"\r
 #      - OpenCV_VERSION_PATCH        : Patch version part of OpenCV_VERSION. Example: "0"\r
 #\r
+#    Advanced variables:\r
+#      - OpenCV_SHARED\r
+#      - OpenCV_CONFIG_PATH\r
+#      - OpenCV_INSTALL_PATH\r
+#      - OpenCV_LIB_COMPONENTS\r
+#      - OpenCV_EXTRA_COMPONENTS\r
+#\r
 # =================================================================================================\r
 \r
 # ======================================================\r
 # ======================================================\r
 SET(OpenCV_COMPUTE_CAPABILITIES @OpenCV_CUDA_CC@)\r
 \r
+# Some additional settings are required if OpenCV is built as static libs\r
+set(OpenCV_SHARED @BUILD_SHARED_LIBS@)\r
+\r
 # Extract the directory where *this* file has been installed (determined at cmake run-time)\r
-#  This variable may or may not be used below, depending on the parsing of OpenCVConfig.cmake\r
-get_filename_component(THIS_OPENCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)\r
+get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)\r
+\r
 #Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings\r
-get_filename_component(OPENCV_INSTALL_PATH "${THIS_OPENCV_CONFIG_PATH}/../.." REALPATH)\r
+get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../.." REALPATH)\r
 \r
 # ======================================================\r
 # Include directories to add to the user project:\r
 # ======================================================\r
+\r
 # Provide the include directories to the caller\r
-SET(OpenCV_INCLUDE_DIRS "${OPENCV_INSTALL_PATH}/include/opencv;${OPENCV_INSTALL_PATH}/include")\r
+SET(OpenCV_INCLUDE_DIRS @CMAKE_INCLUDE_DIRS_CONFIGCMAKE@)\r
 INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})\r
 \r
 # ======================================================\r
 # Link directories to add to the user project:\r
 # ======================================================\r
-# Provide the libs directory anyway, it may be needed in some cases.\r
-SET(OpenCV_LIB_DIR "${OPENCV_INSTALL_PATH}/lib")\r
 \r
+# Provide the libs directory anyway, it may be needed in some cases.\r
+SET(OpenCV_LIB_DIR @CMAKE_LIB_DIRS_CONFIGCMAKE@)\r
 LINK_DIRECTORIES(${OpenCV_LIB_DIR})\r
 \r
 # ====================================================================\r
 # Link libraries: e.g.   opencv_core220.so, opencv_imgproc220d.lib, etc...\r
 # ====================================================================\r
+#libraries order is very important because linker from Android NDK is one-pass linker\r
+SET(OpenCV_LIB_COMPONENTS opencv_contrib opencv_legacy opencv_objdetect opencv_calib3d opencv_features2d opencv_video opencv_highgui opencv_ml opencv_imgproc opencv_flann opencv_core )\r
+\r
 if(NOT ANDROID)\r
-    set(OPENCV_LIB_COMPONENTS opencv_core opencv_imgproc opencv_features2d opencv_gpu opencv_calib3d opencv_objdetect opencv_video opencv_highgui opencv_ml opencv_legacy opencv_contrib opencv_flann)\r
-else()\r
-    #libraries order is very important because linker from Android NDK is one-pass linker\r
-    set(OPENCV_LIB_COMPONENTS opencv_contrib opencv_calib3d opencv_objdetect opencv_features2d opencv_imgproc opencv_video  opencv_highgui opencv_ml opencv_legacy  opencv_flann opencv_core )\r
-    IF (NOT @BUILD_SHARED_LIBS@)\r
-        set(OPENCV_LIB_COMPONENTS ${OPENCV_LIB_COMPONENTS} opencv_androidcamera)\r
-    ENDIF()\r
+    LIST(INSERT OpenCV_LIB_COMPONENTS 0 opencv_gpu)\r
+ELSEIF(NOT OpenCV_SHARED)\r
+    LIST(APPEND OpenCV_LIB_COMPONENTS opencv_androidcamera)\r
 endif()\r
 \r
 SET(OpenCV_LIBS "")\r
-foreach(__CVLIB ${OPENCV_LIB_COMPONENTS})\r
+foreach(__CVLIB ${OpenCV_LIB_COMPONENTS})\r
     # CMake>=2.6 supports the notation "debug XXd optimized XX"\r
-    if (CMAKE_MAJOR_VERSION GREATER 2  OR  CMAKE_MINOR_VERSION GREATER 4)\r
+    if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.4)\r
         # Modern CMake:\r
         SET(OpenCV_LIBS ${OpenCV_LIBS} debug ${__CVLIB}@OPENCV_DLLVERSION@@OPENCV_DEBUG_POSTFIX@ optimized ${__CVLIB}@OPENCV_DLLVERSION@)\r
-    else(CMAKE_MAJOR_VERSION GREATER 2  OR  CMAKE_MINOR_VERSION GREATER 4)\r
+    else()\r
         # Old CMake:\r
         SET(OpenCV_LIBS ${OpenCV_LIBS} ${__CVLIB}@OPENCV_DLLVERSION@)\r
-    endif(CMAKE_MAJOR_VERSION GREATER 2  OR  CMAKE_MINOR_VERSION GREATER 4)\r
-endforeach(__CVLIB)\r
+    endif()\r
+endforeach()\r
 \r
 # ==============================================================\r
 #  Extra include directories, needed by OpenCV 2 new structure\r
 # ==============================================================\r
-if(NOT @CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@ STREQUAL  "")\r
-    SET(BASEDIR @CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@)\r
-    foreach(__CVLIB ${OPENCV_LIB_COMPONENTS})\r
+if(NOT "@CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE@" STREQUAL  "")\r
+    foreach(__CVLIB ${OpenCV_LIB_COMPONENTS})\r
         # We only need the "core",... part here: "opencv_core" -> "core"\r
-        STRING(REGEX REPLACE "opencv_(.*)" "\\1" MODNAME ${__CVLIB})\r
-        INCLUDE_DIRECTORIES("${BASEDIR}/modules/${MODNAME}/include")\r
-    endforeach(__CVLIB)\r
-endif(NOT @CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@ STREQUAL  "")\r
+        STRING(REGEX REPLACE "opencv_(.*)" "\\1" __MODNAME ${__CVLIB})\r
+        INCLUDE_DIRECTORIES("@CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE@/modules/${__MODNAME}/include")\r
+    endforeach()\r
+endif()\r
 \r
 # For OpenCV built as static libs, we need the user to link against\r
 #  many more dependencies:\r
-set(OpenCV_SHARED @BUILD_SHARED_LIBS@)\r
-\r
 IF (NOT OpenCV_SHARED)\r
     # Under static libs, the user of OpenCV needs access to the 3rdparty libs as well:\r
-    if(WIN32 AND NOT ANDROID)\r
-        LINK_DIRECTORIES(@CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@/3rdparty/lib)\r
-    else()\r
-        LINK_DIRECTORIES("${THIS_OPENCV_CONFIG_PATH}/3rdparty/lib")\r
-    endif()    \r
+    LINK_DIRECTORIES(@CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE@)\r
 \r
     set(OpenCV_LIBS @OPENCV_LINKER_LIBS@ @IPP_LIBS@ @HIGHGUI_LIBRARIES@ ${OpenCV_LIBS})\r
+    set(OpenCV_EXTRA_COMPONENTS @JPEG_LIBRARIES@ @PNG_LIBRARIES@ @TIFF_LIBRARIES@ @JASPER_LIBRARIES@ @ZLIB_LIBRARY@)\r
 \r
-    set(OPENCV_EXTRA_COMPONENTS @JPEG_LIBRARIES@ @PNG_LIBRARIES@ @TIFF_LIBRARIES@ @JASPER_LIBRARIES@ zlib)\r
-\r
-    if (CMAKE_MAJOR_VERSION GREATER 2  OR  CMAKE_MINOR_VERSION GREATER 4)\r
-        foreach(__EXTRA_LIB ${OPENCV_EXTRA_COMPONENTS})\r
+    if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.4)\r
+        # Modern CMake:\r
+        foreach(__EXTRA_LIB ${OpenCV_EXTRA_COMPONENTS})\r
             set(OpenCV_LIBS ${OpenCV_LIBS}\r
                 debug ${__EXTRA_LIB}@OPENCV_DEBUG_POSTFIX@\r
                 optimized ${__EXTRA_LIB})\r
-        endforeach(__EXTRA_LIB)\r
-    else(CMAKE_MAJOR_VERSION GREATER 2  OR  CMAKE_MINOR_VERSION GREATER 4)\r
-        set(OpenCV_LIBS ${OpenCV_LIBS} ${OPENCV_EXTRA_COMPONENTS})\r
-    endif(CMAKE_MAJOR_VERSION GREATER 2  OR  CMAKE_MINOR_VERSION GREATER 4)\r
-\r
+        endforeach()\r
+    else()\r
+        # Old CMake:\r
+        set(OpenCV_LIBS ${OpenCV_LIBS} ${OpenCV_EXTRA_COMPONENTS})\r
+    endif()\r
 ENDIF()\r
 \r
 # ======================================================\r
index 53a3058..0eba875 100644 (file)
@@ -2,6 +2,6 @@ file(GLOB HAAR_CASCADES haarcascades/*.xml)
 file(GLOB LBP_CASCADES lbpcascades/*.xml)
 
 if(NOT WIN32)
-install(FILES ${HAAR_CASCADES} DESTINATION share/opencv/haarcascades COMPONENT main)
-install(FILES ${LBP_CASCADES} DESTINATION share/opencv/lbpcascades COMPONENT main)
+install(FILES ${HAAR_CASCADES} DESTINATION share/OpenCV/haarcascades COMPONENT main)
+install(FILES ${LBP_CASCADES} DESTINATION share/OpenCV/lbpcascades COMPONENT main)
 endif()
index 47f5d32..662c11d 100644 (file)
@@ -73,7 +73,7 @@ set_target_properties(${target} PROPERTIES
     OUTPUT_NAME "${target}"
     ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
     RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
-    INSTALL_NAME_DIR lib
+    INSTALL_NAME_DIR ${OPENCV_LIB_INSTALL_PATH}
     )
 
 install(TARGETS ${target} LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
index 30b2a7f..ce21d22 100644 (file)
@@ -53,7 +53,7 @@ target_link_libraries(${cv_target} ${PYTHON_LIBRARIES} opencv_core opencv_imgpro
 set_target_properties(${cv_target} PROPERTIES PREFIX "")
 set_target_properties(${cv_target} PROPERTIES OUTPUT_NAME "cv")
 
-execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import distutils.sysconfig; print distutils.sysconfig.get_config_var('SO')"
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('SO')"
                 RESULT_VARIABLE PYTHON_CVPY_PROCESS
                 OUTPUT_VARIABLE CVPY_SUFFIX
                 OUTPUT_STRIP_TRAILING_WHITESPACE)