Index: /code/branches/buildsystem2/cmake/BuildConfig.cmake
===================================================================
--- /code/branches/buildsystem2/cmake/BuildConfig.cmake	(revision 2617)
+++ /code/branches/buildsystem2/cmake/BuildConfig.cmake	(revision 2618)
@@ -33,15 +33,23 @@
 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
 
+# Sets where to find the external libraries like OgreMain.dll at runtime
+# On Unix you should not have to change this at all.
+IF(NOT ORXONOX_LIBRARY_BIN_DIR)
+  SET(ORXONOX_LIBRARY_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+ENDIF(NOT ORXONOX_LIBRARY_BIN_DIR)
+
 # Set Debug build to default when not having multi-config generator like msvc
-IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
-  SET(CMAKE_BUILD_TYPE "Debug")
-ENDIF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
-
-# When searching for debug libraries, this is appended to the libarary name
-SET(LIBRARY_DEBUG_POSTFIX "_d")
-# Sets where to find the binary directory of external libraries
-SET(ORXONOX_LIBRARY_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
-# Working directory for the tolua parser. Adjust for windows because lua.dll has to be there!
-SET(TOLUA_PARSER_WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+IF(NOT CMAKE_CONFIGURATION_TYPES)
+  IF(NOT CMAKE_BUILD_TYPE)
+    SET(CMAKE_BUILD_TYPE Debug CACHE STRING
+        "Build types are: Debug, Release, MinSizeRel, RelWithDebInfo" FORCE)
+  ENDIF(NOT CMAKE_BUILD_TYPE)
+  MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE)
+ELSE(NOT CMAKE_CONFIGURATION_TYPES)
+  IF(CMAKE_BUILD_TYPE)
+    SET(CMAKE_BUILD_TYPE CACHE STRING FORCE)
+  ENDIF(CMAKE_BUILD_TYPE)
+  MARK_AS_ADVANCED(CMAKE_BUILD_TYPE)
+ENDIF(NOT CMAKE_CONFIGURATION_TYPES)
 
 OPTION(EXTRA_WARNINGS "Enable some extra warnings (heavily pollutes the output)")
@@ -55,13 +63,16 @@
 # More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
 # Render systems may be optional, but at least one has to be found in FindOgre
-SET(OGRE_PLUGINS RenderSystem_GL RenderSystem_Direct3D9 Plugin_ParticleFX)
+SET(OGRE_PLUGINS_INT RenderSystem_GL RenderSystem_Direct3D9 Plugin_ParticleFX)
 IF(WIN32)
   # CG program manager is probably DirectX related (not available under unix)
-  LIST(APPEND OGRE_PLUGINS Plugin_CgProgramManager)
+  LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager)
 ENDIF(WIN32)
+SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING
+   "Specify which OGRE plugins to load. Existance check is performed.")
 
 # Check the plugins and determine the plugin folder
 # You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}
 INCLUDE(CheckOGREPlugins)
+CHECK_OGRE_PLUGINS(${OGRE_PLUGINS})
 
 
Index: /code/branches/buildsystem2/cmake/CheckOGREPlugins.cmake
===================================================================
--- /code/branches/buildsystem2/cmake/CheckOGREPlugins.cmake	(revision 2617)
+++ /code/branches/buildsystem2/cmake/CheckOGREPlugins.cmake	(revision 2618)
@@ -1,27 +1,50 @@
-IF(WIN32)
+#    Author: Reto '1337' Grieder (2008)
+#
+#    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
+
+###################################################
+# Make sure we have the required plugins for OGRE #
+###################################################
+
+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_STORED ${CMAKE_FIND_LIBRARY_SUFFIXES})
     SET(CMAKE_FIND_LIBRARY_SUFFIXES .dll)
-ENDIF(WIN32)
-SET(CMAKE_FIND_LIBRARY_PREFIXES_STORED "${CMAKE_FIND_LIBRARY_PREFIXES}")
-SET(CMAKE_FIND_LIBRARY_PREFIXES "")
+  ENDIF(WIN32)
+  # Do not prefix "lib" on any platform
+  SET(CMAKE_FIND_LIBRARY_PREFIXES "")
 
