Index: code/branches/camera/cmake/FindLua.cmake
===================================================================
--- code/branches/camera/cmake/FindLua.cmake	(revision 1109)
+++ code/branches/camera/cmake/FindLua.cmake	(revision 1211)
@@ -1,69 +1,74 @@
-# Find Lua includes and library
+#  Find Lua header and library files
 #
-# This module defines
-#  Lua_INCLUDE_DIR
-#  Lua_LIBRARIES, the libraries to link against to use Lua.
-#  Lua_LIB_DIR, the location of the libraries
-#  Lua_FOUND, If false, do not try to use Lua
+#  When called, this script tries to define:
+#  Lua_INCLUDE_DIR    Header files directory
+#  Lua_LIBRARIES      library files (or file when using lua 5.1)
+#  Lua_FOUND          defined (true) if lua was found
+#  Lua_VERSION        either 5.1 or 5.0 or undefined
 #
-# Copyright © 2007, Matt Williams
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
+#  authors: Benjamin Knecht, Reto Grieder
 
-MESSAGE(STATUS "lua libs in cache: ${Lua_LIBRARIES}")
 IF (Lua_LIBRARIES AND Lua_INCLUDE_DIR)
-    SET(Lua_FIND_QUIETLY TRUE) # Already in cache, be silent
+
+  # Already in cache, be silent
+  SET(Lua_FOUND TRUE)
+  SET(Lua_FIND_QUIETLY TRUE) 
+  MESSAGE(STATUS "Lua was found.")
+
+ELSE (Lua_LIBRARIES AND Lua_INCLUDE_DIR)
+
+  FIND_PATH(Lua_INCLUDE_DIR_51 lua.h
+    /usr/include/lua5.1
+    /usr/local/include/lua5.1
+    ../libs/lua-5.1.3/src)
+
+  FIND_PATH(Lua_INCLUDE_DIR_50 lua.h
+    /usr/include/lua50
+    /usr/local/include/lua50
+    /usr/pack/lua-5.0.3-sd/include)
+
+  FIND_LIBRARY(Lua_LIBRARY_51 NAMES lua5.1 lua PATHS
+    /usr/lib
+    /usr/local/lib
+    ../libs/lua-5.1.3/lib)
+
+  FIND_LIBRARY(Lua_LIBRARY_1_50 NAMES lua50 lua PATHS
+	/usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis
+    /usr/lib
+    /usr/local/lib)
+
+  FIND_LIBRARY(Lua_LIBRARY_2_50 NAMES lualib50 lualib PATHS
+	/usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis
+    /usr/lib
+    /usr/local/lib)
+
+
+  IF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51)
+
+    # Found newer lua 5.1 libs
+    SET(Lua_FOUND TRUE)
+    SET(Lua_VERSION 5.1 CACHE STRING "")
+    SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_51} CACHE PATH "")
+    SET(Lua_LIBRARIES ${Lua_LIBRARY_51} CACHE FILEPATH "")
+
+  ELSEIF(Lua_INCLUDE_DIR_50 AND Lua_LIBRARY_1_50 AND Lua_LIBRARY_2_50)
+
+    # Found older lua 5.0 libs
+    SET(Lua_FOUND TRUE)
+    SET(Lua_VERSION 5.0 CACHE STRING "")
+    SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_50} CACHE PATH "")
+    SET(Lua_LIBRARIES ${Lua_LIBRARY_1_50} ${Lua_LIBRARY_2_50} CACHE FILEPATH "")
+
+  ENDIF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51)
+	
+
+  IF (Lua_FOUND)
+    MESSAGE(STATUS "Found Lua: ${Lua_LIBRARIES}")
+  ELSE (Lua_FOUND)
+    IF (Lua_FIND_REQUIRED)
+      MESSAGE(FATAL_ERROR "Could not find Lua")
+    ENDIF (Lua_FIND_REQUIRED)
+  ENDIF (Lua_FOUND)
+
 ENDIF (Lua_LIBRARIES AND Lua_INCLUDE_DIR)
 
