diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index ac58e201ce4fe57da3e35bdf1ac6803acfe58304..d8ced0d8cebf97fa129a970e979d181dcfe11102 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -28,5 +28,8 @@ ENDIF(PYTHONQT_FOUND)
 
 IF(PYTHONQT_FOUND AND BUILD_PY_QGV)
   ADD_SUBDIRECTORY(pyqgv)
-  ADD_SUBDIRECTORY(pyqcustomplot)
 ENDIF(PYTHONQT_FOUND AND BUILD_PY_QGV)
+
+IF(PYTHONQT_FOUND AND BUILD_PY_QCUSTOM_PLOT)
+  ADD_SUBDIRECTORY(pyqcustomplot)
+ENDIF(PYTHONQT_FOUND AND BUILD_PY_QCUSTOM_PLOT)
diff --git a/plugins/pyqcustomplot/CMakeLists.txt b/plugins/pyqcustomplot/CMakeLists.txt
index ffe1b3ede3974e87188fe13c28804114da64e708..eabdaabc3b7d3257e900f9580339f5421cc5bd49 100644
--- a/plugins/pyqcustomplot/CMakeLists.txt
+++ b/plugins/pyqcustomplot/CMakeLists.txt
@@ -64,7 +64,8 @@ ADD_LIBRARY(${PLUGIN_NAME} SHARED ${${PLUGIN_NAME}_SOURCES}
   ${${PLUGIN_NAME}_RESOURCES_RCC}
   )
 
-TARGET_LINK_LIBRARIES(${PLUGIN_NAME} ${QT_LIBRARIES} ${PYTHONQT_LIBRARIES})
+TARGET_LINK_LIBRARIES(${PLUGIN_NAME} ${QT_LIBRARIES} ${PYTHONQT_LIBRARIES} ${PROJECT_NAME})
+PKG_CONFIG_USE_DEPENDENCY(${PLUGIN_NAME} omniORB4)
 
 # Uncomment to install
 INSTALL(TARGETS ${PLUGIN_NAME} DESTINATION lib/gepetto-gui-plugins)