From 5349fa0302df3406947e97a87155c4736d19ccd7 Mon Sep 17 00:00:00 2001
From: Andrey Kamaev <no@email>
Date: Tue, 12 Jun 2012 16:18:14 +0000
Subject: [PATCH] Fixed target_link_libraries for python bindings

---
 modules/python/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/python/CMakeLists.txt b/modules/python/CMakeLists.txt
index 461ebca03..81cf81df8 100644
--- a/modules/python/CMakeLists.txt
+++ b/modules/python/CMakeLists.txt
@@ -60,7 +60,7 @@ add_custom_command(
    DEPENDS ${opencv_hdrs})
 
 add_library(${the_module} SHARED src2/cv2.cpp ${CMAKE_CURRENT_BINARY_DIR}/generated0.i ${cv2_generated_hdrs} src2/cv2.cv.hpp)
-if(PYTHON_DEBUG_LIBRARIES)
+if(PYTHON_DEBUG_LIBRARIES AND NOT PYTHON_LIBRARIES MATCHES "optimized.*debug")
   target_link_libraries(${the_module} debug ${PYTHON_DEBUG_LIBRARIES} optimized ${PYTHON_LIBRARIES})
 else()
   target_link_libraries(${the_module} ${PYTHON_LIBRARIES})