Index: code/trunk/cmake/CapitaliseName.cmake
===================================================================
--- code/trunk/cmake/CapitaliseName.cmake	(revision 6765)
+++ 	(revision )
@@ -1,33 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Examples:
- #    "orxonox"  --> "Orxonox"
- #    "ORXONOX"  --> "ORXONOX"
- #    "1orxonox" --> "1orxonox"
- #
-
-FUNCTION(CAPITALISE_NAME _name _output_var)
-  STRING(SUBSTRING "${_name}" 0 1 _first_letter)
-  STRING(TOUPPER "${_first_letter}" _first_letter)
-  STRING(REGEX REPLACE "^.(.*)$" "\\1" _rest "${_name}")
-  SET(${_output_var} "${_first_letter}${_rest}" PARENT_SCOPE)
-ENDFUNCTION(CAPITALISE_NAME)
Index: code/trunk/cmake/CheckOGREPlugins.cmake
===================================================================
--- code/trunk/cmake/CheckOGREPlugins.cmake	(revision 6765)
+++ 	(revision )
@@ -1,120 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Description:
- #    Function that checks each OGRE plugin for existance. Also looks for debug
- #    versions and sets them accordingly.
- #    All the plugins specified as function arguments have to be found or the
- #    script will issue a fatal error. Additionally, all release plugins have
- #    to be found in the same folder. Analogously for debug plugins.
- #    Output:
- #    OGRE_PLUGINS_FOLDER_DEBUG   Folder with the debug plugins
- #    OGRE_PLUGINS_FOLDER_RELEASE Folder with the release plugins
- #    OGRE_PLUGINS_DEBUG          Names of the debug plugins without extension
- #    OGRE_PLUGINS_RELEASE        Names of the release plugins without ext.
- #  Note:
- #    You must not specify render systems as input. That will be taken care of
- #    automatically.
- #
-
-FUNCTION(CHECK_OGRE_PLUGINS)
-
-  SET(OGRE_PLUGINS ${ARGN})
-
-  IF(WIN32)
-    # On Windows we need only *.dll, not *.lib. Especially the MSVC generator doesn't look for *.dll
-    SET(CMAKE_FIND_LIBRARY_SUFFIXES .dll)
-  ENDIF(WIN32)
-  # Do not prefix "lib" on any platform
-  SET(CMAKE_FIND_LIBRARY_PREFIXES "")
-
-  SET(OGRE_RENDER_SYSTEMS RenderSystem_GL RenderSystem_Direct3D9)
-  SET(OGRE_RENDER_SYSTEM_FOUND FALSE)
-  FOREACH(_plugin ${OGRE_PLUGINS} ${OGRE_RENDER_SYSTEMS})
-    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_OPTIMIZED
-      NAMES ${_plugin}
-      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
-      PATH_SUFFIXES bin/Release bin/release Release release lib lib/OGRE bin
-    )
-    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_DEBUG
-      NAMES ${_plugin}d ${_plugin}_d ${_plugin}
-      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
-      PATH_SUFFIXES bin/Debug bin/debug Debug debug lib lib/OGRE bin
-    )
-    # We only need at least one render system. Check at the end.
-    IF(NOT ${_plugin} MATCHES "RenderSystem")
-      IF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
-        MESSAGE(FATAL_ERROR "Could not find OGRE plugin named ${_plugin}")
-      ENDIF()
-    ELSEIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
-      SET(OGRE_RENDER_SYSTEM_FOUND TRUE)
-    ENDIF()
-
-    IF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
-      # If debug version is not available, release will do as well
-      IF(OGRE_PLUGIN_${_plugin}_DEBUG STREQUAL OGRE_PLUGIN_${_plugin}_OPTIMIZED)
-        # In this case the library finder didn't find real debug versions
-        SET(OGRE_PLUGIN_${_plugin}_DEBUG "OGRE_PLUGIN_${_plugin}_DEBUG-NOTFOUND" CACHE STRING "" FORCE)
-      ENDIF()
-      MARK_AS_ADVANCED(OGRE_PLUGIN_${_plugin}_OPTIMIZED OGRE_PLUGIN_${_plugin}_DEBUG)
-
-      ### Set variables to configure orxonox.ini correctly afterwards in bin/ ###
-      # Check and set the folders
-      GET_FILENAME_COMPONENT(_plugins_folder ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} PATH)
-      IF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _plugins_folder)
-        MESSAGE(FATAL_ERROR "Ogre release plugins have to be in the same folder!")
-      ENDIF()
-      SET(OGRE_PLUGINS_FOLDER_RELEASE ${_plugins_folder})
-      IF(OGRE_PLUGIN_${_plugin}_DEBUG)
-        GET_FILENAME_COMPONENT(_plugins_folder ${OGRE_PLUGIN_${_plugin}_DEBUG} PATH)
-      ENDIF()
-      IF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _plugins_folder)
-        MESSAGE(FATAL_ERROR "Ogre debug plugins have to be in the same folder!")
-      ENDIF()
-      SET(OGRE_PLUGINS_FOLDER_DEBUG ${_plugins_folder})
-
-      # Create a list with the plugins for release and debug configurations
-      LIST(APPEND OGRE_PLUGINS_RELEASE ${_plugin})
-      # Determine debug postfix ("d" or "_d" or none)
-      IF(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "_d\\.|_d$")
-        LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}_d")
-      ELSEIF(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "d\\.|d$")
-        LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}d")
-      ELSE()
-        LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}")
-      ENDIF()
-    ENDIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
-  ENDFOREACH(_plugin)
-  IF(NOT OGRE_RENDER_SYSTEM_FOUND)
-      MESSAGE(FATAL_ERROR "Could not find an OGRE render system plugin")
-  ENDIF()
-
-  # List has to be comma separated for orxonox.ini
-  STRING(REPLACE ";" ", " OGRE_PLUGINS_RELEASE "${OGRE_PLUGINS_RELEASE}")
-  STRING(REPLACE ";" ", " OGRE_PLUGINS_DEBUG   "${OGRE_PLUGINS_DEBUG}")
-
-  # Set variables outside function scope
-  SET(OGRE_PLUGINS_FOLDER_DEBUG ${OGRE_PLUGINS_FOLDER_DEBUG} PARENT_SCOPE)
-  SET(OGRE_PLUGINS_FOLDER_RELEASE ${OGRE_PLUGINS_FOLDER_RELEASE} PARENT_SCOPE)
-  SET(OGRE_PLUGINS_RELEASE ${OGRE_PLUGINS_RELEASE} PARENT_SCOPE)
-  SET(OGRE_PLUGINS_DEBUG ${OGRE_PLUGINS_DEBUG} PARENT_SCOPE)
-
-ENDFUNCTION(CHECK_OGRE_PLUGINS)
Index: code/trunk/cmake/CompareVersionStrings.cmake
===================================================================
--- code/trunk/cmake/CompareVersionStrings.cmake	(revision 6765)
+++ 	(revision )
@@ -1,78 +1,0 @@
-# Computes the relationship between two version strings.  A version
-# string is a number delineated by '.'s such as 1.3.2 and 0.99.9.1.
-# You can feed version strings with different number of dot versions,
-# and the shorter version number will be padded with zeros: 9.2 <
-# 9.2.1 will actually compare 9.2.0 < 9.2.1.
-#
-# Input: a_in - value, not variable
-#        b_in - value, not variable
-#        result_out - variable with value:
-#                         -1 : a_in <  b_in
-#                          0 : a_in == b_in
-#                          1 : a_in >  b_in
-#        optional argument - TRUE or default FALSE:
-#              When passing 1.2.3 and 1.2 and this switch is on
-#              the function will actually compare 1.2 < 1.2
-#              Caution: Only the first string is adjusted!
-#
-# Written by James Bigler.
-# Extended with an optional argument by Reto Grieder
-
-FUNCTION(COMPARE_VERSION_STRINGS a_in b_in result_out)
-  # Additional argument can be a switch to change compare behaviour
-  SET(cut_first ${ARGN})
-
-  # Replace '.' with ';' to allow easy tokenization of the string.
-  STRING(REPLACE "." ";" a ${a_in})
-  STRING(REPLACE "." ";" b ${b_in})
-
-  # Check the size of each list to see if they are equal.
-  LIST(LENGTH a a_length)
-  LIST(LENGTH b b_length)
-
-  # Pad the shorter list with zeros.
-
-  IF(a_length LESS b_length)
-    # a is shorter
-    SET(shorter a)
-    MATH(EXPR pad_range "${b_length} - ${a_length} - 1")
-  ELSE(a_length LESS b_length)
-    # b is shorter
-    SET(shorter b)
-    SET(first_longer a)
-    MATH(EXPR pad_range "${a_length} - ${b_length} - 1")
-  ENDIF(a_length LESS b_length)
-
-  # PAD out if we need to
-  IF(NOT pad_range LESS 0)
-    FOREACH(pad RANGE ${pad_range})
-      # Since shorter is an alias for b, we need to get to it by dereferencing shorter.
-      IF(cut_first AND first_longer)
-        LIST(REMOVE_AT a -1) # remove last element
-      ELSE(cut_first AND first_longer)
-        LIST(APPEND ${shorter} 0)
-      ENDIF(cut_first AND first_longer)
-    ENDFOREACH(pad)
-  ENDIF(NOT pad_range LESS 0)
-
-  SET(result 0)
-  SET(index 0)
-  FOREACH(a_version ${a})
-    IF(result EQUAL 0)
-      # Only continue to compare things as long as they are equal
-      LIST(GET b ${index} b_version)
-      # LESS
-      IF(a_version LESS b_version)
-        SET(result -1)
-      ENDIF(a_version LESS b_version)
-      # GREATER
-      IF(a_version GREATER b_version)
-        SET(result 1)
-      ENDIF(a_version GREATER b_version)
-    ENDIF(result EQUAL 0)
-    MATH(EXPR index "${index} + 1")
-  ENDFOREACH(a_version)
-
-  # Copy out the return result
-  SET(${result_out} ${result} PARENT_SCOPE)
-ENDFUNCTION(COMPARE_VERSION_STRINGS)
Index: code/trunk/cmake/CompilerConfigMSVC.cmake
===================================================================
--- code/trunk/cmake/CompilerConfigMSVC.cmake	(revision 6765)
+++ code/trunk/cmake/CompilerConfigMSVC.cmake	(revision 7163)
@@ -68,4 +68,5 @@
 ADD_COMPILER_FLAGS("-D__WIN32__ -D_WIN32"      CACHE)
 ADD_COMPILER_FLAGS("-D_CRT_SECURE_NO_WARNINGS" CACHE)
+ADD_COMPILER_FLAGS("-D_SCL_SECURE_NO_WARNINGS" CACHE)
 
 # Overwrite CMake default flags here.
