Modules redifinition in case of multiple includes of OpenCV.mk in single Android...
authorAlexander Smorkalov <alexander.smorkalov@itseez.com>
Fri, 1 Feb 2013 09:15:39 +0000 (13:15 +0400)
committerAlexander Smorkalov <alexander.smorkalov@itseez.com>
Mon, 4 Feb 2013 08:22:22 +0000 (12:22 +0400)
cmake/templates/OpenCV.mk.in

index d52f75b..943d7cb 100644 (file)
@@ -89,14 +89,20 @@ define add_opencv_camera_module
     include $(PREBUILT_SHARED_LIBRARY)
 endef
 
-ifeq ($(OPENCV_INSTALL_MODULES),on)
-$(foreach module,$(OPENCV_LIBS),$(eval $(call add_opencv_module,$(module))))
-endif
-$(foreach module,$(OPENCV_3RDPARTY_COMPONENTS),$(eval $(call add_opencv_3rdparty_component,$(module))))
-$(foreach module,$(OPENCV_CAMERA_MODULES),$(eval $(call add_opencv_camera_module,$(module))))
+ifeq ($(OPENCV_MK_ALREADY_INCLUDED),)
+    ifeq ($(OPENCV_INSTALL_MODULES),on)
+        $(foreach module,$(OPENCV_LIBS),$(eval $(call add_opencv_module,$(module))))
+    endif
+
+    $(foreach module,$(OPENCV_3RDPARTY_COMPONENTS),$(eval $(call add_opencv_3rdparty_component,$(module))))
+    $(foreach module,$(OPENCV_CAMERA_MODULES),$(eval $(call add_opencv_camera_module,$(module))))
+
+    ifneq ($(OPENCV_BASEDIR),)
+        OPENCV_LOCAL_C_INCLUDES += $(foreach mod, $(OPENCV_MODULES), $(OPENCV_BASEDIR)/modules/$(mod)/include)
+    endif
 
-ifneq ($(OPENCV_BASEDIR),)
-    OPENCV_LOCAL_C_INCLUDES += $(foreach mod, $(OPENCV_MODULES), $(OPENCV_BASEDIR)/modules/$(mod)/include)
+    #turn off module installation to prevent their redefinition
+    OPENCV_MK_ALREADY_INCLUDED:=on
 endif
 
 ifeq ($(OPENCV_LOCAL_CFLAGS),)