-SET(OGRE_RENDER_SYSTEM_FOUND FALSE)
-FOREACH(_plugin ${OGRE_PLUGINS})
+  SET(OGRE_RENDER_SYSTEM_FOUND FALSE)
+  FOREACH(_plugin ${OGRE_PLUGINS})
     FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_OPTIMIZED
-        NAMES ${_plugin}
-        PATHS $ENV{OGRE_HOME} /usr/local /usr
-        PATH_SUFFIXES lib lib/OGRE bin bin/Release bin/release Release release
+      NAMES ${_plugin}
+      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
+      PATH_SUFFIXES lib lib/OGRE bin bin/Release bin/release Release release
     )
     FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_DEBUG
-        NAMES ${_plugin}${LIBRARY_DEBUG_POSTFIX}
-        PATHS $ENV{OGRE_HOME} /usr/local /usr
-        PATH_SUFFIXES lib lib/OGRE bin bin/Debug bin/debug Debug debug
+      NAMES ${_plugin}d ${_plugin}_d
+      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
+      PATH_SUFFIXES lib lib/OGRE bin bin/Debug bin/debug Debug debug
     )
-    # We only need at least one render system. Check at the end
+    # 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(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
+      IF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
+        MESSAGE(FATAL_ERROR "Could not find OGRE plugin named ${_plugin}")
+      ENDIF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
     ELSEIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
       SET(OGRE_RENDER_SYSTEM_FOUND TRUE)
@@ -29,42 +52,50 @@
 
     IF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
-        # If debug version is not available, release will do as well
-        IF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
-            SET(OGRE_PLUGIN_${_plugin}_DEBUG ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} CACHE STRING "" FORCE)
-        ENDIF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
-        MARK_AS_ADVANCED(OGRE_PLUGIN_${_plugin}_OPTIMIZED OGRE_PLUGIN_${_plugin}_DEBUG)
+      # If debug version is not available, release will do as well
+      IF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
+        SET(OGRE_PLUGIN_${_plugin}_DEBUG ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} CACHE STRING "" FORCE)
+      ENDIF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
+      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(_release_folder ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} PATH)
-        IF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
-            MESSAGE(FATAL_ERROR "Ogre release plugins have to be in the same folder!")
-        ENDIF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
-        SET(OGRE_PLUGINS_FOLDER_RELEASE ${_release_folder})
-        GET_FILENAME_COMPONENT(_debug_folder ${OGRE_PLUGIN_${_plugin}_DEBUG} PATH)
-        IF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
-            MESSAGE(FATAL_ERROR "Ogre debug plugins have to be in the same folder!")
-        ENDIF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
-        SET(OGRE_PLUGINS_FOLDER_DEBUG ${_debug_folder})
+      ### Set variables to configure orxonox.ini correctly afterwards in bin/ ###
+      # Check and set the folders
+      GET_FILENAME_COMPONENT(_release_folder ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} PATH)
+      IF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
+        MESSAGE(FATAL_ERROR "Ogre release plugins have to be in the same folder!")
+      ENDIF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
+      SET(OGRE_PLUGINS_FOLDER_RELEASE ${_release_folder})
+      GET_FILENAME_COMPONENT(_debug_folder ${OGRE_PLUGIN_${_plugin}_DEBUG} PATH)
+      IF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
+        MESSAGE(FATAL_ERROR "Ogre debug plugins have to be in the same folder!")
+      ENDIF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
+      SET(OGRE_PLUGINS_FOLDER_DEBUG ${_debug_folder})
 