Index: code/trunk/cmake/DetermineVersion.cmake
===================================================================
--- code/trunk/cmake/DetermineVersion.cmake	(revision 6765)
+++ 	(revision )
@@ -1,58 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Description:
- #    Inspects a given file for the following expressions
- #    "NAME_MAJOR_VERSION #"
- #    "NAME_MINOR_VERSION #"
- #    "NAME_PATCH_VERSION #"
- #    and sets NAME_VERSION accordingly. NAME_PART_VERSION variables are also
- #    set. If you wish to look for different parts (e.g. "first" "second", etc.)
- #    simply deliver them as additional arguments (have to be three though).
- #
-
-FUNCTION(DETERMINE_VERSION _name _file)
-  IF(EXISTS ${_file})
-    FILE(READ ${_file} _file_content)
-    SET(_parts ${ARGN})
-    LIST(LENGTH _parts _parts_length)
-    IF(NOT ${_parts_length} EQUAL 3)
-      SET(_parts MAJOR MINOR PATCH)
-    ENDIF()
-
-    FOREACH(_part ${_parts})
-      STRING(REGEX MATCH "${_name}_VERSION_${_part} +([0-9]+)" _match ${_file_content})
-      IF(_match)
-        SET(${_name}_VERSION_${_part} ${CMAKE_MATCH_1})
-        SET(${_name}_VERSION_${_part} ${CMAKE_MATCH_1} PARENT_SCOPE)
-      ELSE()
-        SET(${_name}_VERSION_${_part} "0")
-        SET(${_name}_VERSION_${_part} "0" PARENT_SCOPE)
-      ENDIF()
-      IF("${_parts}" MATCHES "^${_part}") # First?
-        SET(${_name}_VERSION "${${_name}_VERSION_${_part}}")
-      ELSE()
-        SET(${_name}_VERSION "${${_name}_VERSION}.${${_name}_VERSION_${_part}}")
-      ENDIF()
-    ENDFOREACH(_part)
-    SET(${_name}_VERSION "${${_name}_VERSION}" PARENT_SCOPE)
-  ENDIF(EXISTS ${_file})
-ENDFUNCTION(DETERMINE_VERSION)
Index: code/trunk/cmake/FindALUT.cmake
===================================================================
--- code/trunk/cmake/FindALUT.cmake	(revision 6765)
+++ 	(revision )
@@ -1,80 +1,0 @@
-# - Locate FreeAlut
-# This module defines
-#  ALUT_LIBRARY
-#  ALUT_FOUND, if false, do not try to link against Alut
-#  ALUT_INCLUDE_DIR, where to find the headers
-#
-# $ALUTDIR is an environment variable that would
-# correspond to the ./configure --prefix=$ALUTDIR
-# used in building Alut.
-#
-# Created by Eric Wing. This was influenced by the FindSDL.cmake module.
-# On OSX, this will prefer the Framework version (if found) over others.
-# People will have to manually change the cache values of
-# ALUT_LIBRARY to override this selection.
-# Tiger will include OpenAL as part of the System.
-# But for now, we have to look around.
-# Other (Unix) systems should be able to utilize the non-framework paths.
-#
-# Several changes and additions by Fabian 'x3n' Landau
-# Some simplifications by Adrian Friedli and Reto Grieder
-#                 > www.orxonox.net <
-
-INCLUDE(FindPackageHandleStandardArgs)
-INCLUDE(HandleLibraryTypes)
-
-FIND_PATH(ALUT_INCLUDE_DIR AL/alut.h
-  PATHS
-  $ENV{ALUTDIR}
-  ~/Library/Frameworks/OpenAL.framework
-  /Library/Frameworks/OpenAL.framework
-  /System/Library/Frameworks/OpenAL.framework # Tiger
-  PATH_SUFFIXES include include/OpenAL include/AL Headers
-)
-
-# I'm not sure if I should do a special casing for Apple. It is
-# unlikely that other Unix systems will find the framework path.
-# But if they do ([Next|Open|GNU]Step?),
-# do they want the -framework option also?
-IF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
-
-  STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR})
-  IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
-      OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
-      )
-    # String is in default search path, don't need to use -F
-    SET (ALUT_LIBRARY_OPTIMIZED "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
-  ELSE()
-    # String is not /Library/Frameworks, need to use -F
-    SET(ALUT_LIBRARY_OPTIMIZED "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
-  ENDIF()
-  # Clear the temp variable so nobody can see it
-  SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
-
-ELSE()
-  FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED
-    NAMES alut
-    PATHS $ENV{ALUTDIR}
-    PATH_SUFFIXES lib libs
-  )
-  FIND_LIBRARY(ALUT_LIBRARY_DEBUG
-    NAMES alutd alut_d alutD alut_D
-    PATHS $ENV{ALUTDIR}
-    PATH_SUFFIXES lib libs
-  )
-ENDIF()
-
-# Handle the REQUIRED argument and set ALUT_FOUND
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALUT DEFAULT_MSG
-    ALUT_LIBRARY_OPTIMIZED
-    ALUT_INCLUDE_DIR
-)
-
-# Collect optimized and debug libraries
-HANDLE_LIBRARY_TYPES(ALUT)
-
-MARK_AS_ADVANCED(
-    ALUT_INCLUDE_DIR
-    ALUT_LIBRARY_OPTIMIZED
-    ALUT_LIBRARY_DEBUG
-)
Index: code/trunk/cmake/FindCEGUI.cmake
===================================================================
--- code/trunk/cmake/FindCEGUI.cmake	(revision 6765)
+++ 	(revision )
@@ -1,103 +1,0 @@
-# Find CEGUI includes and library
-#
-# This module defines
-#  CEGUI_INCLUDE_DIR
-#  CEGUI_LIBRARY, the library to link against to use CEGUI.
-#  CEGUI_FOUND, If false, do not try to use CEGUI
-#  CEGUI_VERSION, the version as string "x.y.z"
-#  CEGUILUA_LIBRARY, Script module library
-#  CEGUILUA_USE_INTERNAL_LIBRARY, True if CEGUILUA_LIBRARY was not defined here
-#
-# Input:
-#  ENV{CEGUIDIR}, CEGUI path, optional
-#  FIND CEGUILUA_INTERNAL_SUPPORT, List of all CEGUILua version supported
-#                                  in the source repository
-#  CEGUILUA_USE_EXTERNAL_LIBRARY, Force finding of CEGUILua
-#
-# Created by Matt Williams to find OGRE libraries
-# Copyright © 2007, Matt Williams
-#
-# Modified by Nicolas Schlumberger to find CEGUI libraries
-# and make it run on the Tardis-Infrastucture of the ETH Zurich
-# Copyright 2007, Nicolas Schlumberger
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-#
-# Several changes and additions by Fabian 'x3n' Landau
-# Lots of simplifications by Adrian Friedli and Reto Grieder
-# Version checking and CEGUILua finding by Reto Grieder
-#                 > www.orxonox.net <
-
-INCLUDE(DetermineVersion)
-INCLUDE(FindPackageHandleAdvancedArgs)
-INCLUDE(HandleLibraryTypes)
-
-FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
-  PATHS $ENV{CEGUIDIR}
-  PATH_SUFFIXES include include/CEGUI CEGUI.framework/Headers
-)
-FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED
-  NAMES CEGUIBase CEGUI
-  PATHS $ENV{CEGUIDIR}
-  PATH_SUFFIXES lib bin
-)
-FIND_LIBRARY(CEGUI_LIBRARY_DEBUG
-  NAMES
-    CEGUIBased CEGUIBase_d CEGUIBaseD CEGUIBase_D
-    CEGUId CEGUI_d CEGUID CEGUI_D
-  PATHS $ENV{CEGUIDIR}
-  PATH_SUFFIXES lib bin
-)
-
-# Inspect CEGUIVersion.h for the version number
-DETERMINE_VERSION(CEGUI ${CEGUI_INCLUDE_DIR}/CEGUIVersion.h)
-
-# Handle the REQUIRED argument and set CEGUI_FOUND
-# Also checks the version requirements if given
-FIND_PACKAGE_HANDLE_ADVANCED_ARGS(CEGUI DEFAULT_MSG "${CEGUI_VERSION}"
-  CEGUI_LIBRARY_OPTIMIZED
-  CEGUI_INCLUDE_DIR
-)
-
-# Collect optimized and debug libraries
-HANDLE_LIBRARY_TYPES(CEGUI)
-
-MARK_AS_ADVANCED(
-  CEGUI_INCLUDE_DIR
-  CEGUI_LIBRARY_OPTIMIZED
-  CEGUI_LIBRARY_DEBUG
-)
-
-LIST(FIND CEGUILUA_INTERNAL_SUPPORT "${CEGUI_VERSION}" _find_result)
-IF(CEGUILUA_USE_EXTERNAL_LIBRARY OR _find_result EQUAL -1)
-  # Also try to find the CEGUILua libraries.
-  # There would already be libraries in src/ for versions 0.5 and 0.6
-  FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
-    NAMES CEGUILua
-    PATHS $ENV{CEGUIDIR}
-    PATH_SUFFIXES lib bin
-  )
-  FIND_LIBRARY(CEGUILUA_LIBRARY_DEBUG
-    NAMES CEGUILuad CEGUILua_d
-    PATHS $ENV{CEGUIDIR}
-    PATH_SUFFIXES lib bin
-  )
-
-  SET(CEGUILua_FIND_REQUIRED ${CEGUI_FIND_REQUIRED})
-  # Handle the REQUIRED argument and set CEGUILUA_FOUND
-  FIND_PACKAGE_HANDLE_STANDARD_ARGS(CEGUILua DEFAULT_MSG
-    CEGUILUA_LIBRARY_OPTIMIZED
-  )
-
-  # Collect optimized and debug libraries
-  HANDLE_LIBRARY_TYPES(CEGUILUA)
-
-  MARK_AS_ADVANCED(
-    CEGUILUA_LIBRARY_OPTIMIZED
-    CEGUILUA_LIBRARY_DEBUG
-  )
-
-ELSE(CEGUILUA_USE_EXTERNAL_LIBRARY OR _find_result EQUAL -1)
-  SET(CEGUILUA_USE_INTERNAL_LIBRARY TRUE)
-ENDIF(CEGUILUA_USE_EXTERNAL_LIBRARY OR _find_result EQUAL -1)
-
Index: code/trunk/cmake/FindDirectX.cmake
===================================================================
--- code/trunk/cmake/FindDirectX.cmake	(revision 6765)
+++ 	(revision )
@@ -1,53 +1,0 @@
-# Find script for DirectX on Windows
-# Specifically designed to find dxguid and dinput8 for OIS
-# Once loaded this will define
-#   DIRECTX_FOUND        - system has DirectX
-#   DIRECTX_INCLUDE_DIR  - include directory for DirectX
-#   DIRECTX_LIBRARIES    - libraries for DirectX
-#
-# Set ENV{DXSD_DIR} if that has not been done the SDK installation.
-#
-# Several changes and additions by Fabian 'x3n' Landau
-# Simplifications and CMake 2.6.0 bugfix by Reto Grieder
-#                 > www.orxonox.net <
-
-INCLUDE(FindPackageHandleStandardArgs)
-INCLUDE(HandleLibraryTypes)
-
-FIND_PATH(DIRECTX_INCLUDE_DIR dinput.h
-  PATHS $ENV{DXSDK_DIR}
-  PATH_SUFFIXES include
-)
-FIND_LIBRARY(DIRECTX_LIBRARY_input dinput8
-  PATHS $ENV{DXSDK_DIR}
-  PATH_SUFFIXES lib Lib lib/x86 Lib/x86
-  NO_DEFAULT_PATH # Or else CMake 2.6.0 will find the dll in system32 on windows
-)
-FIND_LIBRARY(DIRECTX_LIBRARY_input dinput8
-  PATHS $ENV{DXSDK_DIR}
-  PATH_SUFFIXES lib Lib lib/x86 Lib/x86
-)
-FIND_LIBRARY(DIRECTX_LIBRARY_guid dxguid
-  PATHS $ENV{DXSDK_DIR}
-  PATH_SUFFIXES lib Lib lib/x86 Lib/x86
-  NO_DEFAULT_PATH # Or else CMake 2.6.0 will find the dll in system32 on windows
-)
-FIND_LIBRARY(DIRECTX_LIBRARY_guid dxguid
-  PATHS $ENV{DXSDK_DIR}
-  PATH_SUFFIXES lib Lib lib/x86 Lib/x86
-)
-
-# Handle the REQUIRED argument and set DIRECTX_FOUND
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectX DEFAULT_MSG
-  DIRECTX_LIBRARY_input
-  DIRECTX_LIBRARY_guid
-  DIRECTX_INCLUDE_DIR
-)
-
-SET(DIRECTX_LIBRARIES ${DIRECTX_LIBRARY_input} ${DIRECTX_LIBRARY_guid})
-
-MARK_AS_ADVANCED(
-  DIRECTX_INCLUDE_DIR
-  DIRECTX_LIBRARY_input
-  DIRECTX_LIBRARY_guid
-)
Index: code/trunk/cmake/FindENet.cmake
===================================================================
--- code/trunk/cmake/FindENet.cmake	(revision 6765)
+++ 	(revision )
@@ -1,71 +1,0 @@
-# - Try to find enet
-# Once done this will define
-#
-#  ENET_FOUND - system has enet
-#  ENet_INCLUDE_DIR - the enet include directory
-#  ENet_LIBRARY - the library needed to link against enet
-#
-# $ENETDIR is an environment variable used for finding enet.
-#
-#  Borrowed from The Mana World
-#  http://themanaworld.org/
-#
-# Several changes and additions by Fabian 'x3n' Landau
-# Lots of simplifications by Adrian Friedli and Reto Grieder
-# Version checking by Reto Grieder
-#                 > www.orxonox.net <
-
-INCLUDE(FindPackageHandleAdvancedArgs)
-INCLUDE(HandleLibraryTypes)
-
-FIND_PATH(ENET_INCLUDE_DIR enet/enet.h
-  PATHS $ENV{ENETDIR}
-  PATH_SUFFIXES include
-)
-FIND_LIBRARY(ENET_LIBRARY_OPTIMIZED
-  NAMES enet
-  PATHS $ENV{ENETDIR}
-  PATH_SUFFIXES lib
-)
-FIND_LIBRARY(ENET_LIBRARY_DEBUG
-  NAMES enetd enet_d enet_D
-  PATHS $ENV{ENETDIR}
-  PATH_SUFFIXES lib
-)
-
-# Try to determine the version. Note that enet only stores the major
-# version in the header file. So we check for existing functions.
-# Hence the this script only distinguishes between 1.0, 1.1 and 1.2
-FILE(STRINGS ${ENET_INCLUDE_DIR}/enet/enet.h _enet_header REGEX "ENET_")
-IF(_enet_header MATCHES "ENET_VERSION[ \t]*=[ \t]*1")
-  IF(_enet_header MATCHES "enet_socket_set_option")
-    SET(ENET_VERSION 1.2)
-  ELSEIF(_enet_header MATCHES "enet_peer_disconnect_later")
-    SET(ENET_VERSION 1.1)
-  ELSE()
-    SET(ENET_VERSION 1.0)
-  ENDIF()
-ELSE()
-  SET(ENET_VERSION 0) # Script doesn't support versions below 1.0
-ENDIF()
-
-# Handle the REQUIRED argument and set ENET_FOUND
-# Also check the the version requirements
-FIND_PACKAGE_HANDLE_ADVANCED_ARGS(ENet DEFAULT_MSG ${ENET_VERSION}
-  ENET_LIBRARY_OPTIMIZED
-  ENET_INCLUDE_DIR
-)
-
-# Collect optimized and debug libraries
-IF(NOT LINK_ENET_DYNAMIC AND WIN32)
-  # ENet is linked statically, hence we need to add some windows dependencies
-  HANDLE_LIBRARY_TYPES(ENET ws2_32 winmm)
-ELSE()
-  HANDLE_LIBRARY_TYPES(ENET)
-ENDIF()
-
-MARK_AS_ADVANCED(
-  ENET_INCLUDE_DIR
-  ENET_LIBRARY_OPTIMIZED
-  ENET_LIBRARY_DEBUG
-)
Index: code/trunk/cmake/FindLua.cmake
===================================================================
--- code/trunk/cmake/FindLua.cmake	(revision 6765)
+++ 	(revision )
@@ -1,184 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Description:
- #    Finds either Lua 5.0 or Lua 5.1 on the system. The script regards the
- #    VERSION, EXACT, REQUIRED and QUIET arguments. A note about the EXACT
- #    argument: EXACT 5 will match all Lua 5 versions.
- #    When the search was successful, the following variables are set:
- #    LUA_INCLUDE_DIR, LUA_LIBRARIES, LUA_VERSION, LUA_FOUND
- #
-
-INCLUDE(CompareVersionStrings)
-INCLUDE(FindPackageHandleAdvancedArgs)
-INCLUDE(HandleLibraryTypes)
-
-# Macro that determines Lua version. Should work for versions 2.2 and above (current release: 5.1.4)
-FUNCTION(DETERMINE_LUA_VERSION _file _varname)
-  IF(EXISTS ${_file})
-    FILE(STRINGS ${_file} _file_content REGEX "LUA_VERSION|LUA_RELEASE")
-  ELSE()
-    SET(${_varname} "0" PARENT_SCOPE)
-    RETURN()
-  ENDIF()
-  STRING(REGEX REPLACE "^.*LUA_RELEASE[ \t]+\"Lua[ \t]+([.0-9]+)\".*$" "\\1" ${_varname} "${_file_content}")
-  IF(${_varname} STREQUAL "${_file_content}")
-    # At most version 5.1.0
-    STRING(REGEX REPLACE "^.*LUA_VERSION[ \t]+\"Lua[ \t]+([.0-9]+)\".*$" "\\1" ${_varname} "${_file_content}")
-    IF(${_varname} STREQUAL "${_file_content}")
-      MESSAGE(FATAL_ERROR "Could not determine Lua version which means this script has a bug")
-    ENDIF()
-    IF(${_varname} MATCHES "^[0-9]+\\.[0-9]+$")
-      SET(${_varname} "${${_varname}}.0") # E.g. "3.2" is "3.2.0" actually
-    ENDIF()
-  ENDIF()
-  SET(${_varname} "${${_varname}}" PARENT_SCOPE)
-ENDFUNCTION(DETERMINE_LUA_VERSION)
-
-
-# Find Lua 5.1
-FIND_PATH(LUA_5.1_INCLUDE_DIR lua.h
-  PATHS $ENV{LUA_DIR}
-  PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
-)
-IF(LUA_5.1_INCLUDE_DIR)
-  DETERMINE_LUA_VERSION(${LUA_5.1_INCLUDE_DIR}/lua.h LUA_5.1_VERSION)
-  COMPARE_VERSION_STRINGS("${LUA_5.1_VERSION}" "5.1" _version_compare TRUE)
-  IF(NOT _version_compare EQUAL 0)
-    # Incorrect version found, abort search
-    SET(LUA_5.1_INCLUDE_DIR "LUA_5.1_INCLUDE_DIR-NOTFOUND" CACHE PATH "" FORCE)
-  ELSE()
-    FIND_LIBRARY(LUA_5.1_LIBRARY_OPTIMIZED
-      NAMES lua51 lua5.1 lua
-      PATHS $ENV{LUA_DIR}
-      PATH_SUFFIXES lib64 lib
-    )
-    FIND_LIBRARY(LUA_5.1_LIBRARY_DEBUG
-      NAMES lua51d lua51_d lua5.1d lua5.1_d luad lua_d
-            lua51D lua51_D lua5.1D lua5.1_D luad lua_D
-      PATHS $ENV{LUA_DIR}
-      PATH_SUFFIXES lib64 lib
-    )
-    HANDLE_LIBRARY_TYPES(LUA_5.1)
-    SET(LUA_5.1_LIBRARIES ${LUA_5.1_LIBRARY})
-    IF(LUA_5.1_LIBRARIES)
-      SET(LUA_5.1_FOUND TRUE)
-    ENDIF()
-  ENDIF(NOT _version_compare EQUAL 0)
-ENDIF(LUA_5.1_INCLUDE_DIR)
-
-
-# Find Lua 5.0
-FIND_PATH(LUA_5.0_INCLUDE_DIR lua.h
-  PATHS $ENV{LUA_DIR}
-  PATH_SUFFIXES include/lua50 include/lua5.0 include/lua5 include/lua include
-)
-IF(LUA_5.0_INCLUDE_DIR)
-  DETERMINE_LUA_VERSION(${LUA_5.0_INCLUDE_DIR}/lua.h LUA_5.0_VERSION)
-  COMPARE_VERSION_STRINGS("${LUA_5.0_VERSION}" "5.0" _version_compare TRUE)
-  IF(NOT _version_compare EQUAL 0)
-    # Incorrect version found, abourt search
-    SET(LUA_5.0_INCLUDE_DIR "LUA_5.0_INCLUDE_DIR-NOTFOUND" CACHE PATH "" FORCE)
-  ELSE()
-    FIND_LIBRARY(LUA_5.0_LUA_LIBRARY_OPTIMIZED
-      NAMES lua50 lua5.0 lua5 lua
-      PATHS $ENV{LUA_DIR}
-      PATH_SUFFIXES lib64 lib
-    )
-    FIND_LIBRARY(LUA_5.0_LUA_LIBRARY_DEBUG
-      NAMES lua50d lua50_d lua5.0d lua5.0_d lua5d lua5_d luad lua_d
-            lua50D lua50_D lua5.0D lua5.0_D lua5d lua5_D luaD lua_D
-      PATHS $ENV{LUA_DIR}
-      PATH_SUFFIXES lib64 lib
-    )
-    HANDLE_LIBRARY_TYPES(LUA_5.0_LUA)
-
-    # In an OS X framework, lualib is usually included as part of the framework
-    # (like GLU in OpenGL.framework)
-    IF(${LUA_5.0_LUA_LIBRARY} MATCHES "framework")
-      SET(LUA_5.0_LIBRARIES ${LUA_5.0_LUA_LIBRARY})
-    ELSE()
-      FIND_LIBRARY(LUA_5.0_LUALIB_LIBRARY_OPTIMIZED
-        NAMES lualib50 lualib5.0 lualib5 lualib
-        PATHS $ENV{LUALIB_DIR} $ENV{LUA_DIR}
-        PATH_SUFFIXES lib64 lib
-      )
-      FIND_LIBRARY(LUA_5.0_LUALIB_LIBRARY_DEBUG
-        NAMES lualib50d lualib50_d lualib5.0d lualib5.0_d
-              lualib5d lualib5_d lualibd lualib_d
-              lualib50D lualib50_D lualib5.0D lualib5.0_D
-              lualib5D lualib5_D lualibD lualib_D
-        PATHS $ENV{LUALIB_DIR} $ENV{LUA_DIR}
-        PATH_SUFFIXES lib64 lib
-      )
-      HANDLE_LIBRARY_TYPES(LUA_5.0_LUALIB)
-      # Both libraries are required for Lua 5.0 to be found
-      IF(LUA_5.0_LUA_LIBRARY AND LUA_5.0_LUALIB_LIBRARY)
-        SET(LUA_5.0_LIBRARIES ${LUA_5.0_LUA_LIBRARY} ${LUA_5.0_LUALIB_LIBRARY})
-      ENDIF()
-    ENDIF(${LUA_5.0_LUA_LIBRARY} MATCHES "framework")
-
-    IF(LUA_5.0_LIBRARIES)
-      SET(LUA_5.0_FOUND TRUE)
-    ENDIF()
-  ENDIF(NOT _version_compare EQUAL 0)
-ENDIF(LUA_5.0_INCLUDE_DIR)
-
-# Pick the right version
-IF(Lua_FIND_VERSION_EXACT AND NOT Lua_FIND_VERSION MATCHES "^[0-9]*$")
-  STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+)(\\..*)?$" "\\1" LUA_VERSION_SELECTION ${Lua_FIND_VERSION})
-ELSE()
-  IF(LUA_5.1_FOUND) # Prefer version 5.1 if found
-    SET(LUA_VERSION_SELECTION "5.1")
-  ELSEIF(LUA_5.0_FOUND)
-    SET(LUA_VERSION_SELECTION "5.0")
-  ENDIF()
-ENDIF()
-
-SET(LUA_INCLUDE_DIR "${LUA_${LUA_VERSION_SELECTION}_INCLUDE_DIR}")
-SET(LUA_LIBRARIES "${LUA_${LUA_VERSION_SELECTION}_LIBRARIES}")
-SET(LUA_VERSION_LONG "${LUA_${LUA_VERSION_SELECTION}_VERSION}")
-SET(LUA_VERSION "${LUA_VERSION_SELECTION}")
-
-FIND_PACKAGE_HANDLE_ADVANCED_ARGS(Lua DEFAULT_MSG "${LUA_VERSION_LONG}"
-  LUA_LIBRARIES
-  LUA_INCLUDE_DIR
-)
-
-# Include the math library for Unix only
-IF(LUA_FOUND)
-  IF(UNIX AND NOT APPLE)
-    FIND_LIBRARY(UNIX_MATH_LIBRARY m)
-    SET(LUA_LIBRARIES ${LUA_LIBRARIES} ${UNIX_MATH_LIBRARY})
-  ENDIF()
-ENDIF(LUA_FOUND)
-
-MARK_AS_ADVANCED(
-  LUA_5.0_INCLUDE_DIR
-  LUA_5.0_LUA_LIBRARY_OPTIMIZED
-  LUA_5.0_LUA_LIBRARY_DEBUG
-  LUA_5.0_LUALIB_LIBRARY_OPTIMIZED
-  LUA_5.0_LUALIB_LIBRARY_DEBUG
-  LUA_5.1_INCLUDE_DIR
-  LUA_5.1_LIBRARY_OPTIMIZED
-  LUA_5.1_LIBRARY_DEBUG
-  UNIX_MATH_LIBRARY
-)
Index: code/trunk/cmake/FindOGRE.cmake
===================================================================
--- code/trunk/cmake/FindOGRE.cmake	(revision 6765)
+++ 	(revision )
@@ -1,55 +1,0 @@
-# Find OGRE includes and library
-#
-# This module defines
-#  OGRE_INCLUDE_DIR
-#  OGRE_LIBRARY, the library to link against to use OGRE.
-#  OGRE_FOUND, If false, do not try to use OGRE
-#
-# Copyright © 2007, Matt Williams
-# Modified by Nicolas Schlumberger to make it work on the Tardis-Infrastucture
-# of the ETH Zurich (removed later on)
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-#
-# Several changes and additions by Fabian 'x3n' Landau
-# Lots of simplifications by Adrian Friedli
-# Version checking by Reto Grieder
-#                 > www.orxonox.net <
-
-INCLUDE(DetermineVersion)
-INCLUDE(FindPackageHandleAdvancedArgs)
-INCLUDE(HandleLibraryTypes)
-
-FIND_PATH(OGRE_INCLUDE_DIR Ogre.h
-  PATHS $ENV{OGRE_HOME}
-  PATH_SUFFIXES include include/OGRE Ogre.framework/Headers
-)
-FIND_LIBRARY(OGRE_LIBRARY_OPTIMIZED
-  NAMES OgreMain Ogre
-  PATHS $ENV{OGRE_HOME}
-  PATH_SUFFIXES lib bin/Release bin/release Release release
-)
-FIND_LIBRARY(OGRE_LIBRARY_DEBUG
-  NAMES OgreMaind OgreMain_d OgreMainD OgreMain_D Ogred Ogre_d OgreD Ogre_d
-  PATHS $ENV{OGRE_HOME}
-  PATH_SUFFIXES lib bin/Debug bin/debug Debug debug Versions/A
-)
-
-# Inspect OgrePrerquisites.h for the version number
-DETERMINE_VERSION(OGRE ${OGRE_INCLUDE_DIR}/OgrePrerequisites.h)
-
-# Handle the REQUIRED argument and set OGRE_FOUND
-# Also check the version requirements
-FIND_PACKAGE_HANDLE_ADVANCED_ARGS(OGRE DEFAULT_MSG ${OGRE_VERSION}
-  OGRE_LIBRARY_OPTIMIZED
-  OGRE_INCLUDE_DIR
-)
-
-# Collect optimized and debug libraries
-HANDLE_LIBRARY_TYPES(OGRE)
-
-MARK_AS_ADVANCED(
-  OGRE_INCLUDE_DIR
-  OGRE_LIBRARY_OPTIMIZED
-  OGRE_LIBRARY_DEBUG
-)
Index: code/trunk/cmake/FindOgg.cmake
===================================================================
--- code/trunk/cmake/FindOgg.cmake	(revision 6765)
+++ 	(revision )
@@ -1,47 +1,0 @@
-# - Try to find ogg
-# Once done this will define
-#
-#  OGG_FOUND - system has ogg
-#  OGG_INCLUDE_DIR
-#  OGG_LIBRARY
-#
-# $OGGDIR is an environment variable used
-# for finding ogg.
-#
-# Several changes and additions by Fabian 'x3n' Landau
-# Most of all rewritten by Adrian Friedli
-# Debug versions and simplifications by Reto Grieder
-#                 > www.orxonox.net <
-
-INCLUDE(FindPackageHandleStandardArgs)
-INCLUDE(HandleLibraryTypes)
-
-FIND_PATH(OGG_INCLUDE_DIR ogg/ogg.h
-  PATHS $ENV{OGGDIR}
-  PATH_SUFFIXES include
-)
-FIND_LIBRARY(OGG_LIBRARY_OPTIMIZED
-  NAMES ogg
-  PATHS $ENV{OGGDIR}
-  PATH_SUFFIXES lib
-)
-FIND_LIBRARY(OGG_LIBRARY_DEBUG
-  NAMES oggd ogg_d oggD ogg_D
-  PATHS $ENV{OGGDIR}
-  PATH_SUFFIXES lib
-)
-
-# Handle the REQUIRED argument and set OGG_FOUND
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ogg DEFAULT_MSG
-  OGG_LIBRARY_OPTIMIZED
-  OGG_INCLUDE_DIR
-)
-
-# Collect optimized and debug libraries
-HANDLE_LIBRARY_TYPES(OGG)
-
-MARK_AS_ADVANCED(
-  OGG_INCLUDE_DIR
-  OGG_LIBRARY_OPTIMIZED
-  OGG_LIBRARY_DEBUG
-)
Index: code/trunk/cmake/FindPackageHandleAdvancedArgs.cmake
===================================================================
--- code/trunk/cmake/FindPackageHandleAdvancedArgs.cmake	(revision 6765)
+++ 	(revision )
@@ -1,66 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Description:
- #    Extension of the standard module "FindPackageHandleStandardArgs".
- #    This function also checks the version requirements. Also regards the
- #    EXACT keyword if specified in FIND_PACKAGE(...).
- #
-
-INCLUDE(FindPackageHandleStandardArgs)
-INCLUDE(CompareVersionStrings)
-
-FUNCTION(FIND_PACKAGE_HANDLE_ADVANCED_ARGS _name _fail_msg _version)
-
-  # Modify the message to include version requirements
-  IF("${_fail_msg}" STREQUAL "DEFAULT_MSG")
-    SET(_fail_msg_adv "Could NOT find ${_name}")
-  ELSE()
-    SET(_fail_msg_adv "${_fail_msg}")
-  ENDIF()
-  IF(${_name}_FIND_VERSION_EXACT)
-    SET(_fail_msg_adv "${_fail_msg_adv} (version requirements: exactly ${${_name}_FIND_VERSION})")
-  ELSE()
-    SET(_fail_msg_adv "${_fail_msg_adv} (version requirements: at least ${${_name}_FIND_VERSION})")
-  ENDIF()
-  FIND_PACKAGE_HANDLE_STANDARD_ARGS("${_name}" "${_fail_msg_adv}" ${ARGN})
-  STRING(TOUPPER ${_name} _NAME_UPPER)
-
-  # Also check version requirements if given to FindPackage(...)
-  IF(${_name}_FIND_VERSION)
-    # Note: the last argument of the function tells it to cut the first
-    #       version string instead of padding it with zeros if necessary
-    COMPARE_VERSION_STRINGS("${_version}" "${${_name}_FIND_VERSION}" _compatible TRUE)
-    IF(${_name}_FIND_VERSION_EXACT AND NOT _compatible EQUAL 0)
-      MESSAGE(FATAL_ERROR "Exact ${_name} version required is ${${_name}_FIND_VERSION}\n"
-                          "Your version is ${_version}")
-      SET(${_NAME_UPPER}_FOUND FALSE)
-    ELSEIF(_compatible LESS 0)
-      MESSAGE(FATAL_ERROR "Minimum ${_name} version required is ${${_name}_FIND_VERSION}\n"
-                          "Your version is ${_version}")
-      SET(${_NAME_UPPER}_FOUND FALSE)
-    ENDIF()
-  ENDIF(${_name}_FIND_VERSION)
-
-  # Raise scope (FindPackageHandleStandardArgs uses PARENT_SCOPE)
-  SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE)
-
-ENDFUNCTION(FIND_PACKAGE_HANDLE_ADVANCED_ARGS)
Index: code/trunk/cmake/FindVorbis.cmake
===================================================================
--- code/trunk/cmake/FindVorbis.cmake	(revision 6765)
+++ 	(revision )
@@ -1,62 +1,0 @@
-# - Try to find ogg/vorbis
-# Once done this will define
-#
-#  VORBIS_FOUND - system has vorbis
-#  VORBIS_INCLUDE_DIR
-#  VORBIS_LIBRARIES - vorbis and vorbisfile libraries
-#
-# $VORBISDIR is an environment variable used
-# for finding vorbis.
-#
-# Several changes and additions by Fabian 'x3n' Landau
-# Most of all rewritten by Adrian Friedli
-# Debug versions and simplifications by Reto Grieder
-#                 > www.orxonox.net <
-
-INCLUDE(FindPackageHandleStandardArgs)
-INCLUDE(HandleLibraryTypes)
-
-FIND_PATH(VORBIS_INCLUDE_DIR vorbis/codec.h
-  PATHS $ENV{VORBISDIR}
-  PATH_SUFFIXES include
-)
-FIND_LIBRARY(VORBIS_LIBRARY_OPTIMIZED
-  NAMES vorbis
-  PATHS $ENV{VORBISDIR}
-  PATH_SUFFIXES lib
-)
-FIND_LIBRARY(VORBIS_LIBRARY_DEBUG
-  NAMES vorbisd vorbis_d vorbisD vorbis_D
-  PATHS $ENV{VORBISDIR}
-  PATH_SUFFIXES lib
-)
-FIND_LIBRARY(VORBISFILE_LIBRARY_OPTIMIZED
-  NAMES vorbisfile
-  PATHS $ENV{VORBISDIR}
-  PATH_SUFFIXES lib
-)
-FIND_LIBRARY(VORBISFILE_LIBRARY_DEBUG
-  NAMES vorbisfiled vorbisfile_d vorbisfileD vorbisfile_D
-  PATHS $ENV{VORBISDIR}
-  PATH_SUFFIXES lib
-)
-
-# Handle the REQUIRED argument and set VORBIS_FOUND
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Vorbis DEFAULT_MSG
-  VORBIS_LIBRARY_OPTIMIZED
-  VORBISFILE_LIBRARY_OPTIMIZED
-  VORBIS_INCLUDE_DIR
-)
-
-# Collect optimized and debug libraries
-HANDLE_LIBRARY_TYPES(VORBIS)
-HANDLE_LIBRARY_TYPES(VORBISFILE)
-SET(VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
-
-MARK_AS_ADVANCED(
-  VORBIS_INCLUDE_DIR
-  VORBIS_LIBRARY_OPTIMIZED
-  VORBIS_LIBRARY_DEBUG
-  VORBISFILE_LIBRARY_OPTIMIZED
-  VORBISFILE_LIBRARY_DEBUG
-)
Index: code/trunk/cmake/FlagUtilities.cmake
===================================================================
--- code/trunk/cmake/FlagUtilities.cmake	(revision 6765)
+++ 	(revision )
@@ -1,177 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Description:
- #    Sets the compiler/linker flags. After the flags you can specify more args:
- #    Release, Debug, RelWithDebInfo, MinSizeRel: Build configs (inclusive)
- #    ReleaseAll: Sets the flags of all three release builds
- #    CACHE: Values are witten with SET_CACHE_ADVANCED
- #    FORCE: When writing to the cache, the values are set anyway
- #    Any variable names (like WIN32, MSVC, etc.): Condition (combined with AND)
- #    You can suffix the condition with a NOT if you wish
- #  Function names:
- #    [ADD/SET/REMOVE]_[COMPILER/LINKER]_FLAGS
- #  Caution: -If you use CACHE after calling the macro without CACHE, the value
- #            Will not be written unless FORCE is specified.
- #          - Also be aware to always specify the flags in quotes.
- #  Example:
- #    REMOVE_COMPILER_FLAGS("/Gm "asdf" -q"test -foo" CXX ReleaseAll NOT UNIX)
- #    This will only remove the CXX (C++) flags on a non Unix system for the
- #    Release, RelWithDebInfo and MinSizeRel configurations. The macros should
- #    be able to cope with "test -foo" as string argument for a flag.
- #
-
-INCLUDE(SeparateFlags)
-INCLUDE(SetCacheAdvanced)
-
-# Compiler flags, additional arguments:
-# C, CXX: Specify a language, default is both
-MACRO(SET_COMPILER_FLAGS _flags)
-  _INTERNAL_PARSE_FLAGS_ARGS(SET "C;CXX" "" "${_flags}" "${ARGN}")
-ENDMACRO(SET_COMPILER_FLAGS)
-# Add flags (flags don't get added twice)
-MACRO(ADD_COMPILER_FLAGS _flags)
-  _INTERNAL_PARSE_FLAGS_ARGS(APPEND "C;CXX" "" "${_flags}" "${ARGN}")
-ENDMACRO(ADD_COMPILER_FLAGS)
-# Remove flags
-MACRO(REMOVE_COMPILER_FLAGS _flags)
-  _INTERNAL_PARSE_FLAGS_ARGS(REMOVE_ITEM "C;CXX" "" "${_flags}" "${ARGN}")
-ENDMACRO(REMOVE_COMPILER_FLAGS)
-
-
-# Linker flags, additional arguments:
-# EXE, SHARED, MODULE: Specify a linker mode, default is all three
-MACRO(SET_LINKER_FLAGS _flags)
-  _INTERNAL_PARSE_FLAGS_ARGS(SET "EXE;SHARED;MODULE" "_LINKER" "${_flags}" "${ARGN}")
-ENDMACRO(SET_LINKER_FLAGS)
-# Add flags (flags don't get added twice)
-MACRO(ADD_LINKER_FLAGS _flags)
-  _INTERNAL_PARSE_FLAGS_ARGS(APPEND "EXE;SHARED;MODULE" "_LINKER" "${_flags}" "${ARGN}")
-ENDMACRO(ADD_LINKER_FLAGS)
-# Remove flags
-MACRO(REMOVE_LINKER_FLAGS _flags)
-  _INTERNAL_PARSE_FLAGS_ARGS(REMOVE_ITEM "EXE;SHARED;MODULE" "_LINKER" "${_flags}" "${ARGN}")
-ENDMACRO(REMOVE_LINKER_FLAGS)
-
-
-# Internal macro, do not use
-# Parses the given additional arguments and sets the flags to the
-# corresponding variables.
-MACRO(_INTERNAL_PARSE_FLAGS_ARGS _mode _keys _key_postfix _flags)
-  SET(_langs)
-  SET(_build_types)
-  SET(_cond TRUE)
-  SET(_invert_condition FALSE)
-  SET(_write_to_cache FALSE)
-  SET(_force FALSE)
-  STRING(REPLACE ";" "|" _key_regex "${_keys}")
-  SET(_key_regex "^(${_key_regex})$")
-
-  FOREACH(_arg ${ARGN})
-    IF(_arg MATCHES "${_key_regex}")
-      LIST(APPEND _langs "${_arg}")
-    ELSEIF(   _arg MATCHES "^(Debug|Release|MinSizeRel|RelWithDebInfo)$"
-           OR _arg MATCHES "^(DEBUG|RELEASE|MINSIZEREL|RELWITHDEBINFO)$")
-      STRING(TOUPPER "${_arg}" _upper_arg)
-      LIST(APPEND _build_types ${_upper_arg})
-    ELSEIF(_arg STREQUAL "ReleaseAll")
-      LIST(APPEND _build_types RELEASE MINSIZEREL RELWITHDEBINFO)
-    ELSEIF(_arg STREQUAL "CACHE")
-      SET(_write_to_cache TRUE)
-    ELSEIF(_arg STREQUAL "FORCE")
-      SET(_force TRUE)
-    ELSEIF(_arg MATCHES "^[Nn][Oo][Tt]$")
-      SET(_invert_condition TRUE)
-    ELSE()
-      IF(_invert_condition)
-        SET(_invert_condition FALSE)
-        IF(${_arg})
-          SET(_arg_cond FALSE)
-        ELSE()
-          SET(_arg_cond TRUE)
-       ENDIF()
-      ELSE()
-        SET(_arg_cond ${${_arg}})
-      ENDIF()
-      IF(_cond AND _arg_cond)
-        SET(_cond TRUE)
-      ELSE()
-        SET(_cond FALSE)
-      ENDIF()
-    ENDIF()
-  ENDFOREACH(_arg)
-
-  # No language specified, use all: C and CXX or EXE, SHARED and MODULE
-  IF(NOT DEFINED _langs)
-    SET(_langs ${_keys})
-  ENDIF()
-
-  IF(_cond)
-    FOREACH(_lang ${_langs})
-      SET(_varname "CMAKE_${_lang}${_key_postfix}_FLAGS")
-      IF(DEFINED _build_types)
-        FOREACH(_build_type ${_build_types})
-          _INTERNAL_PARSE_FLAGS(${_mode} "${_flags}" ${_varname}_${_build_type} ${_write_to_cache} ${_force})
-        ENDFOREACH(_build_type)
-      ELSE()
-        _INTERNAL_PARSE_FLAGS(${_mode} "${_flags}" ${_varname} ${_write_to_cache} ${_force})
-      ENDIF()
-    ENDFOREACH(_lang ${_langs})
-  ENDIF(_cond)
-ENDMACRO(_INTERNAL_PARSE_FLAGS_ARGS)
-
-
-# Internal macro, do not use
-# Modifies the flags according to the mode: set, add or remove
-# Also sets flags according to the CACHE and FORCE parameter.
-# If only CACHE is specified, SET_CACHE_ADVANCED() is used.
-MACRO(_INTERNAL_PARSE_FLAGS _mode _flags _varname _write_to_cache _force)
-  SEPARATE_FLAGS("${_flags}" _arg_flag_list)
-
-  IF("${_mode}" STREQUAL "SET")
-    # SET
-    SET(_flag_list "${_arg_flag_list}")
-  ELSE()
-    # ADD or REMOVE
-    SEPARATE_FLAGS("${${_varname}}" _flag_list)
-    IF(NOT _flag_list)
-      SET(_flag_list "") # LIST command requires a list in any case
-    ENDIF()
-    FOREACH(_flag ${_arg_flag_list})
-      LIST(${_mode} _flag_list "${_flag}")
-    ENDFOREACH(_flag)
-  ENDIF()
-
-  LIST(REMOVE_DUPLICATES _flag_list)
-  LIST(SORT _flag_list)
-  STRING(REPLACE ";" " " _flag_list "${_flag_list}")
-
-  IF(_write_to_cache)
-    IF(_force)
-      SET(${_varname} "${_flag_list}" CACHE STRING "${${_varname}}" FORCE)
-      SET(${_varname} "${_flag_list}" CACHE STRING "${${_varname}}" FORCE)
-    ELSE()
-      SET_CACHE_ADVANCED(${_varname} STRING "${${_varname}}" "${_flag_list}")
-    ENDIF()
-  ELSE()
-    SET(${_varname} "${_flag_list}")
-  ENDIF()
-ENDMACRO(_INTERNAL_PARSE_FLAGS)
Index: code/trunk/cmake/GenerateToluaBindings.cmake
===================================================================
--- code/trunk/cmake/GenerateToluaBindings.cmake	(revision 6765)
+++ 	(revision )
@@ -1,79 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Adrian Friedli
- #  Description:
- #    Sets the CMake options that will generate Tolua++ bindings.
- #  Parameters:
- #    _tolua_package - Name of the package, e.g. "Core"
- #    _target_source_files - Variable name of the target source files, the
- #                           script will add the generated files to this list.
- #    ARGN - The header files in the style "INTPUTFILES Foo.h Bar.h"
- #  Global Variables: (need to be set before)
- #    TOLUA_PARSER_SOURCE - Lua file with the parser source code
- #    TOLUA_PARSER_DEPENDENCIES - All the dependent lua files
- #    RUNTIME_LIBRARY_DIRECTORY - Working directory
- #
-
-FUNCTION(GENERATE_TOLUA_BINDINGS _tolua_package _target_source_files)
-  SET(_tolua_inputfiles ${ARGN})
-  LIST(REMOVE_ITEM _tolua_inputfiles "INPUTFILES")
-
-  SET(_tolua_pkgfile "${CMAKE_CURRENT_BINARY_DIR}/tolua.pkg")
-  SET(_tolua_cxxfile "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.cc")
-  SET(_tolua_hfile   "${CMAKE_BINARY_DIR}/src/toluabind/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.h")
-
-  SET(${_target_source_files}
-    ${${_target_source_files}}
-    ${_tolua_cxxfile}
-    ${_tolua_hfile}
-    PARENT_SCOPE
-  )
-  SOURCE_GROUP("Tolua" FILES ${_tolua_cxxfile} ${_tolua_hfile})
-  # Disable annoying GCC warnings
-  IF(CMAKE_COMPILER_IS_GNU)
-    SET_SOURCE_FILES_PROPERTIES(${_tolua_cxxfile} PROPERTIES COMPILE_FLAGS "-w")
-  ENDIF()
-  # Tolua binding speedup if required
-  IF(ORXONOX_RELEASE)
-    SET_SOURCE_FILES_PROPERTIES(${_tolua_cxxfile} PROPERTIES COMPILE_FLAGS "-DTOLUA_RELEASE")
-  ENDIF()
-
-  # Create temporary package file and implicit dependencies
-  FILE(REMOVE ${_tolua_pkgfile})
-  FOREACH(_tolua_inputfile ${_tolua_inputfiles})
-    FILE(APPEND ${_tolua_pkgfile} "\$cfile \"${_tolua_inputfile}\"\n")
-    LIST(APPEND _implicit_dependencies CXX ${_tolua_inputfile})
-  ENDFOREACH(_tolua_inputfile)
-
-  ADD_CUSTOM_COMMAND(
-    OUTPUT ${_tolua_cxxfile} ${_tolua_hfile}
-    COMMAND tolua++app_orxonox -n ${_tolua_package}
-                               -w ${CMAKE_CURRENT_SOURCE_DIR}
-                               -o ${_tolua_cxxfile}
-                               -H ${_tolua_hfile}
-                               -s ${TOLUA_PARSER_SOURCE}
-                                  ${_tolua_pkgfile}
-    DEPENDS           ${TOLUA_PARSER_DEPENDENCIES}
-    IMPLICIT_DEPENDS  ${_implicit_dependencies}
-    WORKING_DIRECTORY ${RUNTIME_LIBRARY_DIRECTORY}
-    COMMENT "Generating tolua bind files for package ${_tolua_package}"
-  )
-ENDFUNCTION(GENERATE_TOLUA_BINDINGS)
Index: code/trunk/cmake/GetGCCCompilerFlags.cmake
===================================================================
--- code/trunk/cmake/GetGCCCompilerFlags.cmake	(revision 6765)
+++ 	(revision )
@@ -1,73 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Description:
- #    Tries to return all GCC compiler flags set for a target. This also
- #    all definitions of the current directory.
- #
-
-INCLUDE(SeparateFlags)
-
-FUNCTION(GET_GCC_COMPILER_FLAGS _target _flagsvar)
-
-  # General flags
-  STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type_upper)
-  SET(_flag_str "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${_build_type_upper}}")
-
-  # Include directories
-  GET_DIRECTORY_PROPERTY(_include_dirs INCLUDE_DIRECTORIES)
-  IF(_include_dirs)
-    FOREACH(_directory ${_include_dirs})
-      SET(_flag_str "${_flag_str} -I${_directory}")
-    ENDFOREACH(_directory)
-  ENDIF()
-
-  # For shared libraries linked with gcc, we have to add -fPIC
-  GET_TARGET_PROPERTY(_target_type ${_target} TYPE)
-  IF(NOT MINGW AND ${_target_type} STREQUAL SHARED_LIBRARY)
-    SET(_flag_str "${_flag_str} -fPIC")
-  ENDIF()
-
-  # Target compile flags
-  GET_TARGET_PROPERTY(_target_flags ${_target} COMPILE_FLAGS)
-  IF(_target_flags)
-    SET(_flag_str "${_flag_str} ${_target_flags}")
-  ENDIF()
-
-  # Definitions from target and directory
-  GET_DIRECTORY_PROPERTY(_directory_defs                 COMPILE_DEFINITIONS)
-  GET_DIRECTORY_PROPERTY(_directory_defs_build_type      COMPILE_DEFINITIONS_${_build_type_upper})
-  GET_TARGET_PROPERTY(_target_defs            ${_target} COMPILE_DEFINITIONS)
-  GET_TARGET_PROPERTY(_target_defs_build_type ${_target} COMPILE_DEFINITIONS_${_build_type_upper})
-  GET_TARGET_PROPERTY(_target_def_symbol      ${_target} DEFINE_SYMBOL)
-  # Prefix them all with a "-D" if the property was found
-  FOREACH(_def ${_directory_defs} ${_directory_defs_build_type} ${_target_defs}
-               ${_target_defs_build_type} ${_target_def_symbol})
-    IF(_def)
-      SET(_flag_str "${_flag_str} -D${_def}")
-    ENDIF(_def)
-  ENDFOREACH(_def)
-
-  SEPARATE_FLAGS("${_flag_str}" _flags)
-  LIST(REMOVE_DUPLICATES _flags)
-  SET(${_flagsvar} ${_flags} PARENT_SCOPE)
-
-ENDFUNCTION(GET_GCC_COMPILER_FLAGS)
Index: code/trunk/cmake/HandleLibraryTypes.cmake
===================================================================
--- code/trunk/cmake/HandleLibraryTypes.cmake	(revision 6765)
+++ 	(revision )
@@ -1,42 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Description:
- #    Checks debug and optimized libaries and sets the variable ${_name}_LIBRARY
- #    accordingly. If only an optimized library was found, the "optimized"
- #    keyword is omitted to support the debug version too.
- #
-
-FUNCTION(HANDLE_LIBRARY_TYPES _name)
-  # Additional libraries can be added as additional arguments
-  IF(${_name}_LIBRARY_DEBUG AND ${_name}_LIBRARY_OPTIMIZED)
-    SET(${_name}_LIBRARY
-      optimized ${${_name}_LIBRARY_OPTIMIZED} ${ARGN}
-      debug     ${${_name}_LIBRARY_DEBUG}     ${ARGN}
-      PARENT_SCOPE
-    )
-  ELSE()
-    SET(${_name}_LIBRARY
-      ${${_name}_LIBRARY_OPTIMIZED} ${ARGN}
-      PARENT_SCOPE
-     )
-  ENDIF()
-ENDFUNCTION(HANDLE_LIBRARY_TYPES)
Index: code/trunk/cmake/InstallConfig.cmake
===================================================================
--- code/trunk/cmake/InstallConfig.cmake	(revision 6765)
+++ code/trunk/cmake/InstallConfig.cmake	(revision 7163)
@@ -52,10 +52,10 @@
   IF(UNIX) # Apple too?
     # Using absolute paths