-FIND_PATH(Lua_INCLUDE_DIR lua.h
-	/usr/include/lua5.1
-	/usr/local/include/lua5.1
-	../libs/lua-5.1.3/src)
-
-FIND_LIBRARY(Lua_LIBRARIES lua5.1
-	/usr/lib
-	/usr/local/lib
-	../libs/lua-5.1.3/lib)
-
-IF (NOT Lua_INCLUDE_DIR)
- FIND_PATH(Lua_INCLUDE_DIR lua.h
-	/usr/include/lua50
-	/usr/local/include/lua50
-	/usr/pack/lua-5.0.3-sd/include)
-ENDIF (NOT Lua_INCLUDE_DIR)
-
-IF (NOT Lua_LIBRARIES)
- FIND_LIBRARY(Lua_LIBRARIES lua50
-	/usr/lib
-	/usr/local/lib)
-
- FIND_LIBRARY(Lua_LIBRARY lualib50
-	/usr/lib
-	/usr/local/lib)
-
-#SET(Lua_LIBRARIES ${Lua_LIBRARIES} ${Lua_LIBRARY})
-ENDIF (NOT Lua_LIBRARIES)
-
-#especially for tardis
-IF (NOT Lua_LIBRARIES)
- FIND_LIBRARY(Lua_LIBRARIES lua
-	/usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib)
-
- FIND_LIBRARY(Lua_LIBRARY lualib
-	/usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib)
-
-#SET(Lua_LIBRARIES ${Lua_LIBRARIES} ${Lua_LIBRARY})
-ENDIF (NOT Lua_LIBRARIES)
-
-IF (Lua_INCLUDE_DIR AND Lua_LIBRARIES)
-    SET(Lua_FOUND TRUE)
-ENDIF (Lua_INCLUDE_DIR AND Lua_LIBRARIES)
-
-IF (Lua_FOUND)
-    MESSAGE(STATUS "Found Lua: ${Lua_LIBRARIES}")
-    MESSAGE(STATUS "Found Lua: ${Lua_LIBRARY}")
-ELSE (Lua_FOUND)
-    IF (Lua_FIND_REQUIRED)
-        MESSAGE(FATAL_ERROR "Could not find Lua")
-    ENDIF (Lua_FIND_REQUIRED)
-ENDIF (Lua_FOUND)
Index: code/branches/camera/cmake/FindTCL.cmake
===================================================================
--- code/branches/camera/cmake/FindTCL.cmake	(revision 1211)
+++ code/branches/camera/cmake/FindTCL.cmake	(revision 1211)
@@ -0,0 +1,52 @@
+# - Find Tcl includes and libraries.
+# This module finds if TCL is installed and determines where the
+# include files and libraries are. It also determines what the name of
+# the library is. This code sets the following variables:
+#  TCL_LIBRARY        = path to Tcl library (tcl tcl80)
+#  TCL_INCLUDE_PATH   = path to where tcl.h can be found
+
+GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
+
+SET (TCLTK_POSSIBLE_LIB_PATHS
+  /usr/lib 
+  /usr/local/lib
+  "$ENV{ProgramFiles}/Tcl/Lib"
+  "C:/Program Files/Tcl/lib" 
+  "C:/Tcl/lib" 
+  ../libs/tcl8.5.2/unix
+  ../libs/tcl8.5.2/win
+)
+
+FIND_LIBRARY(TCL_LIBRARY
+  NAMES tcl tcl85 tcl8.5 tcl84 tcl8.4 tcl83 tcl8.3 tcl82 tcl8.2 tcl80 tcl8.0
+  PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
+)
+
+GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH)
+
+SET (TCLTK_POSSIBLE_INCLUDE_PATHS
+  /usr/include
+  /usr/local/include
+  /usr/include/tcl8.4
+  /usr/include/tcl8.3
+  /usr/include/tcl8.2
+  /usr/include/tcl8.0
+  "$ENV{ProgramFiles}/Tcl/include"
+  "C:/Program Files/Tcl/include"
+  C:/Tcl/include
+  ../libs/tcl8.5.2/generic
+)
+
+FIND_PATH(TCL_INCLUDE_PATH tcl.h
+  ${TCL_FRAMEWORK_INCLUDES} ${TCLTK_POSSIBLE_INCLUDE_PATHS}
+)
+
+IF(TCL_INCLUDE_PATH)
+  IF(TK_INCLUDE_PATH)
+    IF(TCL_LIBRARY)
+      IF(TK_LIBRARY)
+        SET(TCL_FOUND 1)
+      ENDIF(TK_LIBRARY)
+    ENDIF(TCL_LIBRARY)
+  ENDIF(TK_INCLUDE_PATH)
+ENDIF(TCL_INCLUDE_PATH)
