diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4bebb8f68782323b16fd1da5aeabb4be85af0436..0ddae8bea34e711c27bdc8b8c3f51192302cb183 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -199,7 +199,6 @@ SET(HDRS
     constraint_container.h
     constraint_corner_2D.h
     constraint_epipolar.h
-    constraint_AHP.h
     constraint_imu.h
     constraint_fix.h
     constraint_fix_3D.h
@@ -222,7 +221,6 @@ SET(HDRS
     frame_imu.h
     landmark_corner_2D.h
     landmark_container.h
-    landmark_point_3d.h
     landmark_line_2D.h
     landmark_polyline_2D.h
     local_parametrization_polyline_extreme.h
@@ -291,7 +289,6 @@ SET(SRCS
     frame_imu.cpp
     landmark_corner_2D.cpp
     landmark_container.cpp
-    landmark_point_3d.cpp
     landmark_line_2D.cpp
     landmark_polyline_2D.cpp
     local_parametrization_polyline_extreme.cpp
@@ -373,8 +370,10 @@ IF (OpenCV_FOUND)
     SET(HDRS ${HDRS}
         active_search.h
         capture_image.h
+        constraint_AHP.h
         feature_point_image.h
         landmark_AHP.h
+        landmark_point_3d.h
         processor_image_feature.h
         processor_image_landmark.h
         )
@@ -383,6 +382,7 @@ IF (OpenCV_FOUND)
         capture_image.cpp
         feature_point_image.cpp
         landmark_AHP.cpp
+        landmark_point_3d.cpp
         processor_image_feature.cpp
         processor_image_landmark.cpp
         )
@@ -401,7 +401,6 @@ IF(YAMLCPP_FOUND)
 
     # sources
     SET(SRCS ${SRCS}
-        yaml/processor_image_yaml.cpp
         yaml/processor_odom_3D_yaml.cpp
         yaml/sensor_camera_yaml.cpp
         yaml/sensor_odom_3D_yaml.cpp
@@ -411,6 +410,11 @@ IF(YAMLCPP_FOUND)
             yaml/sensor_laser_2D_yaml.cpp
             )
     ENDIF(laser_scan_utils_FOUND)
+    IF(OpenCV_FOUND)
+        SET(SRCS ${SRCS}
+            yaml/processor_image_yaml.cpp
+            )
+    ENDIF(OpenCV_FOUND)
 ENDIF(YAMLCPP_FOUND)
 
 # create the shared library
diff --git a/src/ceres_wrapper/create_auto_diff_cost_function.cpp b/src/ceres_wrapper/create_auto_diff_cost_function.cpp
index 545f03166269ea209d6a4d226f71a0583eaa270c..4c93aae48423adbd1662d0259cba50249b30abc2 100644
--- a/src/ceres_wrapper/create_auto_diff_cost_function.cpp
+++ b/src/ceres_wrapper/create_auto_diff_cost_function.cpp
@@ -20,7 +20,11 @@
 #include "../constraint_point_2D.h"
 #include "../constraint_point_to_line_2D.h"
 #include "../constraint_container.h"
-#include "../constraint_AHP.h"
+
+#ifdef CV_VERSION
+  #include "../constraint_AHP.h"
+#endif
+
 #include "../constraint_imu.h"
 
 // Wolf and ceres auto_diff creators
@@ -98,7 +102,7 @@ ceres::CostFunction* createAutoDiffCostFunction(ConstraintBasePtr _ctr_ptr, bool
             	return createAutoDiffCostFunctionWrapper<ConstraintPointToLine2D>(_ctr_ptr);
             else
                 return createAutoDiffCostFunctionCeres<ConstraintPointToLine2D>(_ctr_ptr);
-
+#ifdef CV_VERSION
         case CTR_EPIPOLAR:
             if (_use_wolf_autodiff)
                 return createAutoDiffCostFunctionWrapper<ConstraintAHP>(_ctr_ptr);
@@ -110,7 +114,7 @@ ceres::CostFunction* createAutoDiffCostFunction(ConstraintBasePtr _ctr_ptr, bool
                 return createAutoDiffCostFunctionWrapper<ConstraintAHP>(_ctr_ptr);
             else
                 return createAutoDiffCostFunctionCeres<ConstraintAHP>(_ctr_ptr);
-
+#endif
         case CTR_IMU:
             if (_use_wolf_autodiff)
                 return createAutoDiffCostFunctionWrapper<ConstraintIMU>(_ctr_ptr);
diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt
index f898a9d3b42cbf5331df201a931742d43a9a33db..3aadcc8533140cc61f87e069287e17383d03ffb9 100644
--- a/src/examples/CMakeLists.txt
+++ b/src/examples/CMakeLists.txt
@@ -137,8 +137,10 @@ ENDIF(OpenCV_FOUND)
 
 IF(Ceres_FOUND)
     # Simple AHP test
-    ADD_EXECUTABLE(test_simple_AHP test_simple_AHP.cpp)
-    TARGET_LINK_LIBRARIES(test_simple_AHP ${PROJECT_NAME})
+    IF(OpenCV_FOUND)
+      ADD_EXECUTABLE(test_simple_AHP test_simple_AHP.cpp)
+      TARGET_LINK_LIBRARIES(test_simple_AHP ${PROJECT_NAME})
+    ENDIF(OpenCV_FOUND)
 ENDIF(Ceres_FOUND)
 
 # Processor Tracker Feature test
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
index 895990fb048595c597af0f05bb42202a130f411c..7680d9f62e59ac0f1e0a3e36e7e694b4371a9321 100644
--- a/src/test/CMakeLists.txt
+++ b/src/test/CMakeLists.txt
@@ -111,6 +111,7 @@ wolf_add_gtest(gtest_odom_3D gtest_odom_3D.cpp)
 target_link_libraries(gtest_odom_3D ${PROJECT_NAME})
 
 # ROI test
-wolf_add_gtest(gtest_roi_ORB gtest_roi_ORB.cpp)
-target_link_libraries(gtest_roi_ORB ${PROJECT_NAME})
-
+IF(OpenCV_FOUND)
+  wolf_add_gtest(gtest_roi_ORB gtest_roi_ORB.cpp)
+  target_link_libraries(gtest_roi_ORB ${PROJECT_NAME})
+ENDIF(OpenCV_FOUND)