-    SET(RUNTIME_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin)
-    SET(LIBRARY_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/orxonox)
-    SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/orxonox/static)
-    SET(MODULE_INSTALL_DIRECTORY  ${CMAKE_INSTALL_PREFIX}/lib/orxonox/modules)
+    SET(RUNTIME_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/games)
+    SET(LIBRARY_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/games/orxonox)
+    SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/games/orxonox/static)
+    SET(MODULE_INSTALL_DIRECTORY  ${CMAKE_INSTALL_PREFIX}/lib/games/orxonox/modules)
     SET(DOC_INSTALL_DIRECTORY     ${CMAKE_INSTALL_PREFIX}/share/doc/orxonox)
-    SET(DATA_INSTALL_DIRECTORY    ${CMAKE_INSTALL_PREFIX}/share/orxonox)
+    SET(DATA_INSTALL_DIRECTORY    ${CMAKE_INSTALL_PREFIX}/share/games/orxonox)
   ENDIF()
 
Index: code/trunk/cmake/LibraryConfig.cmake
===================================================================
--- code/trunk/cmake/LibraryConfig.cmake	(revision 6765)
+++ code/trunk/cmake/LibraryConfig.cmake	(revision 7163)
@@ -188,5 +188,5 @@
 
 # More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
-SET(OGRE_PLUGINS_INT Plugin_ParticleFX)
+SET(OGRE_PLUGINS_INT "Plugin_ParticleFX;Plugin_BSPSceneManager")
 IF(WIN32)
   # CG program manager is probably DirectX related (not available under unix)