-        # Create a list with the plugins for relase and debug configurations
-        LIST(APPEND OGRE_PLUGINS_RELEASE ${_plugin})
-        IF(OGRE_PLUGIN_${_plugin}_DEBUG)
-            LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin}${LIBRARY_DEBUG_POSTFIX})
-        ELSE(OGRE_PLUGIN_${_plugin}_DEBUG)
-            LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin})
-        ENDIF(OGRE_PLUGIN_${_plugin}_DEBUG)
+      # Create a list with the plugins for relase and debug configurations
+      LIST(APPEND OGRE_PLUGINS_RELEASE ${_plugin})
+      IF(OGRE_PLUGIN_${_plugin}_DEBUG)
+        # Determine debug postfix ("d" or "_d")
+        IF(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "_d\\.|_d$")
+          LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}_d")
+        ELSE(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "_d\\.|_d$")
+          LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}d")
+        ENDIF(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "_d\\.|_d$")
+      ELSE(OGRE_PLUGIN_${_plugin}_DEBUG)
+        LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin})
+      ENDIF(OGRE_PLUGIN_${_plugin}_DEBUG)
     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(NOT OGRE_RENDER_SYSTEM_FOUND)
-IF(WIN32)
-    # Restore previous settings (see above before FOREACH)
-    SET(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES_STORED}")
-ENDIF(WIN32)
-SET(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES_STORED}")
+  ENDFOREACH(_plugin)
+  IF(NOT OGRE_RENDER_SYSTEM_FOUND)
+      MESSAGE(FATAL_ERROR "Could not find an OGRE render system plugin")
+  ENDIF(NOT OGRE_RENDER_SYSTEM_FOUND)
 
-# 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}")
+  # 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/branches/buildsystem2/cmake/LibraryConfig.cmake
===================================================================
--- /code/branches/buildsystem2/cmake/LibraryConfig.cmake	(revision 2617)
+++ /code/branches/buildsystem2/cmake/LibraryConfig.cmake	(revision 2618)
@@ -1,5 +1,33 @@
+INCLUDE(CompareVersionStrings)
+INCLUDE(FindPackageHandleStandardArgs)
+
+################ Misc Options ###################
+
+OPTION(LIBRARY_USE_PACKAGE_IF_SUPPORTED
+       "When set to false CMake will only look in the standard paths for libraries" ON)
+
+
+############## Platform Scripts #################
+
+# Scripts for specific library and CMake config
+INCLUDE(LibraryConfigTardis)
+INCLUDE(LibraryConfigApple)
+INCLUDE(LibraryConfigMSVC)
 INCLUDE(LibraryConfigMinGW)
-INCLUDE(LibraryConfigMSVC)
-INCLUDE(LibraryConfigTardis)
+
+# User script
+SET(LIBRARY_CONFIG_USER_SCRIPT "" CACHE FILEPATH
+    "Specify a CMake script if you wish to write your own library path config.
+     See LibraryConfigTardis.cmake or LibraryConfigMinGW.cmake for examples.")
+IF(LIBRARY_CONFIG_USER_SCRIPT)
+  IF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT}.cmake)
+    INCLUDE(${LIBRARY_CONFIG_USER_SCRIPT})
+  ELSEIF(EXISTS ${LIBRARY_CONFIG_USER_SCRIPT})
+    INCLUDE(${LIBRARY_CONFIG_USER_SCRIPT})
+  ELSEIF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
+    INCLUDE(${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
+  ENDIF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT}.cmake)
+ENDIF(LIBRARY_CONFIG_USER_SCRIPT)
+
 
 ############### Library finding #################
@@ -92,2 +120,23 @@
   LINK_DIRECTORIES(${BOOST_LINK_DIR})
 ENDIF (MSVC)
+
+
+####### Static/Dynamic linking options ##########
+
+# On Windows dynamically linked libraries need some special treatment
+# You may want to edit these settings if you provide your own libraries
+# Note: Default option in the libraries vary, but our default option is dynamic
+IF(WIN32)
+  OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE)
+  OPTION(LINK_CEGUI_DYNAMIC "Link CEGUI dynamicylly on Windows" TRUE)
+  OPTION(LINK_ENET_DYNAMIC  "Link ENet dynamically on Windows" TRUE)
+  OPTION(LINK_OGRE_DYNAMIC  "Link OGRE dynamically on Windows" TRUE)
+  OPTION(LINK_TCL_DYNAMIC   "Link TCL dynamically on Windows" TRUE)
+  OPTION(LINK_ZLIB_DYNAMIC  "Link ZLib dynamically on Windows" TRUE)
+  COMPARE_VERSION_STRINGS("${LUA_VERSION}" "5.1" _version_comparison)
+  IF(_version_comparison LESS 0)
+    OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" FALSE)
+  ELSE(_version_comparison LESS 0)
+    OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" TRUE)
+  ENDIF(_version_comparison LESS 0)
+ENDIF(WIN32)
Index: /code/branches/buildsystem2/cmake/LibraryConfigMSVC.cmake
===================================================================
--- /code/branches/buildsystem2/cmake/LibraryConfigMSVC.cmake	(revision 2617)
+++ /code/branches/buildsystem2/cmake/LibraryConfigMSVC.cmake	(revision 2618)
@@ -27,12 +27,8 @@
  
 ###################### MSVC config ########################
