diff --git a/Findfirewire_camera.cmake b/Findfirewire_camera.cmake
index 367e6afc1bf6bf1f72daaa87e89536e384a536da..6aac029a4c4cc6ed472833197e6b6b38ea407f32 100644
--- a/Findfirewire_camera.cmake
+++ b/Findfirewire_camera.cmake
@@ -1,22 +1,26 @@
-FIND_PATH(firewire_camera_INCLUDE_DIRS firewirecamera.h firewireserver.h firewireexceptions.h ptg_camera.h bumblebee.h ladybug.h /usr/local/include/iri/firewire_camera /usr/include/iri/firewire_camera)
+SET(name battery_monitor)
+#edit the following line to add the librarie's header files
+SET(header_files firewirecamera.h firewireserver.h firewireexceptions.h ptg_camera.h bumblebee.h ladybug.h)
 
-FIND_LIBRARY(firewire_camera_LIBRARIES
-    NAMES firewire_camera
-    PATHS /usr/local/lib/iri/firewire_camera /usr/lib/iri/firewire_camera)
+FIND_PATH(${name}_INCLUDE_DIRS ${header_files} /usr/local/include/iri/${name} /usr/include/iri/${name})
+
+FIND_LIBRARY(${name}_LIBRARIES
+    NAMES ${name}
+    PATHS /usr/local/lib/iri/${name} /usr/lib/iri/${name})
     
-SET(firewire_camera_INCLUDE_DIR ${firewire_camera_INCLUDE_DIRS})
-SET(firewire_camera_LIBRARY     ${firewire_camera_LIBRARIES})
+SET(${name}_INCLUDE_DIR ${${name}_INCLUDE_DIRS})
+SET(${name}_LIBRARY     ${${name}_LIBRARIES})
 
-IF (firewire_camera_INCLUDE_DIRS AND firewire_camera_LIBRARIES)
-   SET(firewire_camera_FOUND TRUE)
-ENDIF (firewire_camera_INCLUDE_DIRS AND firewire_camera_LIBRARIES)
+IF (${name}_INCLUDE_DIRS AND ${name}_LIBRARIES)
+   SET(${name}_FOUND TRUE)
+ENDIF (${name}_INCLUDE_DIRS AND ${name}_LIBRARIES)
 
-IF (firewire_camera_FOUND)
-   IF (NOT firewire_camera_FIND_QUIETLY)
-      MESSAGE(STATUS "Found firewire_camera camera driver: ${firewire_camera_LIBRARIES}")
-   ENDIF (NOT firewire_camera_FIND_QUIETLY)
-ELSE (firewire_camera_FOUND)
-   IF (firewire_camera_FIND_REQUIRED)
-      MESSAGE(FATAL_ERROR "Could not find firewire_camera camera driver")
-   ENDIF (firewire_camera_FIND_REQUIRED)
-ENDIF (firewire_camera_FOUND)
+IF (${name}_FOUND)
+   IF (NOT ${name}_FIND_QUIETLY)
+      MESSAGE(STATUS "Found ${name}: ${${name}_LIBRARIES}")
+   ENDIF (NOT ${name}_FIND_QUIETLY)
+ELSE (${name}_FOUND)
+   IF (${name}_FIND_REQUIRED)
+      MESSAGE(FATAL_ERROR "Could not find ${name}")
+   ENDIF (${name}_FIND_REQUIRED)
+ENDIF (${name}_FOUND)
\ No newline at end of file