Index: code/trunk/cmake/ParseMacroArguments.cmake
===================================================================
--- code/trunk/cmake/ParseMacroArguments.cmake	(revision 6765)
+++ 	(revision )
@@ -1,91 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Description:
- #    Parses a list of macro arguments which are separated by keywords and
- #    writes the result to the _arg_KEYWORD variable. Switches are set to their
- #    literal name if found and the lists contain their elements.
- #    The order of the arguments is arbitrary.
- #  Note:
- #    You have to specify the switches and list_names as a
- #    semicolon separated list or all hell breaks loose!
- #  Example:
- #    The arguments  BLUBB_FILES foo.cc bar.c NO_ASDF  will do the following:
- #    SET(_arg_NO_ASDF _arg_NO_ASDF)
- #    SET(_arg_BLUBB_FILES foo.cc bar.c)
- #    But NO_FOO will not be set at all if it was specified as a switch
- #
-
-MACRO(PARSE_MACRO_ARGUMENTS _switches _list_names)
-
-  # Using LIST(FIND ...) speeds up the process
-  SET(_keywords ${_switches} ${_list_names})
-
-  # Reset all arguments
-  FOREACH(_arg ${_switches} ${_list_names})
-    SET(_arg_${_arg})
-  ENDFOREACH(_arg)
-
-  # Parse all the arguments and set the corresponding variable
-  # If the option is just a switch, set the variable to its name for later use
-  FOREACH(_arg ${ARGN})
-
-    # Is the argument a keyword?
-    LIST(FIND _keywords ${_arg} _keyword_index)
-    IF(NOT _keyword_index EQUAL -1)
-
-      # Another optimisation
-      SET(_arg_found FALSE)
-      # Switches
-      FOREACH(_switch ${_switches})
-        IF(${_switch} STREQUAL ${_arg})
-          SET(_arg_${_switch} ${_switch})
-          SET(_arg_found TRUE)
-          # Avoid interpreting arguments after this one as options args for the previous one
-          SET(_storage_var)
-          BREAK()
-        ENDIF()
-      ENDFOREACH(_switch)
-
-      # Input options
-      IF(NOT _arg_found)
-        FOREACH(_list_name ${_list_names})
-          IF(${_list_name} STREQUAL ${_arg})
-            SET(_storage_var _arg_${_list_name})
-            BREAK()
-          ENDIF()
-        ENDFOREACH(_list_name)
-      ENDIF(NOT _arg_found)
-
-    ELSE()
-
-      # Arguments of an input option (like source files for SOURCE_FILES)
-      IF(_storage_var)
-        # Store in variable define above in the foreach loop
-        SET(${_storage_var} ${${_storage_var}} ${_arg})
-      ELSE()
-        MESSAGE(FATAL_ERROR "ORXONOX_ADD_${_target_type} was given a non compliant argument: ${_arg}")
-      ENDIF(_storage_var)
-
-    ENDIF()
-
-  ENDFOREACH(_arg)
-ENDMACRO(PARSE_MACRO_ARGUMENTS)
Index: code/trunk/cmake/PrecompiledHeaderFiles.cmake
===================================================================
--- code/trunk/cmake/PrecompiledHeaderFiles.cmake	(revision 6765)
+++ 	(revision )
@@ -1,161 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #
-
-INCLUDE(GetGCCCompilerFlags)
-
-MACRO(PRECOMPILED_HEADER_FILES_PRE_TARGET _target_name _header_file_arg _sourcefile_var)
-
-  GET_FILENAME_COMPONENT(_pch_header_file ${_header_file_arg} ABSOLUTE)
-  GET_FILENAME_COMPONENT(_pch_header_filename ${_pch_header_file} NAME)
-  GET_FILENAME_COMPONENT(_pch_header_filename_we ${_pch_header_file} NAME_WE)
-
-  IF(NOT EXISTS ${_pch_header_file})
-    MESSAGE(FATAL_ERROR "Specified precompiled headerfile '${_header_file_arg}' does not exist.")
-  ENDIF()
-
-  # Extract arguments from ARGN
-  FOREACH(_arg ${ARGN})
-    IF(NOT "${_arg}" STREQUAL "EXCLUDE")
-      IF(NOT _arg_second)
-        # Source files with PCH support
-        SET(_included_files ${_included_files} ${_arg})
-      ELSE()
-        # Source files to be excluded from PCH support (easier syntax this way)
-        SET(_excluded files ${_excluded_files} ${_arg})
-      ENDIF()
-    ELSE()
-      SET(_arg_second TRUE)
-    ENDIF()
-  ENDFOREACH(_arg)
-
-  # Use ${_sourcefile_var} if no files were specified explicitely
-  IF(NOT _included_files)
-    SET(_source_files ${${_sourcefile_var}})
-  ELSE()
-    SET(_source_files ${_included_files})
-  ENDIF()
-
-  # Exclude files (if specified)
-  FOREACH(_file ${_excluded_files})
-    LIST(FIND _source_files ${_file} _list_index)
-    IF(_list_index GREATER -1)
-      LIST(REMOVE_AT _source_files _list_index)
-    ELSE()
-      MESSAGE(FATAL_ERROR "Could not exclude file ${_file} in target ${_target_name}")
-    ENDIF()
-  ENDFOREACH(_file)
-
-  LIST(FIND ${_sourcefile_var} ${_pch_header_file} _list_index)
-  IF(_list_index EQUAL -1) # Header file could already be included with GET_ALL_HEADER_FILES
-    LIST(APPEND ${_sourcefile_var} ${_pch_header_file})
-  ENDIF()
-  SOURCE_GROUP("PCH" FILES ${_pch_header_file})
-
-  IF(MSVC)
-
-    # Write and add one source file, which generates the precompiled header file
-    SET(_pch_source_file "${CMAKE_CURRENT_BINARY_DIR}/${_pch_header_filename_we}.cc")
-    IF(NOT EXISTS ${_pch_source_file})
-      FILE(WRITE ${_pch_source_file} "#include \"${_pch_header_file}\"\n")
-    ENDIF()
-    SET_SOURCE_FILES_PROPERTIES(_pch_source_file PROPERTIES GENERATED TRUE)
-    LIST(APPEND ${_sourcefile_var} ${_pch_source_file})
-    SOURCE_GROUP("PCH" FILES ${_pch_source_file})
-
-    SET(_pch_file "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${_pch_header_filename}.pch")
-    # Set compile flags for generated source file
-    SET_SOURCE_FILES_PROPERTIES(${_pch_source_file} PROPERTIES COMPILE_FLAGS "/c /Yc\"${_pch_header_file}\" /Fp\"${_pch_file}\"")
-    # Set Compile flags for the other source files
-    FOREACH(_file ${_source_files})
-      GET_SOURCE_FILE_PROPERTY(_is_header ${_file} HEADER_FILE_ONLY)
-      IF(NOT _is_header)
-        GET_SOURCE_FILE_PROPERTY(_old_flags ${_file} COMPILE_FLAGS)
-        IF(NOT _old_flags)
-          SET(_old_flags "")
-        ENDIF()
-        SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES COMPILE_FLAGS "${_old_flags} /FI\"${_pch_header_file}\" /Yu\"${_pch_header_file}\" /Fp\"${_pch_file}\"")
-      ENDIF(NOT _is_header)
-    ENDFOREACH(_file)
-
-  ELSEIF(CMAKE_COMPILER_IS_GNU)
-
-    SET(_pch_file "${CMAKE_CURRENT_BINARY_DIR}/${_pch_header_filename}.gch")
-    SET(_pch_dep_helper_file "${CMAKE_CURRENT_BINARY_DIR}/${_target_name}PCHDependencyHelper.h")
-
-    # Append the gch-dir to make sure gcc finds the pch file
-    INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
-
-    # Get compiler flags of the source files (target does not yet exist!)
-    # This is just the best possible opportunity to address this dependency issue
-    GET_GCC_COMPILER_FLAGS(${_target_name} _pch_gcc_flags)
-    # Make sure we recompile the pch file even if only the flags change
-    IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}" OR NOT EXISTS "${_pch_dep_helper_file}")
-      SET(_INTERNAL_${_target_name}_PCH_GCC_FLAGS "${_pch_gcc_flags}" CACHE INTERNAL "")
-      FILE(WRITE ${_pch_dep_helper_file} "/* ${_pch_gcc_flags} */")
-    ENDIF()
-
-    # Set Compile flags for the other source files
-    FOREACH(_file ${_source_files})
-      GET_SOURCE_FILE_PROPERTY(_is_header ${_file} HEADER_FILE_ONLY)
-      IF(NOT _is_header)
-        GET_SOURCE_FILE_PROPERTY(_old_flags ${_file} COMPILE_FLAGS)
-        IF(NOT _old_flags)
-          SET(_old_flags "")
-        ENDIF()
-        SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES
-          COMPILE_FLAGS "${_old_flags} -include ${_pch_header_filename}"
-          OBJECT_DEPENDS "${_pch_header_file};${_pch_file}"
-        )
-      ENDIF(NOT _is_header)
-    ENDFOREACH(_file)
-
-  ENDIF()
-
-ENDMACRO(PRECOMPILED_HEADER_FILES_PRE_TARGET)
-
-FUNCTION(PRECOMPILED_HEADER_FILES_POST_TARGET _target_name)
-    # This macro is only necessary for GCC
-    IF(CMAKE_COMPILER_IS_GNU)
-
-      # Workaround for distcc
-      IF(CMAKE_CXX_COMPILER_ARG1)
-        # remove leading space in compiler argument
-        STRING(REGEX REPLACE "^ +" "" _pch_cmake_cxx_compiler_arg1 "${CMAKE_CXX_COMPILER_ARG1}")
-      ENDIF()
-
-      # Get compiler flags of the source files again (target exists this time)
-      GET_GCC_COMPILER_FLAGS(${_target_name} _pch_gcc_flags)
-
-      # Compile the header file
-      ADD_CUSTOM_COMMAND(
-        OUTPUT ${_pch_file}
-        COMMAND ${CMAKE_CXX_COMPILER}
-        ARGS ${pchsupport_compiler_cxx_arg1} ${_pch_gcc_flags} -c -x c++-header -o ${_pch_file} ${_pch_header_file}
-        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-        DEPENDS ${_pch_dep_helper_file}
-        IMPLICIT_DEPENDS CXX ${_pch_header_file}
-        VERBATIM
-      )
-
-    ENDIF(CMAKE_COMPILER_IS_GNU)
-ENDFUNCTION(PRECOMPILED_HEADER_FILES_POST_TARGET)
Index: code/trunk/cmake/SeparateFlags.cmake
===================================================================
--- code/trunk/cmake/SeparateFlags.cmake	(revision 6765)
+++ 	(revision )
@@ -1,63 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Description:
- #    Separates a string of program flags like "--blubb -test -D AA".
- #    " -" or " /" denotes the start of a flag.
- #    The same sequence inside double quotation marks is being ignored.
- #    Spaces not within quotes are cleaned meaningfully.
- #  Note:
- #    This macro cannot cope with semicolons in the flag string!
-
-FUNCTION(SEPARATE_FLAGS _flags _output_variable)
-  # Visual studio (esp. IntelliSense) doesn't like dashes to specify arguments
-  # Always use foward slashes instead
-  IF(MSVC)
-    SET(_argument_starter "/")
-  ELSE()
-    SET(_argument_starter "-")
-  ENDIF(MSVC)
-
-  SET(_flags_prep " ${_flags} -")
-  # Separate the chunks
-  STRING(REPLACE " " " ;" _flag_chunks "${_flags_prep}") # Max loop iterations
-  SET(_flag_string)
-  SET(_parsed_flags)
-  # Loop is necessary because the regex engine is greedy
-  FOREACH(_chunk ${_flag_chunks})
-    SET(_flag_string "${_flag_string}${_chunk}")
-    # Replace all " -" and " /" inside quotation marks
-    STRING(REGEX REPLACE "^(([^\"]*\"[^\"]*\")*[^\"]*\"[^\"]*) [/-]([^\"]*\")"
-           "\\1@39535493@\\3" _flag_string "${_flag_string}")
-    # Extract one flag if possible
-    SET(_flag)
-    STRING(REGEX REPLACE "^.* [/-](.+)( [/-].*$)" "${_argument_starter}\\1" _flag "${_flag_string}")
-    STRING(REGEX REPLACE "^.* [/-](.+)( [/-].*$)" "\\2"  _flag_string "${_flag_string}")
-    IF(NOT _flag STREQUAL _flag_string)
-      STRING(STRIP "${_flag}" _flag_stripped)
-      LIST(APPEND _parsed_flags "${_flag_stripped}")
-    ENDIF(NOT _flag STREQUAL _flag_string)
-  ENDFOREACH(_chunk)
-
-  # Re-replace all " -" and " /" inside quotation marks
-  STRING(REGEX REPLACE "@39535493@" " -" _parsed_flags "${_parsed_flags}")
-  SET(${_output_variable} "${_parsed_flags}" PARENT_SCOPE)
-ENDFUNCTION(SEPARATE_FLAGS)
Index: code/trunk/cmake/SetCacheAdvanced.cmake
===================================================================
--- code/trunk/cmake/SetCacheAdvanced.cmake	(revision 6765)
+++ 	(revision )
@@ -1,36 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Description:
- #    Write to the cache by force, but only if the user hasn't changed the value
- #    Additional argument is the value (may also be a list)
-
-FUNCTION(SET_CACHE_ADVANCED _varname _type _docstring)
-  SET(_value ${ARGN})
-  IF(NOT "${_type}" MATCHES "^(STRING|BOOL|PATH|FILEPATH)$")
-    MESSAGE(FATAL_ERROR "${_type} is not a valid CACHE entry type")
-  ENDIF()
-
-  IF(NOT DEFINED _INTERNAL_${_varname} OR "${_INTERNAL_${_varname}}" STREQUAL "${${_varname}}")
-    SET(${_varname} "${_value}" CACHE ${_type} "${_docstring}" FORCE)
-    SET(_INTERNAL_${_varname} "${_value}" CACHE INTERNAL "Do not edit in any case!")
-  ENDIF()
-ENDFUNCTION(SET_CACHE_ADVANCED)
Index: code/trunk/cmake/SourceFileUtilities.cmake
===================================================================
--- code/trunk/cmake/SourceFileUtilities.cmake	(revision 6765)
+++ 	(revision )
@@ -1,123 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Description:
- #    Several functions that help organising the source tree.
- #    [ADD/SET]_SOURCE_FILES - Writes source files to the cache by force and
- #                             adds the current directory.
- #                             Also compiles multiple source files into a single
- #                             one by including them
- #                             Use COMPILATION_[BEGIN|END] in
- #                             [ADD|SET]_SOURCE_FILES and specify the name of
- #                             the new source file after COMPILATION_BEGIN
- #    GET_ALL_HEADER_FILES   - Finds all header files recursively.
- #    GENERATE_SOURCE_GROUPS - Set Visual Studio source groups.
- #
-
-FUNCTION(PREPARE_SOURCE_FILES)
-  SET(_fullpath_sources)
-  FOREACH(_file ${ARGN})
-    IF(_file STREQUAL "COMPILATION_BEGIN")
-      SET(_compile TRUE)
-      # Next file is the name of the compilation
-      SET(_get_name TRUE)
-    ELSEIF(_get_name)
-      SET(_get_name FALSE)
-      SET(_compilation_name ${_file})
-    ELSEIF(_file STREQUAL "COMPILATION_END")
-      IF(NOT _compilation_name)
-        MESSAGE(FATAL_ERROR "No name provided for source file compilation")
-      ENDIF()
-      IF(NOT DISABLE_COMPILATIONS)
-        SET(_compilation_file ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name})
-        SET(_include_string)
-        FOREACH(_file2 ${_compilation})
-          SET(_include_string "${_include_string}#include \"${_file2}\"\n")
-        ENDFOREACH(_file2)
-        IF(EXISTS ${_compilation_file})
-          FILE(READ ${_compilation_file} _include_string_file)
-        ENDIF()
-        IF(NOT _include_string STREQUAL "${_include_string_file}")
-          FILE(WRITE ${_compilation_file} "${_include_string}")
-        ENDIF()
-        LIST(APPEND _fullpath_sources ${_compilation_file})
-        # MSVC hack that excludes the compilations from the intellisense database
-        # (There is a bug with the "-" instead of "/". Only works for "Zm#" argument)
-        IF(MSVC)
-          SET_SOURCE_FILES_PROPERTIES(${_compilation_file} PROPERTIES COMPILE_FLAGS "-Zm1000")
-        ENDIF()
-      ENDIF()
-      SET(_compilation_name)
-      SET(_compilation)
-      SET(_compile FALSE)
-    ELSE()
-      # Prefix the full path
-      GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION)
-      LIST(APPEND _fullpath_sources ${_filepath})
-      IF(_compile AND NOT DISABLE_COMPILATIONS)
-        LIST(APPEND _compilation ${_filepath})
-        LIST(APPEND _fullpath_sources "H")
-      ENDIF()
-    ENDIF()
-  ENDFOREACH(_file)
-  SET(_fullpath_sources ${_fullpath_sources} PARENT_SCOPE)
-ENDFUNCTION(PREPARE_SOURCE_FILES)
-
-
-# Adds source files with the full path to a list
-FUNCTION(ADD_SOURCE_FILES _varname)
-  PREPARE_SOURCE_FILES(${ARGN})
-  # Write into the cache to avoid variable scoping in subdirs
-  SET(${_varname} ${${_varname}} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
-ENDFUNCTION(ADD_SOURCE_FILES)
-
-
-# Sets source files with the full path
-FUNCTION(SET_SOURCE_FILES _varname)
-  PREPARE_SOURCE_FILES(${ARGN})
-  # Write into the cache to avoid variable scoping in subdirs
-  SET(${_varname} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
-ENDFUNCTION(SET_SOURCE_FILES)
-
-
-# Search the entire directory tree for header files and add them to a variable
-MACRO(GET_ALL_HEADER_FILES _target_varname)
-  FILE(GLOB_RECURSE ${_target_varname} ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
-ENDMACRO(GET_ALL_HEADER_FILES)
-
-
-# Generate source groups according to the directory structure
-FUNCTION(GENERATE_SOURCE_GROUPS)
-
-  FOREACH(_file ${ARGN})
-    GET_SOURCE_FILE_PROPERTY(_full_filepath ${_file} LOCATION)
-    FILE(RELATIVE_PATH _relative_path ${CMAKE_CURRENT_SOURCE_DIR} ${_full_filepath})
-    IF(NOT _relative_path MATCHES "^\\.\\.")
-      GET_FILENAME_COMPONENT(_relative_path ${_relative_path} PATH)
-      STRING(REPLACE "/" "\\\\" _group_path "${_relative_path}")
-      SOURCE_GROUP("Source\\${_group_path}" FILES ${_file})
-    ELSE()
-      # Has to be a compilation
-      SOURCE_GROUP("Compilations" FILES ${_file})
-    ENDIF()
-  ENDFOREACH(_file)
-
-ENDFUNCTION(GENERATE_SOURCE_GROUPS)
Index: code/trunk/cmake/TargetUtilities.cmake
===================================================================
--- code/trunk/cmake/TargetUtilities.cmake	(revision 6765)
+++ 	(revision )
@@ -1,295 +1,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Description:
- #    Adds a library or an executable like ADD_LIBRARY/ADD_EXECUTABLE, but
- #    accepts a lot more input information. Simply supply the keywords
- #    described below in any order you wish.
- #    The output is then stored in "_arg_ARGNAME" where ARGNAME is the the
- #    name of the switch or list.
- #
- #    Switches: (when given --> TRUE, FALSE otherwise)
- #      FIND_HEADER_FILES: Searches the current directory for all header files
- #                         and adds them to the target.
- #      EXCLUDE_FROM_ALL:  Inherited from ADD_LIBRARY/ADD_EXECUTABLE
- #      ORXONOX_EXTERNAL:  Specify this for third party libraries
- #      NO_DLL_INTERFACE:  Link statically with MSVC
- #      NO_SOURCE_GROUPS:  Don't create msvc source groups
- #      STATIC/SHARED:     Inherited from ADD_LIBRARY
- #      MODULE:            For dynamic module libraries
- #      WIN32:             Inherited from ADD_EXECUTABLE
- #      PCH_NO_DEFAULT:    Do not make precompiled header files default if
- #                         specified with PCH_FILE
- #      NO_INSTALL:        Do not install the target at all
- #
- #    Lists:
- #      LINK_LIBRARIES:    Redirects to TARGET_LINK_LIBRARIES
- #      VERSION:           Set version to the binary
- #      SOURCE_FILES:      Source files for the target
- #      DEFINE_SYMBOL:     Sets the DEFINE_SYMBOL target property
- #      TOLUA_FILES:       Files with tolua interface
- #      PCH_FILE:          Precompiled header file
- #      PCH_EXCLUDE:       Source files to be excluded from PCH support
- #      OUTPUT_NAME:       If you want a different name than the target name
- #  Note:
- #    This function also installs the target!
- #  Prerequisistes:
- #    ORXONOX_DEFAULT_LINK, ORXONOX_CONFIG_FILES
- #  Parameters:
- #    _target_name, ARGN for the macro arguments
- #
-
-INCLUDE(CMakeDependentOption)
-INCLUDE(CapitaliseName)
-INCLUDE(GenerateToluaBindings)
-INCLUDE(ParseMacroArguments)
-INCLUDE(SourceFileUtilities)
-IF(PCH_COMPILER_SUPPORT)
-  INCLUDE(PrecompiledHeaderFiles)
-ENDIF()
-
-MACRO(ORXONOX_ADD_LIBRARY _target_name)
-  TU_ADD_TARGET(${_target_name} LIBRARY "STATIC;SHARED" ${ARGN})
-ENDMACRO(ORXONOX_ADD_LIBRARY)
-
-MACRO(ORXONOX_ADD_EXECUTABLE _target_name)
-  TU_ADD_TARGET(${_target_name} EXECUTABLE "WIN32" ${ARGN})
-ENDMACRO(ORXONOX_ADD_EXECUTABLE)
-
-
-MACRO(TU_ADD_TARGET _target_name _target_type _additional_switches)
-  CAPITALISE_NAME(${_target_name} _target_name_capitalised)
-
-  # Specify all possible options (either switch or with add. arguments)
-  SET(_switches   FIND_HEADER_FILES  EXCLUDE_FROM_ALL  ORXONOX_EXTERNAL
-                  NO_DLL_INTERFACE   NO_SOURCE_GROUPS  ${_additional_switches}
-                  PCH_NO_DEFAULT     NO_INSTALL        MODULE)
-  SET(_list_names LINK_LIBRARIES  VERSION   SOURCE_FILES  DEFINE_SYMBOL
-                  TOLUA_FILES     PCH_FILE  PCH_EXCLUDE OUTPUT_NAME)
-  PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN})
-
-
-  # Workaround: Source file properties get lost when leaving a subdirectory
-  # Therefore an "H" after a file means we have to set it as HEADER_FILE_ONLY
-  FOREACH(_file ${_arg_SOURCE_FILES})
-    IF(_file STREQUAL "H")
-      SET_SOURCE_FILES_PROPERTIES(${_last_file} PROPERTIES HEADER_FILE_ONLY TRUE)
-    ELSE()
-      SET(_last_file ${_file})
-      LIST(APPEND _${_target_name}_source_files ${_file})
-    ENDIF()
-  ENDFOREACH(_file)
-
-  # Assemble all header files of the library
-  IF(_arg_FIND_HEADER_FILES)
-    GET_ALL_HEADER_FILES(_${_target_name}_header_files)
-  ENDIF()
-
-  # Remove potential duplicates
-  SET(_${_target_name}_files ${_${_target_name}_header_files} ${_${_target_name}_source_files})
-  LIST(REMOVE_DUPLICATES _${_target_name}_files)
-
-  # Generate the source groups
-  IF(NOT _arg_NO_SOURCE_GROUPS)
-    GENERATE_SOURCE_GROUPS(${_${_target_name}_files})
-
-    IF(NOT _arg_ORXONOX_EXTERNAL)
-      # Move the prereqs.h file to the config section
-      IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_target_name_capitalised}Prereqs.h)
-        SOURCE_GROUP("Config" FILES ${_target_name_capitalised}Prereqs.h)
-      ENDIF()
-      # Add the config files in a special source group
-      LIST(APPEND _${_target_name}_files ${ORXONOX_CONFIG_FILES})
-      SOURCE_GROUP("Config" FILES ${ORXONOX_CONFIG_FILES})
-    ENDIF()
-  ENDIF(NOT _arg_NO_SOURCE_GROUPS)
-
-  # TOLUA_FILES
-  IF(_arg_TOLUA_FILES)
-    GENERATE_TOLUA_BINDINGS(${_target_name_capitalised} _${_target_name}_files
-                            INPUTFILES ${_arg_TOLUA_FILES})
-  ENDIF()
-
-  # First part (pre target) of precompiled header files
-  IF(PCH_COMPILER_SUPPORT AND _arg_PCH_FILE)
-    # Provide convenient option to control PCH
-    STRING(TOUPPER "${_target_name}" _target_name_upper)
-    IF(_arg_PCH_NO_DEFAULT)
-      SET(PCH_DEFAULT FALSE)
-    ELSE()
-      SET(PCH_DEFAULT TRUE)
-    ENDIF()
-    CMAKE_DEPENDENT_OPTION(PCH_ENABLE_${_target_name_upper}
-      "Enable using precompiled header files for library ${_target_name}." ${PCH_DEFAULT} PCH_ENABLE OFF)
-
-    IF(PCH_ENABLE_${_target_name_upper})
-      PRECOMPILED_HEADER_FILES_PRE_TARGET(${_target_name} ${_arg_PCH_FILE} _${_target_name}_files EXCLUDE ${_arg_PCH_EXCLUDE})
-    ENDIF()
-  ENDIF()
-
-  # Certain libraries don't have dllexport/dllimport and can't be linked shared with msvc
-  IF(MSVC AND _arg_NO_DLL_INTERFACE)
-    SET(_arg_SHARED)
-    SET(_arg_STATIC STATIC)
-  ENDIF()
-
-  # No warnings needed from third party libraries
-  IF(_arg_ORXONOX_EXTERNAL)
-    REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)
-    ADD_COMPILER_FLAGS("-w")
-  ENDIF()
-
-  # Set default linking if required
-  IF(NOT _arg_SHARED AND NOT _arg_STATIC)
-    IF("${ORXONOX_DEFAULT_LINK}" STREQUAL "STATIC")
-      SET(_arg_STATIC STATIC)
-    ELSEIF("${ORXONOX_DEFAULT_LINK}" STREQUAL "SHARED")
-      SET(_arg_SHARED SHARED)
-    ENDIF()
-  ENDIF()
-
-  # MODULE A
-  # Always create shared libraries
-  IF(_arg_MODULE)
-    SET(_arg_SHARED SHARED)
-    SET(_arg_STATIC)
-  ENDIF()
-
-  # Don't compile header files
-  FOREACH(_file ${_${_target_name}_files})
-    IF(NOT _file MATCHES "\\.(c|cc|cpp)")
-      SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES HEADER_FILE_ONLY TRUE)
-    ENDIF()
-  ENDFOREACH(_file)
-
-
-
-  # Add the library/executable
-  IF("${_target_type}" STREQUAL "LIBRARY")
-    ADD_LIBRARY(${_target_name} ${_arg_STATIC} ${_arg_SHARED}
-                ${_arg_EXCLUDE_FROM_ALL} ${_${_target_name}_files})
-  ELSE()
-    ADD_EXECUTABLE(${_target_name} ${_arg_WIN32} ${_arg_EXCLUDE_FROM_ALL}
-                   ${_${_target_name}_files})
-  ENDIF()
-
-
-
-  # Change library prefix to "lib"
-  IF(MSVC AND ${_target_type} STREQUAL "LIBRARY")
-    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
-      PREFIX "lib"
-    )
-  ENDIF()
-
-  # MSVC hack to exclude external library sources from the intellisense database
-  # (IntelliSense stops working when adding "-Zm1000" as compile flag. "/Zm1000"
-  # would not work because of the slash)
-  IF(_arg_ORXONOX_EXTERNAL AND MSVC)
-    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES COMPILE_FLAGS "-Zm1000")
-  ENDIF()
-
-  # MODULE B
-  IF (_arg_MODULE)
-    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
-      RUNTIME_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Windows
-      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Unix
-    )
-    ADD_MODULE(${_target_name})
-  ENDIF()
-
-  # LINK_LIBRARIES
-  IF(_arg_LINK_LIBRARIES)
-    TARGET_LINK_LIBRARIES(${_target_name} ${_arg_LINK_LIBRARIES})
-  ENDIF()
-
-  # DEFINE_SYMBOL
-  IF(_arg_DEFINE_SYMBOL)
-    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES DEFINE_SYMBOL ${_arg_DEFINE_SYMBOL})
-  ENDIF()
-
-  # VERSION
-  IF(_arg_VERSION)
-    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES VERSION ${_arg_VERSION})
-  ELSEIF(NOT _arg_ORXONOX_EXTERNAL)
-    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES VERSION ${ORXONOX_VERSION})
-  ENDIF()
-
-  # OUTPUT_NAME
-  IF(_arg_OUTPUT_NAME)
-    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES OUTPUT_NAME  ${_arg_OUTPUT_NAME})
-  ENDIF()
-
-  # Second part of precompiled header files
-  IF(PCH_COMPILER_SUPPORT AND PCH_ENABLE_${_target_name_upper} AND _arg_PCH_FILE)
-    PRECOMPILED_HEADER_FILES_POST_TARGET(${_target_name} ${_arg_PCH_FILE})
-  ENDIF()
-
-  IF(NOT _arg_STATIC AND NOT _arg_NO_INSTALL)
-    IF(_arg_MODULE)
-      INSTALL(TARGETS ${_target_name}
-        RUNTIME DESTINATION ${MODULE_INSTALL_DIRECTORY}
-        LIBRARY DESTINATION ${MODULE_INSTALL_DIRECTORY}
-      )
-    ELSE()
-      INSTALL(TARGETS ${_target_name}
-        RUNTIME DESTINATION ${RUNTIME_INSTALL_DIRECTORY}
-        LIBRARY DESTINATION ${LIBRARY_INSTALL_DIRECTORY}
-      )
-    ENDIF()
-  ENDIF()
-
-ENDMACRO(TU_ADD_TARGET)
-
-
-# Creates a helper file with name <name_of_the_library>${ORXONOX_MODULE_EXTENSION}
-# This helps finding dynamically loadable modules at runtime
-
-FUNCTION(ADD_MODULE _target)
-  # We use the properties to get the name because the librarys name may differ from
-  # the target name (for example orxonox <-> liborxonox)
-
-  GET_TARGET_PROPERTY(_target_loc ${_target} LOCATION)
-  GET_FILENAME_COMPONENT(_target_name ${_target_loc} NAME_WE)
-
-  IF(CMAKE_CONFIGURATION_TYPES)
-    FOREACH(_config ${CMAKE_CONFIGURATION_TYPES})
-      SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_config}/${_target_name}${ORXONOX_MODULE_EXTENSION})
-
-      FILE(WRITE ${_module_filename})
-
-      INSTALL(
-        FILES ${_module_filename}
-        DESTINATION ${MODULE_INSTALL_DIRECTORY}
-        CONFIGURATIONS ${_config}
-      )
-    ENDFOREACH()
-  ELSE()
-    SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_target_name}${ORXONOX_MODULE_EXTENSION})
-
-    FILE(WRITE ${_module_filename})
-
-    INSTALL(
-      FILES ${_module_filename}
-      DESTINATION ${MODULE_INSTALL_DIRECTORY}
-    )
-  ENDIF()
-ENDFUNCTION(ADD_MODULE)
Index: code/trunk/cmake/tools/CapitaliseName.cmake
===================================================================
--- code/trunk/cmake/tools/CapitaliseName.cmake	(revision 7163)
+++ code/trunk/cmake/tools/CapitaliseName.cmake	(revision 7163)
@@ -0,0 +1,33 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Examples:
+ #    "orxonox"  --> "Orxonox"
+ #    "ORXONOX"  --> "ORXONOX"
+ #    "1orxonox" --> "1orxonox"
+ #
+
+FUNCTION(CAPITALISE_NAME _name _output_var)
+  STRING(SUBSTRING "${_name}" 0 1 _first_letter)
+  STRING(TOUPPER "${_first_letter}" _first_letter)
+  STRING(REGEX REPLACE "^.(.*)$" "\\1" _rest "${_name}")
+  SET(${_output_var} "${_first_letter}${_rest}" PARENT_SCOPE)
+ENDFUNCTION(CAPITALISE_NAME)
Index: code/trunk/cmake/tools/CheckOGREPlugins.cmake
===================================================================
--- code/trunk/cmake/tools/CheckOGREPlugins.cmake	(revision 7163)
+++ code/trunk/cmake/tools/CheckOGREPlugins.cmake	(revision 7163)
@@ -0,0 +1,120 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Function that checks each OGRE plugin for existance. Also looks for debug
+ #    versions and sets them accordingly.
+ #    All the plugins specified as function arguments have to be found or the
+ #    script will issue a fatal error. Additionally, all release plugins have
+ #    to be found in the same folder. Analogously for debug plugins.
+ #    Output:
+ #    OGRE_PLUGINS_FOLDER_DEBUG   Folder with the debug plugins
+ #    OGRE_PLUGINS_FOLDER_RELEASE Folder with the release plugins
+ #    OGRE_PLUGINS_DEBUG          Names of the debug plugins without extension
+ #    OGRE_PLUGINS_RELEASE        Names of the release plugins without ext.
+ #  Note:
+ #    You must not specify render systems as input. That will be taken care of
+ #    automatically.
+ #
+
+FUNCTION(CHECK_OGRE_PLUGINS)
+
+  SET(OGRE_PLUGINS ${ARGN})
+
+  IF(WIN32)
+    # On Windows we need only *.dll, not *.lib. Especially the MSVC generator doesn't look for *.dll
+    SET(CMAKE_FIND_LIBRARY_SUFFIXES .dll)
+  ENDIF(WIN32)
+  # Do not prefix "lib" on any platform
+  SET(CMAKE_FIND_LIBRARY_PREFIXES "")
+
+  SET(OGRE_RENDER_SYSTEMS RenderSystem_GL RenderSystem_Direct3D9)
+  SET(OGRE_RENDER_SYSTEM_FOUND FALSE)
+  FOREACH(_plugin ${OGRE_PLUGINS} ${OGRE_RENDER_SYSTEMS})
+    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_OPTIMIZED
+      NAMES ${_plugin}
+      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
+      PATH_SUFFIXES bin/Release bin/release Release release lib lib/OGRE bin
+    )
+    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_DEBUG
+      NAMES ${_plugin}d ${_plugin}_d ${_plugin}
+      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
+      PATH_SUFFIXES bin/Debug bin/debug Debug debug lib lib/OGRE bin
+    )
+    # We only need at least one render system. Check at the end.
+    IF(NOT ${_plugin} MATCHES "RenderSystem")
+      IF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
+        MESSAGE(FATAL_ERROR "Could not find OGRE plugin named ${_plugin}")
+      ENDIF()
+    ELSEIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
+      SET(OGRE_RENDER_SYSTEM_FOUND TRUE)
+    ENDIF()
+
+    IF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
+      # If debug version is not available, release will do as well
+      IF(OGRE_PLUGIN_${_plugin}_DEBUG STREQUAL OGRE_PLUGIN_${_plugin}_OPTIMIZED)
+        # In this case the library finder didn't find real debug versions
+        SET(OGRE_PLUGIN_${_plugin}_DEBUG "OGRE_PLUGIN_${_plugin}_DEBUG-NOTFOUND" CACHE STRING "" FORCE)
+      ENDIF()
+      MARK_AS_ADVANCED(OGRE_PLUGIN_${_plugin}_OPTIMIZED OGRE_PLUGIN_${_plugin}_DEBUG)
+
+      ### Set variables to configure orxonox.ini correctly afterwards in bin/ ###
+      # Check and set the folders
+      GET_FILENAME_COMPONENT(_plugins_folder ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} PATH)
+      IF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _plugins_folder)
+        MESSAGE(FATAL_ERROR "Ogre release plugins have to be in the same folder!")
+      ENDIF()
+      SET(OGRE_PLUGINS_FOLDER_RELEASE ${_plugins_folder})
+      IF(OGRE_PLUGIN_${_plugin}_DEBUG)
+        GET_FILENAME_COMPONENT(_plugins_folder ${OGRE_PLUGIN_${_plugin}_DEBUG} PATH)
+      ENDIF()
+      IF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _plugins_folder)
+        MESSAGE(FATAL_ERROR "Ogre debug plugins have to be in the same folder!")
+      ENDIF()
+      SET(OGRE_PLUGINS_FOLDER_DEBUG ${_plugins_folder})
+
+      # Create a list with the plugins for release and debug configurations
+      LIST(APPEND OGRE_PLUGINS_RELEASE ${_plugin})
+      # Determine debug postfix ("d" or "_d" or none)
+      IF(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "_d\\.|_d$")
+        LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}_d")
+      ELSEIF(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "d\\.|d$")
+        LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}d")
+      ELSE()
+        LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}")
+      ENDIF()
+    ENDIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
+  ENDFOREACH(_plugin)
+  IF(NOT OGRE_RENDER_SYSTEM_FOUND)
+      MESSAGE(FATAL_ERROR "Could not find an OGRE render system plugin")
+  ENDIF()
+
+  # List has to be comma separated for orxonox.ini
+  STRING(REPLACE ";" ", " OGRE_PLUGINS_RELEASE "${OGRE_PLUGINS_RELEASE}")
+  STRING(REPLACE ";" ", " OGRE_PLUGINS_DEBUG   "${OGRE_PLUGINS_DEBUG}")
+
+  # Set variables outside function scope
+  SET(OGRE_PLUGINS_FOLDER_DEBUG ${OGRE_PLUGINS_FOLDER_DEBUG} PARENT_SCOPE)
+  SET(OGRE_PLUGINS_FOLDER_RELEASE ${OGRE_PLUGINS_FOLDER_RELEASE} PARENT_SCOPE)
+  SET(OGRE_PLUGINS_RELEASE ${OGRE_PLUGINS_RELEASE} PARENT_SCOPE)
+  SET(OGRE_PLUGINS_DEBUG ${OGRE_PLUGINS_DEBUG} PARENT_SCOPE)
+
+ENDFUNCTION(CHECK_OGRE_PLUGINS)
Index: code/trunk/cmake/tools/CompareVersionStrings.cmake
===================================================================
--- code/trunk/cmake/tools/CompareVersionStrings.cmake	(revision 7163)
+++ code/trunk/cmake/tools/CompareVersionStrings.cmake	(revision 7163)
@@ -0,0 +1,78 @@
+# Computes the relationship between two version strings.  A version
+# string is a number delineated by '.'s such as 1.3.2 and 0.99.9.1.
+# You can feed version strings with different number of dot versions,
+# and the shorter version number will be padded with zeros: 9.2 <
+# 9.2.1 will actually compare 9.2.0 < 9.2.1.
+#
+# Input: a_in - value, not variable
+#        b_in - value, not variable
+#        result_out - variable with value:
+#                         -1 : a_in <  b_in
+#                          0 : a_in == b_in
+#                          1 : a_in >  b_in
+#        optional argument - TRUE or default FALSE:
+#              When passing 1.2.3 and 1.2 and this switch is on
+#              the function will actually compare 1.2 < 1.2
+#              Caution: Only the first string is adjusted!
+#
+# Written by James Bigler.
+# Extended with an optional argument by Reto Grieder
+
+FUNCTION(COMPARE_VERSION_STRINGS a_in b_in result_out)
+  # Additional argument can be a switch to change compare behaviour
+  SET(cut_first ${ARGN})
+
+  # Replace '.' with ';' to allow easy tokenization of the string.
+  STRING(REPLACE "." ";" a ${a_in})
+  STRING(REPLACE "." ";" b ${b_in})
+
+  # Check the size of each list to see if they are equal.
+  LIST(LENGTH a a_length)
+  LIST(LENGTH b b_length)
+
+  # Pad the shorter list with zeros.
+
+  IF(a_length LESS b_length)
+    # a is shorter
+    SET(shorter a)
+    MATH(EXPR pad_range "${b_length} - ${a_length} - 1")
+  ELSE(a_length LESS b_length)
+    # b is shorter
+    SET(shorter b)
+    SET(first_longer a)
+    MATH(EXPR pad_range "${a_length} - ${b_length} - 1")
+  ENDIF(a_length LESS b_length)
+
+  # PAD out if we need to
+  IF(NOT pad_range LESS 0)
+    FOREACH(pad RANGE ${pad_range})
+      # Since shorter is an alias for b, we need to get to it by dereferencing shorter.
+      IF(cut_first AND first_longer)
+        LIST(REMOVE_AT a -1) # remove last element
+      ELSE(cut_first AND first_longer)
+        LIST(APPEND ${shorter} 0)
+      ENDIF(cut_first AND first_longer)
+    ENDFOREACH(pad)
+  ENDIF(NOT pad_range LESS 0)
+
+  SET(result 0)
+  SET(index 0)
+  FOREACH(a_version ${a})
+    IF(result EQUAL 0)
+      # Only continue to compare things as long as they are equal
+      LIST(GET b ${index} b_version)
+      # LESS
+      IF(a_version LESS b_version)
+        SET(result -1)
+      ENDIF(a_version LESS b_version)
+      # GREATER
+      IF(a_version GREATER b_version)
+        SET(result 1)
+      ENDIF(a_version GREATER b_version)
+    ENDIF(result EQUAL 0)
+    MATH(EXPR index "${index} + 1")
+  ENDFOREACH(a_version)
+
+  # Copy out the return result
+  SET(${result_out} ${result} PARENT_SCOPE)
+ENDFUNCTION(COMPARE_VERSION_STRINGS)
Index: code/trunk/cmake/tools/DetermineVersion.cmake
===================================================================
--- code/trunk/cmake/tools/DetermineVersion.cmake	(revision 7163)
+++ code/trunk/cmake/tools/DetermineVersion.cmake	(revision 7163)
@@ -0,0 +1,58 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Inspects a given file for the following expressions
+ #    "NAME_VERSION_MAJOR #"
+ #    "NAME_VERSION_MINOR #"
+ #    "NAME_VERSION_PATCH #"
+ #    and sets NAME_VERSION accordingly. NAME_PART_VERSION variables are also
+ #    set. If you wish to look for different parts (e.g. "first" "second", etc.)
+ #    simply deliver them as additional arguments (have to be three though).
+ #
+
+FUNCTION(DETERMINE_VERSION _name _file)
+  IF(EXISTS ${_file})
+    FILE(READ ${_file} _file_content)
+    SET(_parts ${ARGN})
+    LIST(LENGTH _parts _parts_length)
+    IF(NOT ${_parts_length} EQUAL 3)
+      SET(_parts MAJOR MINOR PATCH)
+    ENDIF()
+
+    FOREACH(_part ${_parts})
+      STRING(REGEX MATCH "${_name}_VERSION_${_part} +([0-9]+)" _match ${_file_content})
+      IF(_match)
+        SET(${_name}_VERSION_${_part} ${CMAKE_MATCH_1})
+        SET(${_name}_VERSION_${_part} ${CMAKE_MATCH_1} PARENT_SCOPE)
+      ELSE()
+        SET(${_name}_VERSION_${_part} "0")
+        SET(${_name}_VERSION_${_part} "0" PARENT_SCOPE)
+      ENDIF()
+      IF("${_parts}" MATCHES "^${_part}") # First?
+        SET(${_name}_VERSION "${${_name}_VERSION_${_part}}")
+      ELSE()
+        SET(${_name}_VERSION "${${_name}_VERSION}.${${_name}_VERSION_${_part}}")
+      ENDIF()
+    ENDFOREACH(_part)
+    SET(${_name}_VERSION "${${_name}_VERSION}" PARENT_SCOPE)
+  ENDIF(EXISTS ${_file})
+ENDFUNCTION(DETERMINE_VERSION)
Index: code/trunk/cmake/tools/FindALUT.cmake
===================================================================
--- code/trunk/cmake/tools/FindALUT.cmake	(revision 7163)
+++ code/trunk/cmake/tools/FindALUT.cmake	(revision 7163)
@@ -0,0 +1,80 @@
+# - Locate FreeAlut
+# This module defines
+#  ALUT_LIBRARY
+#  ALUT_FOUND, if false, do not try to link against Alut
+#  ALUT_INCLUDE_DIR, where to find the headers
+#
+# $ALUTDIR is an environment variable that would
+# correspond to the ./configure --prefix=$ALUTDIR
+# used in building Alut.
+#
+# Created by Eric Wing. This was influenced by the FindSDL.cmake module.
+# On OSX, this will prefer the Framework version (if found) over others.
+# People will have to manually change the cache values of
+# ALUT_LIBRARY to override this selection.
+# Tiger will include OpenAL as part of the System.
+# But for now, we have to look around.
+# Other (Unix) systems should be able to utilize the non-framework paths.
+#
+# Several changes and additions by Fabian 'x3n' Landau
+# Some simplifications by Adrian Friedli and Reto Grieder
+#                 > www.orxonox.net <
+
+INCLUDE(FindPackageHandleStandardArgs)
+INCLUDE(HandleLibraryTypes)
+
+FIND_PATH(ALUT_INCLUDE_DIR AL/alut.h
+  PATHS
+  $ENV{ALUTDIR}
+  ~/Library/Frameworks/OpenAL.framework
+  /Library/Frameworks/OpenAL.framework
+  /System/Library/Frameworks/OpenAL.framework # Tiger
+  PATH_SUFFIXES include include/OpenAL include/AL Headers
+)
+
+# I'm not sure if I should do a special casing for Apple. It is
+# unlikely that other Unix systems will find the framework path.
+# But if they do ([Next|Open|GNU]Step?),
+# do they want the -framework option also?
+IF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
+
+  STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR})
+  IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
+      OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
+      )
+    # String is in default search path, don't need to use -F
+    SET (ALUT_LIBRARY_OPTIMIZED "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
+  ELSE()
+    # String is not /Library/Frameworks, need to use -F
+    SET(ALUT_LIBRARY_OPTIMIZED "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
+  ENDIF()
+  # Clear the temp variable so nobody can see it
+  SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
+
+ELSE()
+  FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED
+    NAMES alut
+    PATHS $ENV{ALUTDIR}
+    PATH_SUFFIXES lib libs
+  )
+  FIND_LIBRARY(ALUT_LIBRARY_DEBUG
+    NAMES alutd alut_d alutD alut_D
+    PATHS $ENV{ALUTDIR}
+    PATH_SUFFIXES lib libs
+  )
+ENDIF()
+
+# Handle the REQUIRED argument and set ALUT_FOUND
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALUT DEFAULT_MSG
+    ALUT_LIBRARY_OPTIMIZED
+    ALUT_INCLUDE_DIR
+)
+
+# Collect optimized and debug libraries
+HANDLE_LIBRARY_TYPES(ALUT)
+
+MARK_AS_ADVANCED(
+    ALUT_INCLUDE_DIR
+    ALUT_LIBRARY_OPTIMIZED
+    ALUT_LIBRARY_DEBUG
+)
Index: code/trunk/cmake/tools/FindCEGUI.cmake
===================================================================
--- code/trunk/cmake/tools/FindCEGUI.cmake	(revision 7163)
+++ code/trunk/cmake/tools/FindCEGUI.cmake	(revision 7163)
@@ -0,0 +1,103 @@
+# Find CEGUI includes and library
+#
+# This module defines
+#  CEGUI_INCLUDE_DIR
+#  CEGUI_LIBRARY, the library to link against to use CEGUI.
+#  CEGUI_FOUND, If false, do not try to use CEGUI
+#  CEGUI_VERSION, the version as string "x.y.z"
+#  CEGUILUA_LIBRARY, Script module library
+#  CEGUILUA_USE_INTERNAL_LIBRARY, True if CEGUILUA_LIBRARY was not defined here
+#
+# Input:
+#  ENV{CEGUIDIR}, CEGUI path, optional
+#  FIND CEGUILUA_INTERNAL_SUPPORT, List of all CEGUILua version supported
+#                                  in the source repository
+#  CEGUILUA_USE_EXTERNAL_LIBRARY, Force finding of CEGUILua
+#
+# Created by Matt Williams to find OGRE libraries
+# Copyright © 2007, Matt Williams
+#
+# Modified by Nicolas Schlumberger to find CEGUI libraries
+# and make it run on the Tardis-Infrastucture of the ETH Zurich
+# Copyright 2007, Nicolas Schlumberger
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+#
+# Several changes and additions by Fabian 'x3n' Landau
+# Lots of simplifications by Adrian Friedli and Reto Grieder
+# Version checking and CEGUILua finding by Reto Grieder
+#                 > www.orxonox.net <
+
+INCLUDE(DetermineVersion)
+INCLUDE(FindPackageHandleAdvancedArgs)
+INCLUDE(HandleLibraryTypes)
+
+FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
+  PATHS $ENV{CEGUIDIR}
+  PATH_SUFFIXES include include/CEGUI CEGUI.framework/Headers
+)
+FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED
+  NAMES CEGUIBase CEGUI
+  PATHS $ENV{CEGUIDIR}
+  PATH_SUFFIXES lib bin
+)
+FIND_LIBRARY(CEGUI_LIBRARY_DEBUG
+  NAMES
+    CEGUIBased CEGUIBase_d CEGUIBaseD CEGUIBase_D
+    CEGUId CEGUI_d CEGUID CEGUI_D
+  PATHS $ENV{CEGUIDIR}
+  PATH_SUFFIXES lib bin
+)
+
+# Inspect CEGUIVersion.h for the version number
+DETERMINE_VERSION(CEGUI ${CEGUI_INCLUDE_DIR}/CEGUIVersion.h)
+
+# Handle the REQUIRED argument and set CEGUI_FOUND
+# Also checks the version requirements if given
+FIND_PACKAGE_HANDLE_ADVANCED_ARGS(CEGUI DEFAULT_MSG "${CEGUI_VERSION}"
+  CEGUI_LIBRARY_OPTIMIZED
+  CEGUI_INCLUDE_DIR
+)
+
+# Collect optimized and debug libraries
+HANDLE_LIBRARY_TYPES(CEGUI)
+
+MARK_AS_ADVANCED(
+  CEGUI_INCLUDE_DIR
+  CEGUI_LIBRARY_OPTIMIZED
+  CEGUI_LIBRARY_DEBUG
+)
+
+LIST(FIND CEGUILUA_INTERNAL_SUPPORT "${CEGUI_VERSION}" _find_result)
+IF(CEGUILUA_USE_EXTERNAL_LIBRARY OR _find_result EQUAL -1)
+  # Also try to find the CEGUILua libraries.
+  # There would already be libraries in src/ for versions 0.5 and 0.6
+  FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
+    NAMES CEGUILua
+    PATHS $ENV{CEGUIDIR}
+    PATH_SUFFIXES lib bin
+  )
+  FIND_LIBRARY(CEGUILUA_LIBRARY_DEBUG
+    NAMES CEGUILuad CEGUILua_d
+    PATHS $ENV{CEGUIDIR}
+    PATH_SUFFIXES lib bin
+  )
+
+  SET(CEGUILua_FIND_REQUIRED ${CEGUI_FIND_REQUIRED})
+  # Handle the REQUIRED argument and set CEGUILUA_FOUND
+  FIND_PACKAGE_HANDLE_STANDARD_ARGS(CEGUILua DEFAULT_MSG
+    CEGUILUA_LIBRARY_OPTIMIZED
+  )
+
+  # Collect optimized and debug libraries
+  HANDLE_LIBRARY_TYPES(CEGUILUA)
+
+  MARK_AS_ADVANCED(
+    CEGUILUA_LIBRARY_OPTIMIZED
+    CEGUILUA_LIBRARY_DEBUG
+  )
+
+ELSE(CEGUILUA_USE_EXTERNAL_LIBRARY OR _find_result EQUAL -1)
+  SET(CEGUILUA_USE_INTERNAL_LIBRARY TRUE)
+ENDIF(CEGUILUA_USE_EXTERNAL_LIBRARY OR _find_result EQUAL -1)
+
Index: code/trunk/cmake/tools/FindDirectX.cmake
===================================================================
--- code/trunk/cmake/tools/FindDirectX.cmake	(revision 7163)
+++ code/trunk/cmake/tools/FindDirectX.cmake	(revision 7163)
@@ -0,0 +1,53 @@
+# Find script for DirectX on Windows
+# Specifically designed to find dxguid and dinput8 for OIS
+# Once loaded this will define
+#   DIRECTX_FOUND        - system has DirectX
+#   DIRECTX_INCLUDE_DIR  - include directory for DirectX
+#   DIRECTX_LIBRARIES    - libraries for DirectX
+#
+# Set ENV{DXSD_DIR} if that has not been done the SDK installation.
+#
+# Several changes and additions by Fabian 'x3n' Landau
+# Simplifications and CMake 2.6.0 bugfix by Reto Grieder
+#                 > www.orxonox.net <
+
+INCLUDE(FindPackageHandleStandardArgs)
+INCLUDE(HandleLibraryTypes)
+
+FIND_PATH(DIRECTX_INCLUDE_DIR dinput.h
+  PATHS $ENV{DXSDK_DIR}
+  PATH_SUFFIXES include
+)
+FIND_LIBRARY(DIRECTX_LIBRARY_input dinput8
+  PATHS $ENV{DXSDK_DIR}
+  PATH_SUFFIXES lib Lib lib/x86 Lib/x86
+  NO_DEFAULT_PATH # Or else CMake 2.6.0 will find the dll in system32 on windows
+)
+FIND_LIBRARY(DIRECTX_LIBRARY_input dinput8
+  PATHS $ENV{DXSDK_DIR}
+  PATH_SUFFIXES lib Lib lib/x86 Lib/x86
+)
+FIND_LIBRARY(DIRECTX_LIBRARY_guid dxguid
+  PATHS $ENV{DXSDK_DIR}
+  PATH_SUFFIXES lib Lib lib/x86 Lib/x86
+  NO_DEFAULT_PATH # Or else CMake 2.6.0 will find the dll in system32 on windows
+)
+FIND_LIBRARY(DIRECTX_LIBRARY_guid dxguid
+  PATHS $ENV{DXSDK_DIR}
+  PATH_SUFFIXES lib Lib lib/x86 Lib/x86
+)
+
+# Handle the REQUIRED argument and set DIRECTX_FOUND
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectX DEFAULT_MSG
+  DIRECTX_LIBRARY_input
+  DIRECTX_LIBRARY_guid
+  DIRECTX_INCLUDE_DIR
+)
+
+SET(DIRECTX_LIBRARIES ${DIRECTX_LIBRARY_input} ${DIRECTX_LIBRARY_guid})
+
+MARK_AS_ADVANCED(
+  DIRECTX_INCLUDE_DIR
+  DIRECTX_LIBRARY_input
+  DIRECTX_LIBRARY_guid
+)
Index: code/trunk/cmake/tools/FindENet.cmake
===================================================================
--- code/trunk/cmake/tools/FindENet.cmake	(revision 7163)
+++ code/trunk/cmake/tools/FindENet.cmake	(revision 7163)
@@ -0,0 +1,80 @@
+# - Try to find enet
+# Once done this will define
+#
+#  ENET_FOUND - system has enet
+#  ENet_INCLUDE_DIR - the enet include directory
+#  ENet_LIBRARY - the library needed to link against enet
+#
+# $ENETDIR is an environment variable used for finding enet.
+#
+#  Borrowed from The Mana World
+#  http://themanaworld.org/
+#
+# Several changes and additions by Fabian 'x3n' Landau
+# Lots of simplifications by Adrian Friedli and Reto Grieder
+# Version checking by Reto Grieder
+#                 > www.orxonox.net <
+
+INCLUDE(FindPackageHandleAdvancedArgs)
+INCLUDE(HandleLibraryTypes)
+
+FIND_PATH(ENET_INCLUDE_DIR enet/enet.h
+  PATHS $ENV{ENETDIR}
+  PATH_SUFFIXES include
+)
+FIND_LIBRARY(ENET_LIBRARY_OPTIMIZED
+  NAMES enet
+  PATHS $ENV{ENETDIR}
+  PATH_SUFFIXES lib
+)
+FIND_LIBRARY(ENET_LIBRARY_DEBUG
+  NAMES enetd enet_d enet_D
+  PATHS $ENV{ENETDIR}
+  PATH_SUFFIXES lib
+)
+
+# Only works for 1.2.2 and higher, otherwise see below
+DETERMINE_VERSION(ENET ${ENET_INCLUDE_DIR}/enet/enet.h)
+IF(${ENET_VERSION} STREQUAL "0.0.0")
+  # Try to determine the version. Note that enet only stores the major
+  # version in the header file. So we check for existing functions.
+  # Hence the this script only distinguishes between 1.0, 1.1 and 1.2
+  FILE(STRINGS ${ENET_INCLUDE_DIR}/enet/enet.h _enet_header REGEX "ENET_")
+  IF(_enet_header MATCHES "ENET_VERSION[ \t]*=[ \t]*1")
+    IF(_enet_header MATCHES "enet_socket_set_option")
+      SET(ENET_VERSION 1.2)
+    ELSEIF(_enet_header MATCHES "enet_peer_disconnect_later")
+      SET(ENET_VERSION 1.1)
+    ELSE()
+      SET(ENET_VERSION 1.0)
+    ENDIF()
+  ELSE()
+    SET(ENET_VERSION 0) # Script doesn't support versions below 1.0
+  ENDIF()
+ENDIF()
+
+# Handle the REQUIRED argument and set ENET_FOUND
+# Also check the the version requirements
+FIND_PACKAGE_HANDLE_ADVANCED_ARGS(ENet DEFAULT_MSG ${ENET_VERSION}
+  ENET_LIBRARY_OPTIMIZED
+  ENET_INCLUDE_DIR
+)
+
+COMPARE_VERSION_STRINGS(${ENET_VERSION} 1.2 _comparison TRUE)
+IF(${_comparison} EQUAL 1)
+  MESSAGE(STATUS "Warning: Using ENet version 1.3, which is not protocol compatible with 1.1 and 1.2.")
+ENDIF()
+
+# Collect optimized and debug libraries
+IF(NOT LINK_ENET_DYNAMIC AND WIN32)
+  # ENet is linked statically, hence we need to add some windows dependencies
+  HANDLE_LIBRARY_TYPES(ENET ws2_32 winmm)
+ELSE()
+  HANDLE_LIBRARY_TYPES(ENET)
+ENDIF()
+
+MARK_AS_ADVANCED(
+  ENET_INCLUDE_DIR
+  ENET_LIBRARY_OPTIMIZED
+  ENET_LIBRARY_DEBUG
+)
Index: code/trunk/cmake/tools/FindLua.cmake
===================================================================
--- code/trunk/cmake/tools/FindLua.cmake	(revision 7163)
+++ code/trunk/cmake/tools/FindLua.cmake	(revision 7163)
@@ -0,0 +1,184 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Finds either Lua 5.0 or Lua 5.1 on the system. The script regards the
+ #    VERSION, EXACT, REQUIRED and QUIET arguments. A note about the EXACT
+ #    argument: EXACT 5 will match all Lua 5 versions.
+ #    When the search was successful, the following variables are set:
+ #    LUA_INCLUDE_DIR, LUA_LIBRARIES, LUA_VERSION, LUA_FOUND
+ #
+
+INCLUDE(CompareVersionStrings)
+INCLUDE(FindPackageHandleAdvancedArgs)
+INCLUDE(HandleLibraryTypes)
+
+# Macro that determines Lua version. Should work for versions 2.2 and above (current release: 5.1.4)
+FUNCTION(DETERMINE_LUA_VERSION _file _varname)
+  IF(EXISTS ${_file})
+    FILE(STRINGS ${_file} _file_content REGEX "LUA_VERSION|LUA_RELEASE")
+  ELSE()
+    SET(${_varname} "0" PARENT_SCOPE)
+    RETURN()
+  ENDIF()
+  STRING(REGEX REPLACE "^.*LUA_RELEASE[ \t]+\"Lua[ \t]+([.0-9]+)\".*$" "\\1" ${_varname} "${_file_content}")
+  IF(${_varname} STREQUAL "${_file_content}")
+    # At most version 5.1.0
+    STRING(REGEX REPLACE "^.*LUA_VERSION[ \t]+\"Lua[ \t]+([.0-9]+)\".*$" "\\1" ${_varname} "${_file_content}")
+    IF(${_varname} STREQUAL "${_file_content}")
+      MESSAGE(FATAL_ERROR "Could not determine Lua version which means this script has a bug")
+    ENDIF()
+    IF(${_varname} MATCHES "^[0-9]+\\.[0-9]+$")
+      SET(${_varname} "${${_varname}}.0") # E.g. "3.2" is "3.2.0" actually
+    ENDIF()
+  ENDIF()
+  SET(${_varname} "${${_varname}}" PARENT_SCOPE)
+ENDFUNCTION(DETERMINE_LUA_VERSION)
+
+
+# Find Lua 5.1
+FIND_PATH(LUA_5.1_INCLUDE_DIR lua.h
+  PATHS $ENV{LUA_DIR}
+  PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
+)
+IF(LUA_5.1_INCLUDE_DIR)
+  DETERMINE_LUA_VERSION(${LUA_5.1_INCLUDE_DIR}/lua.h LUA_5.1_VERSION)
+  COMPARE_VERSION_STRINGS("${LUA_5.1_VERSION}" "5.1" _version_compare TRUE)
+  IF(NOT _version_compare EQUAL 0)
+    # Incorrect version found, abort search
+    SET(LUA_5.1_INCLUDE_DIR "LUA_5.1_INCLUDE_DIR-NOTFOUND" CACHE PATH "" FORCE)
+  ELSE()
+    FIND_LIBRARY(LUA_5.1_LIBRARY_OPTIMIZED
+      NAMES lua51 lua5.1 lua
+      PATHS $ENV{LUA_DIR}
+      PATH_SUFFIXES lib64 lib
+    )
+    FIND_LIBRARY(LUA_5.1_LIBRARY_DEBUG
+      NAMES lua51d lua51_d lua5.1d lua5.1_d luad lua_d
+            lua51D lua51_D lua5.1D lua5.1_D luad lua_D
+      PATHS $ENV{LUA_DIR}
+      PATH_SUFFIXES lib64 lib
+    )
+    HANDLE_LIBRARY_TYPES(LUA_5.1)
+    SET(LUA_5.1_LIBRARIES ${LUA_5.1_LIBRARY})
+    IF(LUA_5.1_LIBRARIES)
+      SET(LUA_5.1_FOUND TRUE)
+    ENDIF()
+  ENDIF(NOT _version_compare EQUAL 0)
+ENDIF(LUA_5.1_INCLUDE_DIR)
+
+
+# Find Lua 5.0
+FIND_PATH(LUA_5.0_INCLUDE_DIR lua.h
+  PATHS $ENV{LUA_DIR}
+  PATH_SUFFIXES include/lua50 include/lua5.0 include/lua5 include/lua include
+)
+IF(LUA_5.0_INCLUDE_DIR)
+  DETERMINE_LUA_VERSION(${LUA_5.0_INCLUDE_DIR}/lua.h LUA_5.0_VERSION)
+  COMPARE_VERSION_STRINGS("${LUA_5.0_VERSION}" "5.0" _version_compare TRUE)
+  IF(NOT _version_compare EQUAL 0)
+    # Incorrect version found, abourt search
+    SET(LUA_5.0_INCLUDE_DIR "LUA_5.0_INCLUDE_DIR-NOTFOUND" CACHE PATH "" FORCE)
+  ELSE()
+    FIND_LIBRARY(LUA_5.0_LUA_LIBRARY_OPTIMIZED
+      NAMES lua50 lua5.0 lua5 lua
+      PATHS $ENV{LUA_DIR}
+      PATH_SUFFIXES lib64 lib
+    )
+    FIND_LIBRARY(LUA_5.0_LUA_LIBRARY_DEBUG
+      NAMES lua50d lua50_d lua5.0d lua5.0_d lua5d lua5_d luad lua_d
+            lua50D lua50_D lua5.0D lua5.0_D lua5d lua5_D luaD lua_D
+      PATHS $ENV{LUA_DIR}
+      PATH_SUFFIXES lib64 lib
+    )
+    HANDLE_LIBRARY_TYPES(LUA_5.0_LUA)
+
+    # In an OS X framework, lualib is usually included as part of the framework
+    # (like GLU in OpenGL.framework)
+    IF(${LUA_5.0_LUA_LIBRARY} MATCHES "framework")
+      SET(LUA_5.0_LIBRARIES ${LUA_5.0_LUA_LIBRARY})
+    ELSE()
+      FIND_LIBRARY(LUA_5.0_LUALIB_LIBRARY_OPTIMIZED
+        NAMES lualib50 lualib5.0 lualib5 lualib
+        PATHS $ENV{LUALIB_DIR} $ENV{LUA_DIR}
+        PATH_SUFFIXES lib64 lib
+      )
+      FIND_LIBRARY(LUA_5.0_LUALIB_LIBRARY_DEBUG
+        NAMES lualib50d lualib50_d lualib5.0d lualib5.0_d
+              lualib5d lualib5_d lualibd lualib_d
+              lualib50D lualib50_D lualib5.0D lualib5.0_D
+              lualib5D lualib5_D lualibD lualib_D
+        PATHS $ENV{LUALIB_DIR} $ENV{LUA_DIR}
+        PATH_SUFFIXES lib64 lib
+      )
+      HANDLE_LIBRARY_TYPES(LUA_5.0_LUALIB)
+      # Both libraries are required for Lua 5.0 to be found
+      IF(LUA_5.0_LUA_LIBRARY AND LUA_5.0_LUALIB_LIBRARY)
+        SET(LUA_5.0_LIBRARIES ${LUA_5.0_LUA_LIBRARY} ${LUA_5.0_LUALIB_LIBRARY})
+      ENDIF()
+    ENDIF(${LUA_5.0_LUA_LIBRARY} MATCHES "framework")
+
+    IF(LUA_5.0_LIBRARIES)
+      SET(LUA_5.0_FOUND TRUE)
+    ENDIF()
+  ENDIF(NOT _version_compare EQUAL 0)
+ENDIF(LUA_5.0_INCLUDE_DIR)
+
+# Pick the right version
+IF(Lua_FIND_VERSION_EXACT AND NOT Lua_FIND_VERSION MATCHES "^[0-9]*$")
+  STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+)(\\..*)?$" "\\1" LUA_VERSION_SELECTION ${Lua_FIND_VERSION})
+ELSE()
+  IF(LUA_5.1_FOUND) # Prefer version 5.1 if found
+    SET(LUA_VERSION_SELECTION "5.1")
+  ELSEIF(LUA_5.0_FOUND)
+    SET(LUA_VERSION_SELECTION "5.0")
+  ENDIF()
+ENDIF()
+
+SET(LUA_INCLUDE_DIR "${LUA_${LUA_VERSION_SELECTION}_INCLUDE_DIR}")
+SET(LUA_LIBRARIES "${LUA_${LUA_VERSION_SELECTION}_LIBRARIES}")
+SET(LUA_VERSION_LONG "${LUA_${LUA_VERSION_SELECTION}_VERSION}")
+SET(LUA_VERSION "${LUA_VERSION_SELECTION}")
+
+FIND_PACKAGE_HANDLE_ADVANCED_ARGS(Lua DEFAULT_MSG "${LUA_VERSION_LONG}"
+  LUA_LIBRARIES
+  LUA_INCLUDE_DIR
+)
+
+# Include the math library for Unix only
+IF(LUA_FOUND)
+  IF(UNIX AND NOT APPLE)
+    FIND_LIBRARY(UNIX_MATH_LIBRARY m)
+    SET(LUA_LIBRARIES ${LUA_LIBRARIES} ${UNIX_MATH_LIBRARY})
+  ENDIF()
+ENDIF(LUA_FOUND)
+
+MARK_AS_ADVANCED(
+  LUA_5.0_INCLUDE_DIR
+  LUA_5.0_LUA_LIBRARY_OPTIMIZED
+  LUA_5.0_LUA_LIBRARY_DEBUG
+  LUA_5.0_LUALIB_LIBRARY_OPTIMIZED
+  LUA_5.0_LUALIB_LIBRARY_DEBUG
+  LUA_5.1_INCLUDE_DIR
+  LUA_5.1_LIBRARY_OPTIMIZED
+  LUA_5.1_LIBRARY_DEBUG
+  UNIX_MATH_LIBRARY
+)
Index: code/trunk/cmake/tools/FindOGRE.cmake
===================================================================
--- code/trunk/cmake/tools/FindOGRE.cmake	(revision 7163)
+++ code/trunk/cmake/tools/FindOGRE.cmake	(revision 7163)
@@ -0,0 +1,55 @@
+# Find OGRE includes and library
+#
+# This module defines
+#  OGRE_INCLUDE_DIR
+#  OGRE_LIBRARY, the library to link against to use OGRE.
+#  OGRE_FOUND, If false, do not try to use OGRE
+#
+# Copyright © 2007, Matt Williams
+# Modified by Nicolas Schlumberger to make it work on the Tardis-Infrastucture
+# of the ETH Zurich (removed later on)
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+#
+# Several changes and additions by Fabian 'x3n' Landau
+# Lots of simplifications by Adrian Friedli
+# Version checking by Reto Grieder
+#                 > www.orxonox.net <
+
+INCLUDE(DetermineVersion)
+INCLUDE(FindPackageHandleAdvancedArgs)
+INCLUDE(HandleLibraryTypes)
+
+FIND_PATH(OGRE_INCLUDE_DIR Ogre.h
+  PATHS $ENV{OGRE_HOME}
+  PATH_SUFFIXES include include/OGRE Ogre.framework/Headers
+)
+FIND_LIBRARY(OGRE_LIBRARY_OPTIMIZED
+  NAMES OgreMain Ogre
+  PATHS $ENV{OGRE_HOME}
+  PATH_SUFFIXES lib bin/Release bin/release Release release
+)
+FIND_LIBRARY(OGRE_LIBRARY_DEBUG
+  NAMES OgreMaind OgreMain_d OgreMainD OgreMain_D Ogred Ogre_d OgreD Ogre_d
+  PATHS $ENV{OGRE_HOME}
+  PATH_SUFFIXES lib bin/Debug bin/debug Debug debug Versions/A
+)
+
+# Inspect OgrePrerquisites.h for the version number
+DETERMINE_VERSION(OGRE ${OGRE_INCLUDE_DIR}/OgrePrerequisites.h)
+
+# Handle the REQUIRED argument and set OGRE_FOUND
+# Also check the version requirements
+FIND_PACKAGE_HANDLE_ADVANCED_ARGS(OGRE DEFAULT_MSG ${OGRE_VERSION}
+  OGRE_LIBRARY_OPTIMIZED
+  OGRE_INCLUDE_DIR
+)
+
+# Collect optimized and debug libraries
+HANDLE_LIBRARY_TYPES(OGRE)
+
+MARK_AS_ADVANCED(
+  OGRE_INCLUDE_DIR
+  OGRE_LIBRARY_OPTIMIZED
+  OGRE_LIBRARY_DEBUG
+)
Index: code/trunk/cmake/tools/FindOgg.cmake
===================================================================
--- code/trunk/cmake/tools/FindOgg.cmake	(revision 7163)
+++ code/trunk/cmake/tools/FindOgg.cmake	(revision 7163)
@@ -0,0 +1,47 @@
+# - Try to find ogg
+# Once done this will define
+#
+#  OGG_FOUND - system has ogg
+#  OGG_INCLUDE_DIR
+#  OGG_LIBRARY
+#
+# $OGGDIR is an environment variable used
+# for finding ogg.
+#
+# Several changes and additions by Fabian 'x3n' Landau
+# Most of all rewritten by Adrian Friedli
+# Debug versions and simplifications by Reto Grieder
+#                 > www.orxonox.net <
+
+INCLUDE(FindPackageHandleStandardArgs)
+INCLUDE(HandleLibraryTypes)
+
+FIND_PATH(OGG_INCLUDE_DIR ogg/ogg.h
+  PATHS $ENV{OGGDIR}
+  PATH_SUFFIXES include
+)
+FIND_LIBRARY(OGG_LIBRARY_OPTIMIZED
+  NAMES ogg
+  PATHS $ENV{OGGDIR}
+  PATH_SUFFIXES lib
+)
+FIND_LIBRARY(OGG_LIBRARY_DEBUG
+  NAMES oggd ogg_d oggD ogg_D
+  PATHS $ENV{OGGDIR}
+  PATH_SUFFIXES lib
+)
+
+# Handle the REQUIRED argument and set OGG_FOUND
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ogg DEFAULT_MSG
+  OGG_LIBRARY_OPTIMIZED
+  OGG_INCLUDE_DIR
+)
+
+# Collect optimized and debug libraries
+HANDLE_LIBRARY_TYPES(OGG)
+
+MARK_AS_ADVANCED(
+  OGG_INCLUDE_DIR
+  OGG_LIBRARY_OPTIMIZED
+  OGG_LIBRARY_DEBUG
+)
Index: code/trunk/cmake/tools/FindPackageHandleAdvancedArgs.cmake
===================================================================
--- code/trunk/cmake/tools/FindPackageHandleAdvancedArgs.cmake	(revision 7163)
+++ code/trunk/cmake/tools/FindPackageHandleAdvancedArgs.cmake	(revision 7163)
@@ -0,0 +1,66 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Extension of the standard module "FindPackageHandleStandardArgs".
+ #    This function also checks the version requirements. Also regards the
+ #    EXACT keyword if specified in FIND_PACKAGE(...).
+ #
+
+INCLUDE(FindPackageHandleStandardArgs)
+INCLUDE(CompareVersionStrings)
+
+FUNCTION(FIND_PACKAGE_HANDLE_ADVANCED_ARGS _name _fail_msg _version)
+
+  # Modify the message to include version requirements
+  IF("${_fail_msg}" STREQUAL "DEFAULT_MSG")
+    SET(_fail_msg_adv "Could NOT find ${_name}")
+  ELSE()
+    SET(_fail_msg_adv "${_fail_msg}")
+  ENDIF()
+  IF(${_name}_FIND_VERSION_EXACT)
+    SET(_fail_msg_adv "${_fail_msg_adv} (version requirements: exactly ${${_name}_FIND_VERSION})")
+  ELSE()
+    SET(_fail_msg_adv "${_fail_msg_adv} (version requirements: at least ${${_name}_FIND_VERSION})")
+  ENDIF()
+  FIND_PACKAGE_HANDLE_STANDARD_ARGS("${_name}" "${_fail_msg_adv}" ${ARGN})
+  STRING(TOUPPER ${_name} _NAME_UPPER)
+
+  # Also check version requirements if given to FindPackage(...)
+  IF(${_name}_FIND_VERSION)
+    # Note: the last argument of the function tells it to cut the first
+    #       version string instead of padding it with zeros if necessary
+    COMPARE_VERSION_STRINGS("${_version}" "${${_name}_FIND_VERSION}" _compatible TRUE)
+    IF(${_name}_FIND_VERSION_EXACT AND NOT _compatible EQUAL 0)
+      MESSAGE(FATAL_ERROR "Exact ${_name} version required is ${${_name}_FIND_VERSION}\n"
+                          "Your version is ${_version}")
+      SET(${_NAME_UPPER}_FOUND FALSE)
+    ELSEIF(_compatible LESS 0)
+      MESSAGE(FATAL_ERROR "Minimum ${_name} version required is ${${_name}_FIND_VERSION}\n"
+                          "Your version is ${_version}")
+      SET(${_NAME_UPPER}_FOUND FALSE)
+    ENDIF()
+  ENDIF(${_name}_FIND_VERSION)
+
+  # Raise scope (FindPackageHandleStandardArgs uses PARENT_SCOPE)
+  SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE)
+
+ENDFUNCTION(FIND_PACKAGE_HANDLE_ADVANCED_ARGS)
Index: code/trunk/cmake/tools/FindVorbis.cmake
===================================================================
--- code/trunk/cmake/tools/FindVorbis.cmake	(revision 7163)
+++ code/trunk/cmake/tools/FindVorbis.cmake	(revision 7163)
@@ -0,0 +1,62 @@
+# - Try to find ogg/vorbis
+# Once done this will define
+#
+#  VORBIS_FOUND - system has vorbis
+#  VORBIS_INCLUDE_DIR
+#  VORBIS_LIBRARIES - vorbis and vorbisfile libraries
+#
+# $VORBISDIR is an environment variable used
+# for finding vorbis.
+#
+# Several changes and additions by Fabian 'x3n' Landau
+# Most of all rewritten by Adrian Friedli
+# Debug versions and simplifications by Reto Grieder
+#                 > www.orxonox.net <
+
+INCLUDE(FindPackageHandleStandardArgs)
+INCLUDE(HandleLibraryTypes)
+
+FIND_PATH(VORBIS_INCLUDE_DIR vorbis/codec.h
+  PATHS $ENV{VORBISDIR}
+  PATH_SUFFIXES include
+)
+FIND_LIBRARY(VORBIS_LIBRARY_OPTIMIZED
+  NAMES vorbis
+  PATHS $ENV{VORBISDIR}
+  PATH_SUFFIXES lib
+)
+FIND_LIBRARY(VORBIS_LIBRARY_DEBUG
+  NAMES vorbisd vorbis_d vorbisD vorbis_D
+  PATHS $ENV{VORBISDIR}
+  PATH_SUFFIXES lib
+)
+FIND_LIBRARY(VORBISFILE_LIBRARY_OPTIMIZED
+  NAMES vorbisfile
+  PATHS $ENV{VORBISDIR}
+  PATH_SUFFIXES lib
+)
+FIND_LIBRARY(VORBISFILE_LIBRARY_DEBUG
+  NAMES vorbisfiled vorbisfile_d vorbisfileD vorbisfile_D
+  PATHS $ENV{VORBISDIR}
+  PATH_SUFFIXES lib
+)
+
+# Handle the REQUIRED argument and set VORBIS_FOUND
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Vorbis DEFAULT_MSG
+  VORBIS_LIBRARY_OPTIMIZED
+  VORBISFILE_LIBRARY_OPTIMIZED
+  VORBIS_INCLUDE_DIR
+)
+
+# Collect optimized and debug libraries
+HANDLE_LIBRARY_TYPES(VORBIS)
+HANDLE_LIBRARY_TYPES(VORBISFILE)
+SET(VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
+
+MARK_AS_ADVANCED(
+  VORBIS_INCLUDE_DIR
+  VORBIS_LIBRARY_OPTIMIZED
+  VORBIS_LIBRARY_DEBUG
+  VORBISFILE_LIBRARY_OPTIMIZED
+  VORBISFILE_LIBRARY_DEBUG
+)
Index: code/trunk/cmake/tools/FlagUtilities.cmake
===================================================================
--- code/trunk/cmake/tools/FlagUtilities.cmake	(revision 7163)
+++ code/trunk/cmake/tools/FlagUtilities.cmake	(revision 7163)
@@ -0,0 +1,177 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Sets the compiler/linker flags. After the flags you can specify more args:
+ #    Release, Debug, RelWithDebInfo, MinSizeRel: Build configs (inclusive)
+ #    ReleaseAll: Sets the flags of all three release builds
+ #    CACHE: Values are witten with SET_CACHE_ADVANCED
+ #    FORCE: When writing to the cache, the values are set anyway
+ #    Any variable names (like WIN32, MSVC, etc.): Condition (combined with AND)
+ #    You can suffix the condition with a NOT if you wish
+ #  Function names:
+ #    [ADD/SET/REMOVE]_[COMPILER/LINKER]_FLAGS
+ #  Caution: -If you use CACHE after calling the macro without CACHE, the value
+ #            Will not be written unless FORCE is specified.
+ #          - Also be aware to always specify the flags in quotes.
+ #  Example:
+ #    REMOVE_COMPILER_FLAGS("/Gm "asdf" -q"test -foo" CXX ReleaseAll NOT UNIX)
+ #    This will only remove the CXX (C++) flags on a non Unix system for the
+ #    Release, RelWithDebInfo and MinSizeRel configurations. The macros should
+ #    be able to cope with "test -foo" as string argument for a flag.
+ #
+
+INCLUDE(SeparateFlags)
+INCLUDE(SetCacheAdvanced)
+
+# Compiler flags, additional arguments:
+# C, CXX: Specify a language, default is both
+MACRO(SET_COMPILER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(SET "C;CXX" "" "${_flags}" "${ARGN}")
+ENDMACRO(SET_COMPILER_FLAGS)
+# Add flags (flags don't get added twice)
+MACRO(ADD_COMPILER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(APPEND "C;CXX" "" "${_flags}" "${ARGN}")
+ENDMACRO(ADD_COMPILER_FLAGS)
+# Remove flags
+MACRO(REMOVE_COMPILER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(REMOVE_ITEM "C;CXX" "" "${_flags}" "${ARGN}")
+ENDMACRO(REMOVE_COMPILER_FLAGS)
+
+
+# Linker flags, additional arguments:
+# EXE, SHARED, MODULE: Specify a linker mode, default is all three
+MACRO(SET_LINKER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(SET "EXE;SHARED;MODULE" "_LINKER" "${_flags}" "${ARGN}")
+ENDMACRO(SET_LINKER_FLAGS)
+# Add flags (flags don't get added twice)
+MACRO(ADD_LINKER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(APPEND "EXE;SHARED;MODULE" "_LINKER" "${_flags}" "${ARGN}")
+ENDMACRO(ADD_LINKER_FLAGS)
+# Remove flags
+MACRO(REMOVE_LINKER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(REMOVE_ITEM "EXE;SHARED;MODULE" "_LINKER" "${_flags}" "${ARGN}")
+ENDMACRO(REMOVE_LINKER_FLAGS)
+
+
+# Internal macro, do not use
+# Parses the given additional arguments and sets the flags to the
+# corresponding variables.
+MACRO(_INTERNAL_PARSE_FLAGS_ARGS _mode _keys _key_postfix _flags)
+  SET(_langs)
+  SET(_build_types)
+  SET(_cond TRUE)
+  SET(_invert_condition FALSE)
+  SET(_write_to_cache FALSE)
+  SET(_force FALSE)
+  STRING(REPLACE ";" "|" _key_regex "${_keys}")
+  SET(_key_regex "^(${_key_regex})$")
+
+  FOREACH(_arg ${ARGN})
+    IF(_arg MATCHES "${_key_regex}")
+      LIST(APPEND _langs "${_arg}")
+    ELSEIF(   _arg MATCHES "^(Debug|Release|MinSizeRel|RelWithDebInfo)$"
+           OR _arg MATCHES "^(DEBUG|RELEASE|MINSIZEREL|RELWITHDEBINFO)$")
+      STRING(TOUPPER "${_arg}" _upper_arg)
+      LIST(APPEND _build_types ${_upper_arg})
+    ELSEIF(_arg STREQUAL "ReleaseAll")
+      LIST(APPEND _build_types RELEASE MINSIZEREL RELWITHDEBINFO)
+    ELSEIF(_arg STREQUAL "CACHE")
+      SET(_write_to_cache TRUE)
+    ELSEIF(_arg STREQUAL "FORCE")
+      SET(_force TRUE)
+    ELSEIF(_arg MATCHES "^[Nn][Oo][Tt]$")
+      SET(_invert_condition TRUE)
+    ELSE()
+      IF(_invert_condition)
+        SET(_invert_condition FALSE)
+        IF(${_arg})
+          SET(_arg_cond FALSE)
+        ELSE()
+          SET(_arg_cond TRUE)
+       ENDIF()
+      ELSE()
+        SET(_arg_cond ${${_arg}})
+      ENDIF()
+      IF(_cond AND _arg_cond)
+        SET(_cond TRUE)
+      ELSE()
+        SET(_cond FALSE)
+      ENDIF()
+    ENDIF()
+  ENDFOREACH(_arg)
+
+  # No language specified, use all: C and CXX or EXE, SHARED and MODULE
+  IF(NOT DEFINED _langs)
+    SET(_langs ${_keys})
+  ENDIF()
+
+  IF(_cond)
+    FOREACH(_lang ${_langs})
+      SET(_varname "CMAKE_${_lang}${_key_postfix}_FLAGS")
+      IF(DEFINED _build_types)
+        FOREACH(_build_type ${_build_types})
+          _INTERNAL_PARSE_FLAGS(${_mode} "${_flags}" ${_varname}_${_build_type} ${_write_to_cache} ${_force})
+        ENDFOREACH(_build_type)
+      ELSE()
+        _INTERNAL_PARSE_FLAGS(${_mode} "${_flags}" ${_varname} ${_write_to_cache} ${_force})
+      ENDIF()
+    ENDFOREACH(_lang ${_langs})
+  ENDIF(_cond)
+ENDMACRO(_INTERNAL_PARSE_FLAGS_ARGS)
+
+
+# Internal macro, do not use
+# Modifies the flags according to the mode: set, add or remove
+# Also sets flags according to the CACHE and FORCE parameter.
+# If only CACHE is specified, SET_CACHE_ADVANCED() is used.
+MACRO(_INTERNAL_PARSE_FLAGS _mode _flags _varname _write_to_cache _force)
+  SEPARATE_FLAGS("${_flags}" _arg_flag_list)
+
+  IF("${_mode}" STREQUAL "SET")
+    # SET
+    SET(_flag_list "${_arg_flag_list}")
+  ELSE()
+    # ADD or REMOVE
+    SEPARATE_FLAGS("${${_varname}}" _flag_list)
+    IF(NOT _flag_list)
+      SET(_flag_list "") # LIST command requires a list in any case
+    ENDIF()
+    FOREACH(_flag ${_arg_flag_list})
+      LIST(${_mode} _flag_list "${_flag}")
+    ENDFOREACH(_flag)
+  ENDIF()
+
+  LIST(REMOVE_DUPLICATES _flag_list)
+  LIST(SORT _flag_list)
+  STRING(REPLACE ";" " " _flag_list "${_flag_list}")
+
+  IF(_write_to_cache)
+    IF(_force)
+      SET(${_varname} "${_flag_list}" CACHE STRING "${${_varname}}" FORCE)
+      SET(${_varname} "${_flag_list}" CACHE STRING "${${_varname}}" FORCE)
+    ELSE()
+      SET_CACHE_ADVANCED(${_varname} STRING "${${_varname}}" "${_flag_list}")
+    ENDIF()
+  ELSE()
+    SET(${_varname} "${_flag_list}")
+  ENDIF()
+ENDMACRO(_INTERNAL_PARSE_FLAGS)
Index: code/trunk/cmake/tools/GenerateToluaBindings.cmake
===================================================================
--- code/trunk/cmake/tools/GenerateToluaBindings.cmake	(revision 7163)
+++ code/trunk/cmake/tools/GenerateToluaBindings.cmake	(revision 7163)
@@ -0,0 +1,79 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Adrian Friedli
+ #  Description:
+ #    Sets the CMake options that will generate Tolua++ bindings.
+ #  Parameters:
+ #    _tolua_package - Name of the package, e.g. "Core"
+ #    _target_source_files - Variable name of the target source files, the
+ #                           script will add the generated files to this list.
+ #    ARGN - The header files in the style "INTPUTFILES Foo.h Bar.h"
+ #  Global Variables: (need to be set before)
+ #    TOLUA_PARSER_SOURCE - Lua file with the parser source code
+ #    TOLUA_PARSER_DEPENDENCIES - All the dependent lua files
+ #    RUNTIME_LIBRARY_DIRECTORY - Working directory
+ #
+
+FUNCTION(GENERATE_TOLUA_BINDINGS _tolua_package _target_source_files)
+  SET(_tolua_inputfiles ${ARGN})
+  LIST(REMOVE_ITEM _tolua_inputfiles "INPUTFILES")
+
+  SET(_tolua_pkgfile "${CMAKE_CURRENT_BINARY_DIR}/tolua.pkg")
+  SET(_tolua_cxxfile "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.cc")
+  SET(_tolua_hfile   "${CMAKE_BINARY_DIR}/src/toluabind/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.h")
+
+  SET(${_target_source_files}
+    ${${_target_source_files}}
+    ${_tolua_cxxfile}
+    ${_tolua_hfile}
+    PARENT_SCOPE
+  )
+  SOURCE_GROUP("Tolua" FILES ${_tolua_cxxfile} ${_tolua_hfile})
+  # Disable annoying GCC warnings
+  IF(CMAKE_COMPILER_IS_GNU)
+    SET_SOURCE_FILES_PROPERTIES(${_tolua_cxxfile} PROPERTIES COMPILE_FLAGS "-w")
+  ENDIF()
+  # Tolua binding speedup if required
+  IF(ORXONOX_RELEASE)
+    SET_SOURCE_FILES_PROPERTIES(${_tolua_cxxfile} PROPERTIES COMPILE_FLAGS "-DTOLUA_RELEASE")
+  ENDIF()
+
+  # Create temporary package file and implicit dependencies
+  FILE(REMOVE ${_tolua_pkgfile})
+  FOREACH(_tolua_inputfile ${_tolua_inputfiles})
+    FILE(APPEND ${_tolua_pkgfile} "\$cfile \"${_tolua_inputfile}\"\n")
+    LIST(APPEND _implicit_dependencies CXX ${_tolua_inputfile})
+  ENDFOREACH(_tolua_inputfile)
+
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${_tolua_cxxfile} ${_tolua_hfile}
+    COMMAND toluaapp_orxonox -n ${_tolua_package}
+                             -w ${CMAKE_CURRENT_SOURCE_DIR}
+                             -o ${_tolua_cxxfile}
+                             -H ${_tolua_hfile}
+                             -s ${TOLUA_PARSER_SOURCE}
+                                ${_tolua_pkgfile}
+    DEPENDS           ${TOLUA_PARSER_DEPENDENCIES}
+    IMPLICIT_DEPENDS  ${_implicit_dependencies}
+    WORKING_DIRECTORY ${RUNTIME_LIBRARY_DIRECTORY}
+    COMMENT "Generating tolua bind files for package ${_tolua_package}"
+  )
+ENDFUNCTION(GENERATE_TOLUA_BINDINGS)
Index: code/trunk/cmake/tools/GetGCCCompilerFlags.cmake
===================================================================
--- code/trunk/cmake/tools/GetGCCCompilerFlags.cmake	(revision 7163)
+++ code/trunk/cmake/tools/GetGCCCompilerFlags.cmake	(revision 7163)
@@ -0,0 +1,73 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Tries to return all GCC compiler flags set for a target. This also
+ #    all definitions of the current directory.
+ #
+
+INCLUDE(SeparateFlags)
+
+FUNCTION(GET_GCC_COMPILER_FLAGS _target _flagsvar)
+
+  # General flags
+  STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type_upper)
+  SET(_flag_str "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${_build_type_upper}}")
+
+  # Include directories
+  GET_DIRECTORY_PROPERTY(_include_dirs INCLUDE_DIRECTORIES)
+  IF(_include_dirs)
+    FOREACH(_directory ${_include_dirs})
+      SET(_flag_str "${_flag_str} -I${_directory}")
+    ENDFOREACH(_directory)
+  ENDIF()
+
+  # For shared libraries linked with gcc, we have to add -fPIC
+  GET_TARGET_PROPERTY(_target_type ${_target} TYPE)
+  IF(NOT MINGW AND ${_target_type} STREQUAL SHARED_LIBRARY)
+    SET(_flag_str "${_flag_str} -fPIC")
+  ENDIF()
+
+  # Target compile flags
+  GET_TARGET_PROPERTY(_target_flags ${_target} COMPILE_FLAGS)
+  IF(_target_flags)
+    SET(_flag_str "${_flag_str} ${_target_flags}")
+  ENDIF()
+
+  # Definitions from target and directory
+  GET_DIRECTORY_PROPERTY(_directory_defs                 COMPILE_DEFINITIONS)
+  GET_DIRECTORY_PROPERTY(_directory_defs_build_type      COMPILE_DEFINITIONS_${_build_type_upper})
+  GET_TARGET_PROPERTY(_target_defs            ${_target} COMPILE_DEFINITIONS)
+  GET_TARGET_PROPERTY(_target_defs_build_type ${_target} COMPILE_DEFINITIONS_${_build_type_upper})
+  GET_TARGET_PROPERTY(_target_def_symbol      ${_target} DEFINE_SYMBOL)
+  # Prefix them all with a "-D" if the property was found
+  FOREACH(_def ${_directory_defs} ${_directory_defs_build_type} ${_target_defs}
+               ${_target_defs_build_type} ${_target_def_symbol})
+    IF(_def)
+      SET(_flag_str "${_flag_str} -D${_def}")
+    ENDIF(_def)
+  ENDFOREACH(_def)
+
+  SEPARATE_FLAGS("${_flag_str}" _flags)
+  LIST(REMOVE_DUPLICATES _flags)
+  SET(${_flagsvar} ${_flags} PARENT_SCOPE)
+
+ENDFUNCTION(GET_GCC_COMPILER_FLAGS)
Index: code/trunk/cmake/tools/HandleLibraryTypes.cmake
===================================================================
--- code/trunk/cmake/tools/HandleLibraryTypes.cmake	(revision 7163)
+++ code/trunk/cmake/tools/HandleLibraryTypes.cmake	(revision 7163)
@@ -0,0 +1,42 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Checks debug and optimized libaries and sets the variable ${_name}_LIBRARY
+ #    accordingly. If only an optimized library was found, the "optimized"
+ #    keyword is omitted to support the debug version too.
+ #
+
+FUNCTION(HANDLE_LIBRARY_TYPES _name)
+  # Additional libraries can be added as additional arguments
+  IF(${_name}_LIBRARY_DEBUG AND ${_name}_LIBRARY_OPTIMIZED)
+    SET(${_name}_LIBRARY
+      optimized ${${_name}_LIBRARY_OPTIMIZED} ${ARGN}
+      debug     ${${_name}_LIBRARY_DEBUG}     ${ARGN}
+      PARENT_SCOPE
+    )
+  ELSE()
+    SET(${_name}_LIBRARY
+      ${${_name}_LIBRARY_OPTIMIZED} ${ARGN}
+      PARENT_SCOPE
+     )
+  ENDIF()
+ENDFUNCTION(HANDLE_LIBRARY_TYPES)
Index: code/trunk/cmake/tools/ParseMacroArguments.cmake
===================================================================
--- code/trunk/cmake/tools/ParseMacroArguments.cmake	(revision 7163)
+++ code/trunk/cmake/tools/ParseMacroArguments.cmake	(revision 7163)
@@ -0,0 +1,91 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Parses a list of macro arguments which are separated by keywords and
+ #    writes the result to the _arg_KEYWORD variable. Switches are set to their
+ #    literal name if found and the lists contain their elements.
+ #    The order of the arguments is arbitrary.
+ #  Note:
+ #    You have to specify the switches and list_names as a
+ #    semicolon separated list or all hell breaks loose!
+ #  Example:
+ #    The arguments  BLUBB_FILES foo.cc bar.c NO_ASDF  will do the following:
+ #    SET(_arg_NO_ASDF _arg_NO_ASDF)
+ #    SET(_arg_BLUBB_FILES foo.cc bar.c)
+ #    But NO_FOO will not be set at all if it was specified as a switch
+ #
+
+MACRO(PARSE_MACRO_ARGUMENTS _switches _list_names)
+
+  # Using LIST(FIND ...) speeds up the process
+  SET(_keywords ${_switches} ${_list_names})
+
+  # Reset all arguments
+  FOREACH(_arg ${_switches} ${_list_names})
+    SET(_arg_${_arg})
+  ENDFOREACH(_arg)
+
+  # Parse all the arguments and set the corresponding variable
+  # If the option is just a switch, set the variable to its name for later use
+  FOREACH(_arg ${ARGN})
+
+    # Is the argument a keyword?
+    LIST(FIND _keywords ${_arg} _keyword_index)
+    IF(NOT _keyword_index EQUAL -1)
+
+      # Another optimisation
+      SET(_arg_found FALSE)
+      # Switches
+      FOREACH(_switch ${_switches})
+        IF(${_switch} STREQUAL ${_arg})
+          SET(_arg_${_switch} ${_switch})
+          SET(_arg_found TRUE)
+          # Avoid interpreting arguments after this one as options args for the previous one
+          SET(_storage_var)
+          BREAK()
+        ENDIF()
+      ENDFOREACH(_switch)
+
+      # Input options
+      IF(NOT _arg_found)
+        FOREACH(_list_name ${_list_names})
+          IF(${_list_name} STREQUAL ${_arg})
+            SET(_storage_var _arg_${_list_name})
+            BREAK()
+          ENDIF()
+        ENDFOREACH(_list_name)
+      ENDIF(NOT _arg_found)
+
+    ELSE()
+
+      # Arguments of an input option (like source files for SOURCE_FILES)
+      IF(_storage_var)
+        # Store in variable define above in the foreach loop
+        SET(${_storage_var} ${${_storage_var}} ${_arg})
+      ELSE()
+        MESSAGE(FATAL_ERROR "ORXONOX_ADD_${_target_type} was given a non compliant argument: ${_arg}")
+      ENDIF(_storage_var)
+
+    ENDIF()
+
+  ENDFOREACH(_arg)
+ENDMACRO(PARSE_MACRO_ARGUMENTS)
Index: code/trunk/cmake/tools/PrecompiledHeaderFiles.cmake
===================================================================
--- code/trunk/cmake/tools/PrecompiledHeaderFiles.cmake	(revision 7163)
+++ code/trunk/cmake/tools/PrecompiledHeaderFiles.cmake	(revision 7163)
@@ -0,0 +1,161 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #
+
+INCLUDE(GetGCCCompilerFlags)
+
+MACRO(PRECOMPILED_HEADER_FILES_PRE_TARGET _target_name _header_file_arg _sourcefile_var)
+
+  GET_FILENAME_COMPONENT(_pch_header_file ${_header_file_arg} ABSOLUTE)
+  GET_FILENAME_COMPONENT(_pch_header_filename ${_pch_header_file} NAME)
+  GET_FILENAME_COMPONENT(_pch_header_filename_we ${_pch_header_file} NAME_WE)
+
+  IF(NOT EXISTS ${_pch_header_file})
+    MESSAGE(FATAL_ERROR "Specified precompiled headerfile '${_header_file_arg}' does not exist.")
+  ENDIF()
+
+  # Extract arguments from ARGN
+  FOREACH(_arg ${ARGN})
+    IF(NOT "${_arg}" STREQUAL "EXCLUDE")
+      IF(NOT _arg_second)
+        # Source files with PCH support
+        SET(_included_files ${_included_files} ${_arg})
+      ELSE()
+        # Source files to be excluded from PCH support (easier syntax this way)
+        SET(_excluded files ${_excluded_files} ${_arg})
+      ENDIF()
+    ELSE()
+      SET(_arg_second TRUE)
+    ENDIF()
+  ENDFOREACH(_arg)
+
+  # Use ${_sourcefile_var} if no files were specified explicitely
+  IF(NOT _included_files)
+    SET(_source_files ${${_sourcefile_var}})
+  ELSE()
+    SET(_source_files ${_included_files})
+  ENDIF()
+
+  # Exclude files (if specified)
+  FOREACH(_file ${_excluded_files})
+    LIST(FIND _source_files ${_file} _list_index)
+    IF(_list_index GREATER -1)
+      LIST(REMOVE_AT _source_files _list_index)
+    ELSE()
+      MESSAGE(FATAL_ERROR "Could not exclude file ${_file} in target ${_target_name}")
+    ENDIF()
+  ENDFOREACH(_file)
+
+  LIST(FIND ${_sourcefile_var} ${_pch_header_file} _list_index)
+  IF(_list_index EQUAL -1) # Header file could already be included with GET_ALL_HEADER_FILES
+    LIST(APPEND ${_sourcefile_var} ${_pch_header_file})
+  ENDIF()
+  SOURCE_GROUP("PCH" FILES ${_pch_header_file})
+
+  IF(MSVC)
+
+    # Write and add one source file, which generates the precompiled header file
+    SET(_pch_source_file "${CMAKE_CURRENT_BINARY_DIR}/${_pch_header_filename_we}.cc")
+    IF(NOT EXISTS ${_pch_source_file})
+      FILE(WRITE ${_pch_source_file} "#include \"${_pch_header_file}\"\n")
+    ENDIF()
+    SET_SOURCE_FILES_PROPERTIES(_pch_source_file PROPERTIES GENERATED TRUE)
+    LIST(APPEND ${_sourcefile_var} ${_pch_source_file})
+    SOURCE_GROUP("PCH" FILES ${_pch_source_file})
+
+    SET(_pch_file "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${_pch_header_filename}.pch")
+    # Set compile flags for generated source file
+    SET_SOURCE_FILES_PROPERTIES(${_pch_source_file} PROPERTIES COMPILE_FLAGS "/c /Yc\"${_pch_header_file}\" /Fp\"${_pch_file}\"")
+    # Set Compile flags for the other source files
+    FOREACH(_file ${_source_files})
+      GET_SOURCE_FILE_PROPERTY(_is_header ${_file} HEADER_FILE_ONLY)
+      IF(NOT _is_header)
+        GET_SOURCE_FILE_PROPERTY(_old_flags ${_file} COMPILE_FLAGS)
+        IF(NOT _old_flags)
+          SET(_old_flags "")
+        ENDIF()
+        SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES COMPILE_FLAGS "${_old_flags} /FI\"${_pch_header_file}\" /Yu\"${_pch_header_file}\" /Fp\"${_pch_file}\"")
+      ENDIF(NOT _is_header)
+    ENDFOREACH(_file)
+
+  ELSEIF(CMAKE_COMPILER_IS_GNU)
+
+    SET(_pch_file "${CMAKE_CURRENT_BINARY_DIR}/${_pch_header_filename}.gch")
+    SET(_pch_dep_helper_file "${CMAKE_CURRENT_BINARY_DIR}/${_target_name}PCHDependencyHelper.h")
+
+    # Append the gch-dir to make sure gcc finds the pch file
+    INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
+
+    # Get compiler flags of the source files (target does not yet exist!)
+    # This is just the best possible opportunity to address this dependency issue
+    GET_GCC_COMPILER_FLAGS(${_target_name} _pch_gcc_flags)
+    # Make sure we recompile the pch file even if only the flags change
+    IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}" OR NOT EXISTS "${_pch_dep_helper_file}")
+      SET(_INTERNAL_${_target_name}_PCH_GCC_FLAGS "${_pch_gcc_flags}" CACHE INTERNAL "")
+      FILE(WRITE ${_pch_dep_helper_file} "/* ${_pch_gcc_flags} */")
+    ENDIF()
+
+    # Set Compile flags for the other source files
+    FOREACH(_file ${_source_files})
+      GET_SOURCE_FILE_PROPERTY(_is_header ${_file} HEADER_FILE_ONLY)
+      IF(NOT _is_header)
+        GET_SOURCE_FILE_PROPERTY(_old_flags ${_file} COMPILE_FLAGS)
+        IF(NOT _old_flags)
+          SET(_old_flags "")
+        ENDIF()
+        SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES
+          COMPILE_FLAGS "${_old_flags} -include ${_pch_header_filename}"
+          OBJECT_DEPENDS "${_pch_header_file};${_pch_file}"
+        )
+      ENDIF(NOT _is_header)
+    ENDFOREACH(_file)
+
+  ENDIF()
+
+ENDMACRO(PRECOMPILED_HEADER_FILES_PRE_TARGET)
+
+FUNCTION(PRECOMPILED_HEADER_FILES_POST_TARGET _target_name)
+    # This macro is only necessary for GCC
+    IF(CMAKE_COMPILER_IS_GNU)
+
+      # Workaround for distcc
+      IF(CMAKE_CXX_COMPILER_ARG1)
+        # remove leading space in compiler argument
+        STRING(REGEX REPLACE "^ +" "" _pch_cmake_cxx_compiler_arg1 "${CMAKE_CXX_COMPILER_ARG1}")
+      ENDIF()
+
+      # Get compiler flags of the source files again (target exists this time)
+      GET_GCC_COMPILER_FLAGS(${_target_name} _pch_gcc_flags)
+
+      # Compile the header file
+      ADD_CUSTOM_COMMAND(
+        OUTPUT ${_pch_file}
+        COMMAND ${CMAKE_CXX_COMPILER}
+        ARGS ${pchsupport_compiler_cxx_arg1} ${_pch_gcc_flags} -c -x c++-header -o ${_pch_file} ${_pch_header_file}
+        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+        DEPENDS ${_pch_dep_helper_file}
+        IMPLICIT_DEPENDS CXX ${_pch_header_file}
+        VERBATIM
+      )
+
+    ENDIF(CMAKE_COMPILER_IS_GNU)
+ENDFUNCTION(PRECOMPILED_HEADER_FILES_POST_TARGET)
Index: code/trunk/cmake/tools/SeparateFlags.cmake
===================================================================
--- code/trunk/cmake/tools/SeparateFlags.cmake	(revision 7163)
+++ code/trunk/cmake/tools/SeparateFlags.cmake	(revision 7163)
@@ -0,0 +1,63 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Separates a string of program flags like "--blubb -test -D AA".
+ #    " -" or " /" denotes the start of a flag.
+ #    The same sequence inside double quotation marks is being ignored.
+ #    Spaces not within quotes are cleaned meaningfully.
+ #  Note:
+ #    This macro cannot cope with semicolons in the flag string!
+
+FUNCTION(SEPARATE_FLAGS _flags _output_variable)
+  # Visual studio (esp. IntelliSense) doesn't like dashes to specify arguments
+  # Always use foward slashes instead
+  IF(MSVC)
+    SET(_argument_starter "/")
+  ELSE()
+    SET(_argument_starter "-")
+  ENDIF(MSVC)
+
+  SET(_flags_prep " ${_flags} -")
+  # Separate the chunks
+  STRING(REPLACE " " " ;" _flag_chunks "${_flags_prep}") # Max loop iterations
+  SET(_flag_string)
+  SET(_parsed_flags)
+  # Loop is necessary because the regex engine is greedy
+  FOREACH(_chunk ${_flag_chunks})
+    SET(_flag_string "${_flag_string}${_chunk}")
+    # Replace all " -" and " /" inside quotation marks
+    STRING(REGEX REPLACE "^(([^\"]*\"[^\"]*\")*[^\"]*\"[^\"]*) [/-]([^\"]*\")"
+           "\\1@39535493@\\3" _flag_string "${_flag_string}")
+    # Extract one flag if possible
+    SET(_flag)
+    STRING(REGEX REPLACE "^.* [/-](.+)( [/-].*$)" "${_argument_starter}\\1" _flag "${_flag_string}")
+    STRING(REGEX REPLACE "^.* [/-](.+)( [/-].*$)" "\\2"  _flag_string "${_flag_string}")
+    IF(NOT _flag STREQUAL _flag_string)
+      STRING(STRIP "${_flag}" _flag_stripped)
+      LIST(APPEND _parsed_flags "${_flag_stripped}")
+    ENDIF(NOT _flag STREQUAL _flag_string)
+  ENDFOREACH(_chunk)
+
+  # Re-replace all " -" and " /" inside quotation marks
+  STRING(REGEX REPLACE "@39535493@" " -" _parsed_flags "${_parsed_flags}")
+  SET(${_output_variable} "${_parsed_flags}" PARENT_SCOPE)
+ENDFUNCTION(SEPARATE_FLAGS)
Index: code/trunk/cmake/tools/SetCacheAdvanced.cmake
===================================================================
--- code/trunk/cmake/tools/SetCacheAdvanced.cmake	(revision 7163)
+++ code/trunk/cmake/tools/SetCacheAdvanced.cmake	(revision 7163)
@@ -0,0 +1,36 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Write to the cache by force, but only if the user hasn't changed the value
+ #    Additional argument is the value (may also be a list)
+
+FUNCTION(SET_CACHE_ADVANCED _varname _type _docstring)
+  SET(_value ${ARGN})
+  IF(NOT "${_type}" MATCHES "^(STRING|BOOL|PATH|FILEPATH)$")
+    MESSAGE(FATAL_ERROR "${_type} is not a valid CACHE entry type")
+  ENDIF()
+
+  IF(NOT DEFINED _INTERNAL_${_varname} OR "${_INTERNAL_${_varname}}" STREQUAL "${${_varname}}")
+    SET(${_varname} "${_value}" CACHE ${_type} "${_docstring}" FORCE)
+    SET(_INTERNAL_${_varname} "${_value}" CACHE INTERNAL "Do not edit in any case!")
+  ENDIF()
+ENDFUNCTION(SET_CACHE_ADVANCED)
Index: code/trunk/cmake/tools/SourceFileUtilities.cmake
===================================================================
--- code/trunk/cmake/tools/SourceFileUtilities.cmake	(revision 7163)
+++ code/trunk/cmake/tools/SourceFileUtilities.cmake	(revision 7163)
@@ -0,0 +1,123 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Several functions that help organising the source tree.
+ #    [ADD/SET]_SOURCE_FILES - Writes source files to the cache by force and
+ #                             adds the current directory.
+ #                             Also compiles multiple source files into a single
+ #                             one by including them
+ #                             Use COMPILATION_[BEGIN|END] in
+ #                             [ADD|SET]_SOURCE_FILES and specify the name of
+ #                             the new source file after COMPILATION_BEGIN
+ #    GET_ALL_HEADER_FILES   - Finds all header files recursively.
+ #    GENERATE_SOURCE_GROUPS - Set Visual Studio source groups.
+ #
+
+FUNCTION(PREPARE_SOURCE_FILES)
+  SET(_fullpath_sources)
+  FOREACH(_file ${ARGN})
+    IF(_file STREQUAL "COMPILATION_BEGIN")
+      SET(_compile TRUE)
+      # Next file is the name of the compilation
+      SET(_get_name TRUE)
+    ELSEIF(_get_name)
+      SET(_get_name FALSE)
+      SET(_compilation_name ${_file})
+    ELSEIF(_file STREQUAL "COMPILATION_END")
+      IF(NOT _compilation_name)
+        MESSAGE(FATAL_ERROR "No name provided for source file compilation")
+      ENDIF()
+      IF(NOT DISABLE_COMPILATIONS)
+        SET(_compilation_file ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name})
+        SET(_include_string)
+        FOREACH(_file2 ${_compilation})
+          SET(_include_string "${_include_string}#include \"${_file2}\"\n")
+        ENDFOREACH(_file2)
+        IF(EXISTS ${_compilation_file})
+          FILE(READ ${_compilation_file} _include_string_file)
+        ENDIF()
+        IF(NOT _include_string STREQUAL "${_include_string_file}")
+          FILE(WRITE ${_compilation_file} "${_include_string}")
+        ENDIF()
+        LIST(APPEND _fullpath_sources ${_compilation_file})
+        # MSVC hack that excludes the compilations from the intellisense database
+        # (There is a bug with the "-" instead of "/". Only works for "Zm#" argument)
+        IF(MSVC)
+          SET_SOURCE_FILES_PROPERTIES(${_compilation_file} PROPERTIES COMPILE_FLAGS "-Zm1000")
+        ENDIF()
+      ENDIF()
+      SET(_compilation_name)
+      SET(_compilation)
+      SET(_compile FALSE)
+    ELSE()
+      # Prefix the full path
+      GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION)
+      LIST(APPEND _fullpath_sources ${_filepath})
+      IF(_compile AND NOT DISABLE_COMPILATIONS)
+        LIST(APPEND _compilation ${_filepath})
+        LIST(APPEND _fullpath_sources "H")
+      ENDIF()
+    ENDIF()
+  ENDFOREACH(_file)
+  SET(_fullpath_sources ${_fullpath_sources} PARENT_SCOPE)
+ENDFUNCTION(PREPARE_SOURCE_FILES)
+
+
+# Adds source files with the full path to a list
+FUNCTION(ADD_SOURCE_FILES _varname)
+  PREPARE_SOURCE_FILES(${ARGN})
+  # Write into the cache to avoid variable scoping in subdirs
+  SET(${_varname} ${${_varname}} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
+ENDFUNCTION(ADD_SOURCE_FILES)
+
+
+# Sets source files with the full path
+FUNCTION(SET_SOURCE_FILES _varname)
+  PREPARE_SOURCE_FILES(${ARGN})
+  # Write into the cache to avoid variable scoping in subdirs
+  SET(${_varname} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
+ENDFUNCTION(SET_SOURCE_FILES)
+
+
+# Search the entire directory tree for header files and add them to a variable
+MACRO(GET_ALL_HEADER_FILES _target_varname)
+  FILE(GLOB_RECURSE ${_target_varname} ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
+ENDMACRO(GET_ALL_HEADER_FILES)
+
+
+# Generate source groups according to the directory structure
+FUNCTION(GENERATE_SOURCE_GROUPS)
+
+  FOREACH(_file ${ARGN})
+    GET_SOURCE_FILE_PROPERTY(_full_filepath ${_file} LOCATION)
+    FILE(RELATIVE_PATH _relative_path ${CMAKE_CURRENT_SOURCE_DIR} ${_full_filepath})
+    IF(NOT _relative_path MATCHES "^\\.\\.")
+      GET_FILENAME_COMPONENT(_relative_path ${_relative_path} PATH)
+      STRING(REPLACE "/" "\\\\" _group_path "${_relative_path}")
+      SOURCE_GROUP("Source\\${_group_path}" FILES ${_file})
+    ELSE()
+      # Has to be a compilation
+      SOURCE_GROUP("Compilations" FILES ${_file})
+    ENDIF()
+  ENDFOREACH(_file)
+
+ENDFUNCTION(GENERATE_SOURCE_GROUPS)
Index: code/trunk/cmake/tools/TargetUtilities.cmake
===================================================================
--- code/trunk/cmake/tools/TargetUtilities.cmake	(revision 7163)
+++ code/trunk/cmake/tools/TargetUtilities.cmake	(revision 7163)
@@ -0,0 +1,293 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Adds a library or an executable like ADD_LIBRARY/ADD_EXECUTABLE, but
+ #    accepts a lot more input information. Simply supply the keywords
+ #    described below in any order you wish.
+ #    The output is then stored in "_arg_ARGNAME" where ARGNAME is the the
+ #    name of the switch or list.
+ #
+ #    Switches: (when given --> TRUE, FALSE otherwise)
+ #      FIND_HEADER_FILES: Searches the current directory for all header files
+ #                         and adds them to the target.
+ #      EXCLUDE_FROM_ALL:  Inherited from ADD_LIBRARY/ADD_EXECUTABLE
+ #      ORXONOX_EXTERNAL:  Specify this for third party libraries
+ #      NO_DLL_INTERFACE:  Link statically with MSVC
+ #      NO_SOURCE_GROUPS:  Don't create msvc source groups
+ #      MODULE:            For dynamic module libraries (libraries only)
+ #      WIN32:             Inherited from ADD_EXECUTABLE (executables only)
+ #      PCH_NO_DEFAULT:    Do not make precompiled header files default if
+ #                         specified with PCH_FILE
+ #      NO_INSTALL:        Do not install the target at all
+ #      NO_VERSION:        Prevents adding any version to a target
+ #
+ #    Lists:
+ #      LINK_LIBRARIES:    Redirects to TARGET_LINK_LIBRARIES
+ #      VERSION:           Set version to the binary
+ #      SOURCE_FILES:      Source files for the target
+ #      DEFINE_SYMBOL:     Sets the DEFINE_SYMBOL target property
+ #      TOLUA_FILES:       Files with tolua interface
+ #      PCH_FILE:          Precompiled header file
+ #      PCH_EXCLUDE:       Source files to be excluded from PCH support
+ #      OUTPUT_NAME:       If you want a different name than the target name
+ #  Note:
+ #    This function also installs the target!
+ #  Prerequisistes:
+ #    ORXONOX_DEFAULT_LINK, ORXONOX_CONFIG_FILES
+ #  Parameters:
+ #    _target_name, ARGN for the macro arguments
+ #
+
+INCLUDE(CMakeDependentOption)
+INCLUDE(CapitaliseName)
+INCLUDE(GenerateToluaBindings)
+INCLUDE(ParseMacroArguments)
+INCLUDE(SourceFileUtilities)
+IF(PCH_COMPILER_SUPPORT)
+  INCLUDE(PrecompiledHeaderFiles)
+ENDIF()
+
+MACRO(ORXONOX_ADD_LIBRARY _target_name)
+  TU_ADD_TARGET(${_target_name} LIBRARY "MODULE" ${ARGN})
+ENDMACRO(ORXONOX_ADD_LIBRARY)
+
+MACRO(ORXONOX_ADD_EXECUTABLE _target_name)
+  TU_ADD_TARGET(${_target_name} EXECUTABLE "WIN32" ${ARGN})
+ENDMACRO(ORXONOX_ADD_EXECUTABLE)
+
+
+MACRO(TU_ADD_TARGET _target_name _target_type _additional_switches)
+  CAPITALISE_NAME(${_target_name} _target_name_capitalised)
+  STRING(TOUPPER "${_target_name}" _target_name_upper)
+
+  # Specify all possible options (either switch or with add. arguments)
+  SET(_switches   FIND_HEADER_FILES  EXCLUDE_FROM_ALL  ORXONOX_EXTERNAL
+                  NO_DLL_INTERFACE   NO_SOURCE_GROUPS  PCH_NO_DEFAULT 
+                  NO_INSTALL         NO_VERSION        ${_additional_switches})
+  SET(_list_names LINK_LIBRARIES  VERSION   SOURCE_FILES  DEFINE_SYMBOL
+                  TOLUA_FILES     PCH_FILE  PCH_EXCLUDE   OUTPUT_NAME)
+  PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN})
+
+
+  # Workaround: Source file properties get lost when leaving a subdirectory
+  # Therefore an "H" after a file means we have to set it as HEADER_FILE_ONLY
+  FOREACH(_file ${_arg_SOURCE_FILES})
+    IF(_file STREQUAL "H")
+      SET_SOURCE_FILES_PROPERTIES(${_last_file} PROPERTIES HEADER_FILE_ONLY TRUE)
+    ELSE()
+      SET(_last_file ${_file})
+      LIST(APPEND _${_target_name}_source_files ${_file})
+    ENDIF()
+  ENDFOREACH(_file)
+
+  # Assemble all header files of the library
+  IF(_arg_FIND_HEADER_FILES)
+    GET_ALL_HEADER_FILES(_${_target_name}_header_files)
+  ENDIF()
+
+  # Remove potential duplicates
+  SET(_${_target_name}_files ${_${_target_name}_header_files} ${_${_target_name}_source_files})
+  LIST(REMOVE_DUPLICATES _${_target_name}_files)
+
+  # Generate the source groups
+  IF(NOT _arg_NO_SOURCE_GROUPS)
+    GENERATE_SOURCE_GROUPS(${_${_target_name}_files})
+
+    IF(NOT _arg_ORXONOX_EXTERNAL)
+      # Move the prereqs.h file to the config section
+      IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_target_name_capitalised}Prereqs.h)
+        SOURCE_GROUP("Config" FILES ${_target_name_capitalised}Prereqs.h)
+      ENDIF()
+      # Add the config files in a special source group
+      LIST(APPEND _${_target_name}_files ${ORXONOX_CONFIG_FILES})
+      SOURCE_GROUP("Config" FILES ${ORXONOX_CONFIG_FILES})
+    ENDIF()
+  ENDIF(NOT _arg_NO_SOURCE_GROUPS)
+
+  # TOLUA_FILES
+  IF(_arg_TOLUA_FILES)
+    GENERATE_TOLUA_BINDINGS(${_target_name_capitalised} _${_target_name}_files
+                            INPUTFILES ${_arg_TOLUA_FILES})
+  ENDIF()
+
+  # First part (pre target) of precompiled header files
+  IF(PCH_COMPILER_SUPPORT AND _arg_PCH_FILE)
+    # Provide convenient option to control PCH
+    IF(_arg_PCH_NO_DEFAULT)
+      SET(PCH_DEFAULT FALSE)
+    ELSE()
+      SET(PCH_DEFAULT TRUE)
+    ENDIF()
+    CMAKE_DEPENDENT_OPTION(PCH_ENABLE_${_target_name_upper}
+      "Enable using precompiled header files for library ${_target_name}." ${PCH_DEFAULT} PCH_ENABLE OFF)
+
+    IF(PCH_ENABLE_${_target_name_upper})
+      PRECOMPILED_HEADER_FILES_PRE_TARGET(${_target_name} ${_arg_PCH_FILE} _${_target_name}_files EXCLUDE ${_arg_PCH_EXCLUDE})
+    ENDIF()
+  ENDIF()
+
+  # Set link mode (SHARED/STATIC)
+  IF(MSVC AND _arg_NO_DLL_INTERFACE)
+    # Certain libraries don't have dllexport/dllimport and can't be linked shared with MSVC
+    SET(_link_mode STATIC)
+  ELSEIF(_arg_ORXONOX_EXTERNAL)
+    # Externals can be linked shared or statically
+    SET(_link_mode ${ORXONOX_EXTERNAL_LINK_MODE})
+  ELSE()
+    # All our own libraries are linked dynamically because of static symbols
+    SET(_link_mode SHARED)
+  ENDIF()
+
+  # No warnings needed from third party libraries
+  IF(_arg_ORXONOX_EXTERNAL)
+    REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)
+    ADD_COMPILER_FLAGS("-w")
+  ENDIF()
+
+  # Don't compile header files
+  FOREACH(_file ${_${_target_name}_files})
+    IF(NOT _file MATCHES "\\.(c|cc|cpp)")
+      SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES HEADER_FILE_ONLY TRUE)
+    ENDIF()
+  ENDFOREACH(_file)
+
+
+
+  # Add the library/executable
+  IF("${_target_type}" STREQUAL "LIBRARY")
+    ADD_LIBRARY(${_target_name} ${_link_mode}
+                ${_arg_EXCLUDE_FROM_ALL} ${_${_target_name}_files})
+  ELSE()
+    ADD_EXECUTABLE(${_target_name} ${_arg_WIN32} ${_arg_EXCLUDE_FROM_ALL}
+                   ${_${_target_name}_files})
+  ENDIF()
+
+
+
+  # Change library prefix to "lib"
+  IF(MSVC AND ${_target_type} STREQUAL "LIBRARY")
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
+      PREFIX "lib"
+    )
+  ENDIF()
+
+  # MSVC hack to exclude external library sources from the intellisense database
+  # (IntelliSense stops working when adding "-Zm1000" as compile flag. "/Zm1000"
+  # would not work because of the slash)
+  IF(_arg_ORXONOX_EXTERNAL AND MSVC)
+    GET_TARGET_PROPERTY(_compile_flags ${_target_name} COMPILE_FLAGS)
+    IF(NOT _compile_flags)
+      SET(_compile_flags)
+    ENDIF()
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES COMPILE_FLAGS "${_compile_flags} -Zm1000")
+  ENDIF()
+
+  # Configure modules
+  IF (_arg_MODULE)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
+      RUNTIME_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Windows
+      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Unix
+    )
+    ADD_MODULE(${_target_name})
+  ENDIF()
+
+  # LINK_LIBRARIES
+  IF(_arg_LINK_LIBRARIES)
+    TARGET_LINK_LIBRARIES(${_target_name} ${_arg_LINK_LIBRARIES})
+  ENDIF()
+
+  # DEFINE_SYMBOL
+  IF(_arg_DEFINE_SYMBOL)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES DEFINE_SYMBOL ${_arg_DEFINE_SYMBOL})
+  ELSEIF(NOT _arg_ORXONOX_EXTERNAL)
+    # Automatically add the macro definitions for our own libraries
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES DEFINE_SYMBOL "${_target_name_upper}_SHARED_BUILD")
+  ENDIF()
+
+  # VERSION
+  IF(_arg_VERSION)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES VERSION ${_arg_VERSION})
+  ELSEIF(NOT _arg_ORXONOX_EXTERNAL AND NOT _arg_NO_VERSION AND NOT ${_target_type} STREQUAL "EXECUTABLE")
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES VERSION ${ORXONOX_VERSION})
+  ENDIF()
+
+  # OUTPUT_NAME
+  IF(_arg_OUTPUT_NAME)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES OUTPUT_NAME  ${_arg_OUTPUT_NAME})
+  ENDIF()
+
+  # Second part of precompiled header files
+  IF(PCH_COMPILER_SUPPORT AND PCH_ENABLE_${_target_name_upper} AND _arg_PCH_FILE)
+    PRECOMPILED_HEADER_FILES_POST_TARGET(${_target_name} ${_arg_PCH_FILE})
+  ENDIF()
+
+  # Install all targets except for static ones (executables also have SHARED in _link_mode)
+  IF((${_link_mode} STREQUAL "SHARED") AND NOT _arg_NO_INSTALL)
+    IF(_arg_MODULE)
+      INSTALL(TARGETS ${_target_name}
+        RUNTIME DESTINATION ${MODULE_INSTALL_DIRECTORY}
+        LIBRARY DESTINATION ${MODULE_INSTALL_DIRECTORY}
+      )
+    ELSE()
+      INSTALL(TARGETS ${_target_name}
+        RUNTIME DESTINATION ${RUNTIME_INSTALL_DIRECTORY}
+        LIBRARY DESTINATION ${LIBRARY_INSTALL_DIRECTORY}
+      )
+    ENDIF()
+  ENDIF()
+
+ENDMACRO(TU_ADD_TARGET)
+
+
+# Creates a helper file with name <name_of_the_library>${ORXONOX_MODULE_EXTENSION}
+# This helps finding dynamically loadable modules at runtime
+
+FUNCTION(ADD_MODULE _target)
+  # We use the properties to get the name because the librarys name may differ from
+  # the target name (for example orxonox <-> liborxonox)
+
+  GET_TARGET_PROPERTY(_target_loc ${_target} LOCATION)
+  GET_FILENAME_COMPONENT(_target_name ${_target_loc} NAME_WE)
+
+  IF(CMAKE_CONFIGURATION_TYPES)
+    FOREACH(_config ${CMAKE_CONFIGURATION_TYPES})
+      SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_config}/${_target_name}${ORXONOX_MODULE_EXTENSION})
+
+      FILE(WRITE ${_module_filename})
+
+      INSTALL(
+        FILES ${_module_filename}
+        DESTINATION ${MODULE_INSTALL_DIRECTORY}
+        CONFIGURATIONS ${_config}
+      )
+    ENDFOREACH()
+  ELSE()
+    SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_target_name}${ORXONOX_MODULE_EXTENSION})
+
+    FILE(WRITE ${_module_filename})
+
+    INSTALL(
+      FILES ${_module_filename}
+      DESTINATION ${MODULE_INSTALL_DIRECTORY}
+    )
+  ENDIF()
+ENDFUNCTION(ADD_MODULE)