-# Set the library directories and special options when
-# using Visual Studio.
-###########################################################
+# Set the library directories when using Visual Studio.   #
 
-IF (MSVC)
+IF (MSVC AND LIBRARY_USE_PACKAGE_IF_SUPPORTED)
   MESSAGE(STATUS "Running on MSVC. Using customized paths and options.")
-
-  ###################### Libraries ########################
 
   # Determine library directory
@@ -49,5 +45,6 @@
   # Note: When setting ENV${} variables, make sure to use quotes when
   #       having multiple directories.
-  SET(ENV{BOOST_ROOT}        ${MSVC_LIBRARY_DIR}/boost-1.35.0)
+  SET(BOOST_ROOT             ${MSVC_LIBRARY_DIR}/boost-1.35.0)
+  SET(BOOST_LIBRARYDIR       ${MSVC_LIBRARY_DIR}/boost-1.35.0/lib)
   SET(ENV{CEGUIDIR}          ${MSVC_LIBRARY_DIR}/cegui-0.6.1)
   SET(ENV{ENETDIR}           ${MSVC_LIBRARY_DIR}/enet-1.2)
@@ -57,17 +54,14 @@
   SET(ENV{OPENALDIR}         ${MSVC_LIBRARY_DIR}/openal-1.1)
   SET(ENV{LUA_DIR}           ${MSVC_LIBRARY_DIR}/lua-5.1.3)
-  SET(ENV{OGRE_HOME}        "${MSVC_LIBRARY_DIR}/ogre-1.4.9;${ORXONOX_LIBRARY_BIN_DIR}")
-  SET(TCL_INCLUDE_PATH       ${MSVC_LIBRARY_DIR}/tcl-8.5.2/include)
-  SET(TCL_LIBRARY            ${MSVC_LIBRARY_DIR}/tcl-8.5.2/lib/tcl85t.lib)
-  # Do some hacking to avoid "Tclsh not found" message
-  SET(TCL_TCLSH              ${MSVC_LIBRARY_DIR}/tcl-8.5.2/lib/tcl85t.lib)
+  SET(ENV{OGRE_HOME}         ${MSVC_LIBRARY_DIR}/ogre-1.4.9)
+  SET(ENV{OGRE_PLUGIN_DIR}   ${MSVC_LIBRARY_DIR}/bin)
+  SET(TCL_INCLUDE_PATH       ${MSVC_LIBRARY_DIR}/tcl-8.5.5/include)
+  SET(TCL_LIBRARY            ${MSVC_LIBRARY_DIR}/tcl-8.5.5/lib/tcl85.lib)
   SET(ZLIB_INCLUDE_DIR       ${MSVC_LIBRARY_DIR}/zlib-1.2.3/include)
   SET(ZLIB_LIBRARY optimized ${MSVC_LIBRARY_DIR}/zlib-1.2.3/lib/zlib.lib
                    debug     ${MSVC_LIBRARY_DIR}/zlib-1.2.3/lib/zlib_d.lib)
-  SET(ZLIB_FOUND TRUE)
+  IF ($ENV{DXSDK_DIR} STREQUAL "")
+    SET(ENV{DXSDK_DIR}       ${MSVC_LIBRARY_DIR}/directx-sdk-aug-2007)
+  ENDIF ($ENV{DXSDK_DIR} STREQUAL "")
 
