cmake: export OpenCVModules for unix 'install', move macros desclarations
authorAlexander Alekhin <alexander.alekhin@itseez.com>
Wed, 9 Oct 2013 14:29:03 +0000 (18:29 +0400)
committerAlexander Alekhin <alexander.alekhin@itseez.com>
Wed, 9 Oct 2013 14:29:03 +0000 (18:29 +0400)
cmake/OpenCVConfig.cmake
cmake/OpenCVGenConfig.cmake
cmake/templates/OpenCVConfig.cmake.in

index 56f4791..c7839c6 100644 (file)
@@ -164,44 +164,3 @@ You should manually point CMake variable OpenCV_DIR to your build of OpenCV libr
   set(OpenCV_FOUND FALSE CACHE BOOL "" FORCE)
   set(OPENCV_FOUND FALSE CACHE BOOL "" FORCE)
 endif()
-
-
-#
-# Some macroses for samples
-#
-macro(ocv_check_dependencies)
-  set(OCV_DEPENDENCIES_FOUND TRUE)
-  foreach(d ${ARGN})
-    if(NOT TARGET ${d})
-      set(OCV_DEPENDENCIES_FOUND FALSE)
-      break()
-    endif()
-  endforeach()
-endmacro()
-
-# adds include directories in such way that directories from the OpenCV source tree go first
-function(ocv_include_directories)
-  set(__add_before "")
-  foreach(dir ${ARGN})
-    get_filename_component(__abs_dir "${dir}" ABSOLUTE)
-    if("${__abs_dir}" MATCHES "^${OpenCV_DIR}")
-      list(APPEND __add_before "${dir}")
-    else()
-      include_directories(AFTER SYSTEM "${dir}")
-    endif()
-  endforeach()
-  include_directories(BEFORE ${__add_before})
-endfunction()
-
-macro(ocv_include_modules)
-  include_directories(BEFORE "${OpenCV_INCLUDE_DIRS}")
-endmacro()
-
-# remove all matching elements from the list
-macro(ocv_list_filterout lst regex)
-  foreach(item ${${lst}})
-    if(item MATCHES "${regex}")
-      list(REMOVE_ITEM ${lst} "${item}")
-    endif()
-  endforeach()
-endmacro()
index f4c53e8..9050e05 100644 (file)
@@ -103,9 +103,11 @@ if(UNIX)
   if(INSTALL_TO_MANGLED_PATHS)
     install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/)
     install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/)
+    install(EXPORT OpenCVModules DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/)
   else()
     install(FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/)
     install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/)
+    install(EXPORT OpenCVModules DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/)
   endif()
 endif()
 
index 195ec01..2a4d6f4 100644 (file)
@@ -270,3 +270,45 @@ if(CMAKE_CROSSCOMPILING AND OpenCV_SHARED AND (CMAKE_SYSTEM_NAME MATCHES "Linux"
     set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-rpath-link,${dir}")
   endforeach()
 endif()
+
+
+
+#
+# Some macroses for samples
+#
+macro(ocv_check_dependencies)
+  set(OCV_DEPENDENCIES_FOUND TRUE)
+  foreach(d ${ARGN})
+    if(NOT TARGET ${d})
+      set(OCV_DEPENDENCIES_FOUND FALSE)
+      break()
+    endif()
+  endforeach()
+endmacro()
+
+# adds include directories in such way that directories from the OpenCV source tree go first
+function(ocv_include_directories)
+  set(__add_before "")
+  foreach(dir ${ARGN})
+    get_filename_component(__abs_dir "${dir}" ABSOLUTE)
+    if("${__abs_dir}" MATCHES "^${OpenCV_DIR}")
+      list(APPEND __add_before "${dir}")
+    else()
+      include_directories(AFTER SYSTEM "${dir}")
+    endif()
+  endforeach()
+  include_directories(BEFORE ${__add_before})
+endfunction()
+
+macro(ocv_include_modules)
+  include_directories(BEFORE "${OpenCV_INCLUDE_DIRS}")
+endmacro()
+
+# remove all matching elements from the list
+macro(ocv_list_filterout lst regex)
+  foreach(item ${${lst}})
+    if(item MATCHES "${regex}")
+      list(REMOVE_ITEM ${lst} "${item}")
+    endif()
+  endforeach()
+endmacro()