-  ######################### Misc ##########################
-
-  # Set tolua working directory because lua.dll is not where tolua is
-  SET(TOLUA_PARSER_WORKING_DIRECTORY ${ORXONOX_LIBRARY_BIN_DIR})
-ENDIF (MSVC)
+ENDIF (MSVC AND LIBRARY_USE_PACKAGE_IF_SUPPORTED)
Index: /code/branches/buildsystem2/cmake/LibraryConfigMinGW.cmake
===================================================================
--- /code/branches/buildsystem2/cmake/LibraryConfigMinGW.cmake	(revision 2617)
+++ /code/branches/buildsystem2/cmake/LibraryConfigMinGW.cmake	(revision 2618)
@@ -31,5 +31,5 @@
 ###################################################
 
-IF (MINGW)
+IF (MINGW AND LIBRARY_USE_PACKAGE_IF_SUPPORTED)
   MESSAGE(STATUS "Running on MinGW. Using customized paths and options.")
 
@@ -46,29 +46,24 @@
   # Note: When setting ENV${} variables, make sure to use quotes when
   #       having multiple directories.
-  SET(ENV{BOOST_ROOT}    "${MINGW_LIBRARY_DIR}/boost_1_34_1")
-  SET(ENV{CEGUIDIR}      "${MINGW_LIBRARY_DIR}/cegui-0.6.1")
-  SET(ENV{ENETDIR}       "${MINGW_LIBRARY_DIR}/enet-1.1")
-  SET(ENV{ALUTDIR}       "${MINGW_LIBRARY_DIR}/freealut-1.1.0")
-  SET(ENV{OGGDIR}        "${MINGW_LIBRARY_DIR}/libogg-1.1.3;${MINGW_LIBRARY_DIR}/libogg-1.1.3/src/.libs")
-  SET(ENV{VORBISDIR}     "${MINGW_LIBRARY_DIR}/libvorbis-1.2.0;${MINGW_LIBRARY_DIR}/libvorbis-1.2.0/lib/.libs")
-  SET(ENV{OPENALDIR}     "${MINGW_LIBRARY_DIR}/openal-0.0.8/common;${MINGW_LIBRARY_DIR}/openal-0.0.8/src/.libs")
-  SET(ENV{LUA_DIR}       "${MINGW_LIBRARY_DIR}/lua-5.1.3")
-  SET(ENV{OGRE_HOME}     "${MINGW_LIBRARY_DIR}/ogre/OgreMain;${MINGW_LIBRARY_DIR}/ogre/Samples/Common")
-  SET(TCL_INCLUDE_PATH   "${MINGW_LIBRARY_DIR}/tcl8.5.2/generic")
-  SET(TCL_LIBRARY        "${MINGW_LIBRARY_DIR}/tcl8.5.2/win/tcl85.dll")
-  # Do some hacking to avoid "Tclsh not found" message
-  SET(TCL_TCLSH          "${MINGW_LIBRARY_DIR}/tcl8.5.2/win/tcl85.dll")
-  SET(ZLIB_INCLUDE_DIR   "${MINGW_LIBRARY_DIR}/zlib/include")
-  SET(ZLIB_LIBRARY       "${MINGW_LIBRARY_DIR}/zlib/libzlib.a")
+  # Using BOOST_ROOT only does not work with CMake 2.6.0 (2.6.2 works though)
+  SET(BOOST_INCLUDEDIR      "${MINGW_LIBRARY_DIR}/boost_1_34_1")
+  SET(BOOST_LIBRARYDIR      "${MINGW_LIBRARY_DIR}/boost_1_34_1/stage/lib")
+  SET(ENV{CEGUIDIR}         "${MINGW_LIBRARY_DIR}/cegui-0.6.1")
+  SET(ENV{ENETDIR}          "${MINGW_LIBRARY_DIR}/enet-1.1")
+  SET(LINK_ENET_DYNAMIC     FALSE)
+  SET(ENV{ALUTDIR}          "${MINGW_LIBRARY_DIR}/freealut-1.1.0")
+  SET(ENV{OGGDIR}           "${MINGW_LIBRARY_DIR}/libogg-1.1.3;${MINGW_LIBRARY_DIR}/libogg-1.1.3/src/.libs")
+  SET(ENV{VORBISDIR}        "${MINGW_LIBRARY_DIR}/libvorbis-1.2.0;${MINGW_LIBRARY_DIR}/libvorbis-1.2.0/lib/.libs")
+  SET(ENV{OPENALDIR}        "${MINGW_LIBRARY_DIR}/openal-0.0.8/common;${MINGW_LIBRARY_DIR}/openal-0.0.8/src/.libs")
+  SET(ENV{LUA_DIR}          "${MINGW_LIBRARY_DIR}/lua-5.1.3")
+  SET(ENV{OGRE_HOME}        "${MINGW_LIBRARY_DIR}/ogre/OgreMain;${MINGW_LIBRARY_DIR}")
+  SET(ENV{OGRE_PLUGIN_DIR}  "${MINGW_LIBRARY_DIR}/ogre/Samples/Common")
+  SET(TCL_INCLUDE_PATH      "${MINGW_LIBRARY_DIR}/tcl8.5.2/generic")
+  SET(TCL_LIBRARY           "${MINGW_LIBRARY_DIR}/tcl8.5.2/win/tcl85.dll")
+  SET(ZLIB_INCLUDE_DIR      "${MINGW_LIBRARY_DIR}/zlib/include")
+  SET(ZLIB_LIBRARY          "${MINGW_LIBRARY_DIR}/zlib/libzlib.a")
+  SET(LINK_ZLIB_DYNAMIC    FALSE)
   IF ($ENV{DXSDK_DIR} STREQUAL "")
-    SET(ENV{DXSDK_DIR} "${MINGW_LIBRARY_DIR}/DXSDK")
+    SET(ENV{DXSDK_DIR}      "${MINGW_LIBRARY_DIR}/DXSDK")
   ENDIF ($ENV{DXSDK_DIR} STREQUAL "")
-
-  # MINGW doesn't like the -fPIC flag, reconfigure flags
-  SET(CMAKE_C_FLAGS   "$ENV{CFLAGS}   ${ORXONOX_WARNING_FLAGS}")
-  SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${ORXONOX_WARNING_FLAGS}")
-
-  # Also set the tolua working directory because lua.dll is not where tolua ia
-  SET(TOLUA_PARSER_WORKING_DIRECTORY "${MNGW_LIBRARY_DIR}/lua-5.1.3/lib")
-
-ENDIF (MINGW)
+ENDIF (MINGW AND LIBRARY_USE_PACKAGE_IF_SUPPORTED)
Index: /code/branches/buildsystem2/cmake/LibraryConfigTardis.cmake
===================================================================
--- /code/branches/buildsystem2/cmake/LibraryConfigTardis.cmake	(revision 2617)
+++ /code/branches/buildsystem2/cmake/LibraryConfigTardis.cmake	(revision 2618)
@@ -13,4 +13,6 @@
 IF (TARDIS)
   MESSAGE(STATUS "Running on D-ITET isg.ee Tardis Computer. Using customized paths.")
+
+  # We cannot use the default compiler (why?)
   SET(CMAKE_C_COMPILER "gcc-4.1")
   SET(CMAKE_CXX_COMPILER "g++-4.1")
Index: /code/branches/buildsystem2/cmake/UseTolua.cmake
===================================================================
--- /code/branches/buildsystem2/cmake/UseTolua.cmake	(revision 2617)
+++ /code/branches/buildsystem2/cmake/UseTolua.cmake	(revision 2618)
@@ -44,5 +44,5 @@
     DEPENDS              ${TOLUA_PARSER_DEPENDENCIES}
     IMPLICIT_DEPENDS CXX ${_tolua_inputfiles}
-    WORKING_DIRECTORY    ${TOLUA_PARSER_WORKING_DIRECTORY}
+    WORKING_DIRECTORY    ${ORXONOX_LIBRARY_BIN_DIR}
     COMMENT "Generating tolua bind files for package ${_tolua_package}"
   )
