Index: code/branches/buildsystem2/CMakeLists.txt
===================================================================
--- code/branches/buildsystem2/CMakeLists.txt	(revision 2578)
+++ code/branches/buildsystem2/CMakeLists.txt	(revision 2579)
@@ -11,7 +11,6 @@
 SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
 
-# Check for special include paths
-INCLUDE(ConfigTardis)
-INCLUDE(ConfigMinGW)
+# Configre special platforms if required
+INCLUDE(ConfigPlatforms)
 
 ################ Test options ###################
@@ -56,4 +55,7 @@
 ############### Library finding #################
 
+INCLUDE(FindPackageHandleStandardArgs)
+INCLUDE(HandleLibraryTypes)
+
 # Performs the search and sets the variables
 FIND_PACKAGE(OGRE REQUIRED)
@@ -81,9 +83,17 @@
 STRING(REGEX REPLACE "^.*\"Lua (.*)\".*$" "\\1" LUA_VERSION "${LUA_VERSION}")
 
-# Don't require the whole tcl rat tail
+# QUIET: Don't require the whole tcl rat tail
 FIND_PACKAGE(TCL QUIET)
 IF(NOT TCL_FOUND)
-    MESSAGE(FATAL_ERROR "Tcl not found.")
+    MESSAGE(FATAL_ERROR "Tcl was not found.")
 ENDIF(NOT TCL_FOUND)
+
+# Hide variables created by CMake FindXX scripts
+MARK_AS_ADVANCED(
+    LUA_LIBRARY_lua
+    LUA_LIBRARY_lualib
+    OPENAL_INCLUDE_DIR
+    OPENAL_LIBRARY
+)
 
 # Add main source dir
Index: code/branches/buildsystem2/cmake/ConfigMSVC.cmake
===================================================================
--- code/branches/buildsystem2/cmake/ConfigMSVC.cmake	(revision 2579)
+++ code/branches/buildsystem2/cmake/ConfigMSVC.cmake	(revision 2579)
@@ -0,0 +1,57 @@
+ #
+ #   ORXONOX - the hottest 3D action shooter ever to exist
+ #                    > www.orxonox.net <
+ #
+ #
+ #   License notice:
+ #
+ #   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
+ #   Co-authors:
+ #      ...
+ #
+ 
+############## MSVC config ################
+# Set the library directory when using precompiled tarballs for
+# the dependencies under windows (MSVC)
+###########################################
+
+IF (MSVC)
+  MESSAGE(STATUS "Running on MSVC. Using customized paths.")
+  SET(MSVC_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8")
+  MARK_AS_ADVANCED(MSVC_LIBRARY_DIR)
+
+  SET(BOOST_INCLUDEDIR ${MSVC_LIBRARY_DIR}/boost-1.35.0/include)
+  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)
+  SET(ENV{ALUTDIR}     ${MSVC_LIBRARY_DIR}/freealut-1.1.0)
+  SET(ENV{OGGDIR}      ${MSVC_LIBRARY_DIR}/libogg-1.1.3)
+  SET(ENV{VORBISDIR}   ${MSVC_LIBRARY_DIR}/libvorbis-1.2.0)
+  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)
+  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)
+  SET(TCL_FOUND TRUE)
+  SET(TCL_TCLSH        ${MSVC_LIBRARY_DIR}/tcl-8.5.2/lib/tcl85t.lib)
+  SET(TCL_TCLSH_FOUND TRUE)
+  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)
+ENDIF (MSVC)
Index: code/branches/buildsystem2/cmake/ConfigMinGW.cmake
===================================================================
--- code/branches/buildsystem2/cmake/ConfigMinGW.cmake	(revision 2578)
+++ code/branches/buildsystem2/cmake/ConfigMinGW.cmake	(revision 2579)
@@ -26,34 +26,41 @@
  #
  
-############## MinGW config ###############
-# Set the library directory when using precompiled tarballs for
-# the dependencies under windows
-###########################################
+################# MinGW config ####################
+# Set the library directory when using precompiled
+# tarballs for the dependencies under windows
+###################################################
 
 IF (MINGW)
   MESSAGE(STATUS "Running on MinGW. Using customized paths.")
   SET(MINGW_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/../libs")
+  MARK_AS_ADVANCED(MING_LIBRARY_DIR)
+
   #SET(Boost_ADDITIONAL_VERSIONS "1.36")
-  SET(BOOST_INCLUDEDIR "${MINGW_LIBRARY_DIR}/boost_1_34_1")
-  SET(BOOST_LIBRARYDIR "${MINGW_LIBRARY_DIR}/boost_1_34_1/stage/lib")
-  SET(ENV{ENETDIR} "${MINGW_LIBRARY_DIR}/enet-1.1")
-  SET(ENV{ALUTDIR} "${MINGW_LIBRARY_DIR}/freealut-1.1.0")
-  SET(ENV{OPENALDIR} "${MINGW_LIBRARY_DIR}/openal-0.0.8/common")
-  SET(ENV{LUA_DIR} "${MINGW_LIBRARY_DIR}/lua-5.1.3")
-  SET(ENV{OGGVORBISDIR} "${MINGW_LIBRARY_DIR}/oggvorbis-1.1.3-1.2.0")
-  SET(TCL_INCLUDE_PATH "${MINGW_LIBRARY_DIR}/tcl8.5.2/generic")
-  SET(TCL_LIBRARY_PATH "${MINGW_LIBRARY_DIR}/tcl8.5.2/win")
-  SET(ENV{CEGUIDIR} "${MINGW_LIBRARY_DIR}/cegui-0.6.1")
-  SET(ENV{OGREDIR} "${MINGW_LIBRARY_DIR}/ogre/OgreMain;${MINGW_LIBRARY_DIR}/ogre/Samples/Common/bin/Release")
-  SET(ZLIB_INCLUDE_DIR "${MINGW_LIBRARY_DIR}/zlib/include")
-  SET(ZLIB_LIB_DIR "${MINGW_LIBRARY_DIR}/zlib")
+  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)
+  # ENet is linked statically, hence we need to add some windows dependencies
+  SET(ENet_ADDITIONAL_LIBRARIES ws2_32 winmm)
+  SET(ENV{ALUTDIR}     ${MINGW_LIBRARY_DIR}/freealut-1.1.0)
+  SET(ENV{OGGSDIR}     ${MINGW_LIBRARY_DIR}/libogg-1.1.3
+                       ${MINGW_LIBRARY_DIR}/libogg-1.1.3/src/.libs)
+  SET(ENV{VORBISDIR}   ${MINGW_LIBRARY_DIR}/libogg-1.1.3
+                       ${MINGW_LIBRARY_DIR}/libvorbis-1.2.0/src/.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/bin/Release)
+  SET(TCL_INCLUDE_PATH ${MINGW_LIBRARY_DIR}/tcl8.5.2/generic)
+  SET(TCL_LIBRARY_PATH ${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)
   IF (NOT ENV{DXSDK_DIR})
-    SET(ENV{DXSDK_DIR} "${MINGW_LIBRARY_DIR}/DXSDK")
+    SET(ENV{DXSDK_DIR} ${MINGW_LIBRARY_DIR}/DXSDK)
   ENDIF (NOT ENV{DXSDK_DIR})
 
   # MINGW doesn't like the -fPIC flag very much
   SET(ORXONOX_FPIC_FLAG "")
-ELSE (MINGW)
-  SET(ORXONOX_FPIC_FLAG "-fPIC")
 ENDIF (MINGW)
 
Index: code/branches/buildsystem2/cmake/ConfigPlatforms.cmake
===================================================================
--- code/branches/buildsystem2/cmake/ConfigPlatforms.cmake	(revision 2579)
+++ code/branches/buildsystem2/cmake/ConfigPlatforms.cmake	(revision 2579)
@@ -0,0 +1,45 @@
+ #
+ #   ORXONOX - the hottest 3D action shooter ever to exist
+ #                    > www.orxonox.net <
+ #
+ #
+ #   License notice:
+ #
+ #   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
+ #   Co-authors:
+ #      ...
+ #
+ 
+############## Platform config ################
+# Do some platform specific fiddling.
+###############################################
+
+# Set some variables to default values that may be configured below
+SET(ENet_ADDITIONAL_LIBRARIES "")
+SET(ORXONOX_FPIC_FLAG "-fPIC")
+SET(LIBRARY_DEBUG_POSTFIX "_d")
+MARK_AS_ADVANCED(
+  ENet_ADDITIONAL_LIBRARIES
+  ORXONOX_FPIC_FLAG
+  LIBRARY_DEBUG_POSTFIX
+)
+
+# Set the platform specific options and paths
+INCLUDE(ConfigTardis)
+INCLUDE(ConfigMSVC)
+INCLUDE(ConfigMinGW)
Index: code/branches/buildsystem2/cmake/ConfigTardis.cmake
===================================================================
--- code/branches/buildsystem2/cmake/ConfigTardis.cmake	(revision 2578)
+++ code/branches/buildsystem2/cmake/ConfigTardis.cmake	(revision 2579)
@@ -16,14 +16,24 @@
   SET(CMAKE_C_COMPILER "gcc-4.1")
   SET(CMAKE_CXX_COMPILER "g++-4.1")
+
   #SET(Boost_ADDITIONAL_VERSIONS "1.36")
-  SET(BOOST_INCLUDEDIR "/usr/pack/boost-1.34.1-sd/include")
-  SET(BOOST_LIBRARYDIR "/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/lib")
-  SET(ENV{LUA_DIR} "/usr/pack/lua-5.0.3-sd;/usr/pack/lua-5.0.3-sd/i686-debian-linux3.1")
-  SET(ENV{ALUTDIR} "/usr/pack/openal-0.0.8-cl;/usr/pack/openal-0.0.8-cl/i686-debian-linux3.1")
-  SET(ENV{OPENALDIR} "/usr/pack/openal-0.0.8-cl;/usr/pack/openal-0.0.8-cl/i686-debian-linux3.1")
-  SET(ENV{ENETDIR} "/usr/pack/enet-2007-sd;/usr/pack/enet-2007-sd/i686-debian-linux3.1")
-  SET(ENV{OGGVORBISDIR} "/usr/pack/oggvorbis-1.0-ds;/usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.0")
-  #SET(TCL_INCLUDE_PATH "/usr/pack/tcltk-8.4.9.linux-mo/include")
-  SET(ENV{CEGUIDIR} "/usr/pack/cegui-0.5.0-sd;/usr/pack/cegui-0.5.0-sd/i686-debian-linux3.1")
-  SET(ENV{OGREDIR} "/usr/pack/ogre-1.4.5-sd;/usr/pack/ogre-1.4.5-sd/i686-debian-linux3.1")
+  SET(BOOST_INCLUDEDIR /usr/pack/boost-1.34.1-sd/include)
+  SET(BOOST_LIBRARYDIR /usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/lib)
+  SET(ENV{CEGUIDIR}    /usr/pack/cegui-0.5.0-sd
+                       /usr/pack/cegui-0.5.0-sd/i686-debian-linux3.1)
+  SET(ENV{ENETDIR}     /usr/pack/enet-2007-sd
+                       /usr/pack/enet-2007-sd/i686-debian-linux3.1)
+  SET(ENV{ALUTDIR}     /usr/pack/openal-0.0.8-cl
+                       /usr/pack/openal-0.0.8-cl/i686-debian-linux3.1)
+  SET(ENV{OGGDIR}      /usr/pack/oggvorbis-1.0-ds
+                       /usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.0)
+  SET(ENV{VORBISDIR}   /usr/pack/oggvorbis-1.0-ds
+                       /usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.0)
+  SET(ENV{LUA_DIR}     /usr/pack/lua-5.0.3-sd
+                       /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1)
+  SET(ENV{OGRE_HOME}   /usr/pack/ogre-1.4.5-sd
+                       /usr/pack/ogre-1.4.5-sd/i686-debian-linux3.1)
+  SET(ENV{OPENALDIR}   /usr/pack/openal-0.0.8-cl
+                       /usr/pack/openal-0.0.8-cl/i686-debian-linux3.1)
+  #SET(TCL_INCLUDE_PATH /usr/pack/tcltk-8.4.9.linux-mo/include)
 ENDIF (IS_TARDIS)
Index: code/branches/buildsystem2/cmake/FindALUT.cmake
===================================================================
--- code/branches/buildsystem2/cmake/FindALUT.cmake	(revision 2578)
+++ code/branches/buildsystem2/cmake/FindALUT.cmake	(revision 2579)
@@ -21,18 +21,22 @@
 #                 > www.orxonox.net <
 
+SET(ALUT_PATHS
+  $ENV{ALUTDIR}
+  /usr/local
+  /usr
+  /sw        # Fink
+  /opt/local # DarwinPorts
+  /opt/csw   # Blastwave
+  /opt
+)
+
 FIND_PATH(ALUT_INCLUDE_DIR AL/alut.h
   PATHS
-  $ENV{ALUTDIR}
+  ${ALUT_PATHS}
   ~/Library/Frameworks/OpenAL.framework
   /Library/Frameworks/OpenAL.framework
   /System/Library/Frameworks/OpenAL.framework # Tiger
-  /usr/local
-  /usr
-  /sw # Fink
-  /opt/local # DarwinPorts
-  /opt/csw # Blastwave
-  /opt
   PATH_SUFFIXES include include/OpenAL include/AL Headers
-  )
+)
 
 # I'm not sure if I should do a special casing for Apple. It is
@@ -41,4 +45,5 @@
 # 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"
@@ -46,10 +51,10 @@
       )
     # String is in default search path, don't need to use -F
-    SET (ALUT_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
+    SET (ALUT_LIBRARY_OPTIMIZED "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
   ELSE("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
       OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
       )
     # String is not /Library/Frameworks, need to use -F
-    SET(ALUT_LIBRARY "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
+    SET(ALUT_LIBRARY_OPTIMIZED "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
   ENDIF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
     OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
@@ -59,22 +64,30 @@
 
 ELSE(${ALUT_INCLUDE_DIR} MATCHES ".framework")
-  FIND_LIBRARY(ALUT_LIBRARY
+  FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED
     NAMES alut
-    PATHS
-    $ENV{ALUTDIR}
-    /usr/local
-    /usr
-    /sw
-    /opt/local
-    /opt/csw
-    /opt
+    PATHS ${ALUT_PATHS}
     PATH_SUFFIXES lib libs
-    )
+  )
+  FIND_LIBRARY(ALUT_LIBRARY_DEBUG
+    NAMES alut_${LIBRARY_DEBUG_POSTFIX}
+    PATHS ${ALUT_PATHS}
+    PATH_SUFFIXES lib libs
+  )
 ENDIF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
 
 # handle the QUIETLY and REQUIRED arguments and set ALUT_FOUND to TRUE if
 # all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALUT DEFAULT_MSG ALUT_LIBRARY ALUT_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALUT DEFAULT_MSG
+    ALUT_LIBRARY_OPTIMIZED
+    ALUT_INCLUDE_DIR
+)
 
-MARK_AS_ADVANCED(ALUT_LIBRARY ALUT_INCLUDE_DIR)
+# Set optimized and debug libraries
+HandleLibraryTypes(ALUT)
+
+MARK_AS_ADVANCED(
+    ALUT_LIBRARY
+    ALUT_LIBRARY_OPTIMIZED
+    ALUT_LIBRARY_DEBUG
+    ALUT_INCLUDE_DIR
+)
Index: code/branches/buildsystem2/cmake/FindCEGUI.cmake
===================================================================
--- code/branches/buildsystem2/cmake/FindCEGUI.cmake	(revision 2578)
+++ code/branches/buildsystem2/cmake/FindCEGUI.cmake	(revision 2579)
@@ -26,35 +26,20 @@
     PATH_SUFFIXES include include/CEGUI
 )
-
-IF(WIN32)
-    FIND_LIBRARY(CEGUI_LIBRARY_
-        NAMES CEGUIBase
-        PATHS
-        $ENV{CEGUIDIR}
-        PATH_SUFFIXES lib
-    )
-    FIND_LIBRARY(CEGUI_LIBRARY_d
-        NAMES CEGUIBase_d
-        PATHS
-        $ENV{CEGUIDIR}
-        PATH_SUFFIXES lib
-    )
-    IF(CEGUI_LIBRARY_)
-        IF(CEGUI_LIBRARY_d)
-            SET(CEGUI_LIBRARY optimized ${CEGUI_LIBRARY_} debug ${CEGUI_LIBRARY_d})
-        ELSE(CEGUI_LIBRARY_d)
-            SET(CEGUI_LIBRARY ${CEGUI_LIBRARY_})
-        ENDIF(CEGUI_LIBRARY_d)
-    ENDIF(CEGUI_LIBRARY_)
-ELSE(WIN32)
-    FIND_LIBRARY(CEGUI_LIBRARY
-        NAMES CEGUIBase
-        PATHS
-        $ENV{CEGUIDIR}
-        /usr/local
-        /usr
-        PATH_SUFFIXES lib
-    )
-ENDIF(WIN32)
+FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED
+    NAMES CEGUIBase
+    PATHS
+    $ENV{CEGUIDIR}
+    /usr/local
+    /usr
+    PATH_SUFFIXES lib
+)
+FIND_LIBRARY(CEGUI_LIBRARY_DEBUG
+    NAMES CEGUIBase_${LIBRARY_DEBUG_POSTFIX}
+    PATHS
+    $ENV{CEGUIDIR}
+    /usr/local
+    /usr
+    PATH_SUFFIXES lib
+)
 
 # Look in CEGUIVersion.h for the version number
@@ -85,17 +70,19 @@
 #    ENDIF (NOT CEGUI_SCRIPT_LIBDIR)
 
-INCLUDE(FindPackageHandleStandardArgs)
+
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(CEGUI DEFAULT_MSG
-    CEGUI_LIBRARY
+    CEGUI_LIBRARY_OPTIMIZED
     CEGUI_INCLUDE_DIR
     #CEGUI_SCRIPT_LIBRARIES
 )
 
+# Set optimized and debug libraries
+HandleLibraryTypes(CEGUI)
+
 MARK_AS_ADVANCED(
     CEGUI_LIBRARY
-    CEGUI_LIBRARY_
-    CEGUI_LIBRARY_d
+    CEGUI_LIBRARY_OPTIMIZED
+    CEGUI_LIBRARY_DEBUG
     CEGUI_INCLUDE_DIR
-    CEGUI_VERSION
     #CEGUI_SCRIPT_LIBRARIES
 )
Index: code/branches/buildsystem2/cmake/FindDirectX.cmake
===================================================================
--- code/branches/buildsystem2/cmake/FindDirectX.cmake	(revision 2578)
+++ code/branches/buildsystem2/cmake/FindDirectX.cmake	(revision 2579)
@@ -1,8 +1,8 @@
 IF(WIN32)
-  # - Test for DirectX
+  # Find script for DirectX on Windows
   # Once loaded this will define
   #   DirectX_FOUND        - system has DirectX
   #   DirectX_INCLUDE_DIR  - include directory for DirectX
-  #   DirectX_LIB_DIR      - lib directory for DirectX
+  #   DirectX_LIBRARY      - library for DirectX
   #
   # Several changes and additions by Fabian 'x3n' Landau
@@ -12,8 +12,13 @@
     PATHS
     $ENV{DXSDK_DIR}
-    PATH_SUFFIXES include Include
+    PATH_SUFFIXES include
   )
 
-  FIND_PATH(DirectX_LIB_DIR dinput8.lib
+  FIND_LIBRARY(DirectX_LIBRARY_1 dinput8
+    PATHS
+    $ENV{DXSDK_DIR}
+    PATH_SUFFIXES lib Lib lib/x86 Lib/x86
+  )
+  FIND_LIBRARY(DirectX_LIBRARY_2 dxguid
     PATHS
     $ENV{DXSDK_DIR}
@@ -21,8 +26,15 @@
   )
 
-  INCLUDE(FindPackageHandleStandardArgs)
-  FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectX DEFAULT_MSG DirectX_INCLUDE_DIR DirectX_LIB_DIR)
+  FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectX DEFAULT_MSG DirectX_INCLUDE_DIR DirectX_LIBRARY_1 DirectX_LIBRARY_2)
 
+  IF(DIRECTX_FOUND)
+    SET(DirectX_LIBRARIES ${DirectX_LIBRARY_1} ${DirectX_LIBRARY_2} CACHE STRING "DirectX library files" FORCE)
+  ENDIF(DIRECTX_FOUND)
 ENDIF(WIN32)
 
-MARK_AS_ADVANCED(DirectX_INCLUDE_DIR DirectX_LIB_DIR)
+MARK_AS_ADVANCED(
+  DirectX_INCLUDE_DIR
+  DirectX_LIBRARY_1
+  DirectX_LIBRARY_2
+  DirectX_LIBRARIES
+)
Index: code/branches/buildsystem2/cmake/FindENet.cmake
===================================================================
--- code/branches/buildsystem2/cmake/FindENet.cmake	(revision 2578)
+++ code/branches/buildsystem2/cmake/FindENet.cmake	(revision 2579)
@@ -21,7 +21,6 @@
     /usr
     PATH_SUFFIXES include
-    )
-
-FIND_LIBRARY(ENet_LIBRARY
+)
+FIND_LIBRARY(ENet_LIBRARY_OPTIMIZED
     NAMES enet
     PATHS
@@ -30,19 +29,28 @@
     /usr
     PATH_SUFFIXES lib
-    )
+)
+FIND_LIBRARY(ENet_LIBRARY_DEBUG
+    NAMES enet_${LIBRARY_DEBUG_POSTFIX}
+    PATHS
+    $ENV{ENETDIR}
+    /usr/local
+    /usr
+    PATH_SUFFIXES lib
+)
 
 # handle the QUIETLY and REQUIRED arguments and set ENET_FOUND to TRUE if
 # all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ENet DEFAULT_MSG ENet_LIBRARY ENet_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ENet DEFAULT_MSG
+    ENet_LIBRARY_OPTIMIZED
+    ENet_INCLUDE_DIR
+)
 
-IF (ENET_FOUND)
-    IF(WIN32)
-        SET(WINDOWS_ENET_DEPENDENCIES "ws2_32;winmm")
-        SET(ENet_LIBRARIES ${ENet_LIBRARY} ${WINDOWS_ENET_DEPENDENCIES})
-    ELSE(WIN32)
-        SET(ENet_LIBRARIES ${ENet_LIBRARY})
-    ENDIF(WIN32)
-ENDIF (ENET_FOUND)
+# Set optimized and debug libraries
+HandleLibraryTypes(ENet ${ENet_ADDITIONAL_LIBRARIES})
 
-MARK_AS_ADVANCED(ENet_LIBRARY ENet_LIBRARIES ENet_INCLUDE_DIR)
+MARK_AS_ADVANCED(
+    ENet_LIBRARY
+    ENet_LIBRARY_OPTIMIZED
+    ENet_LIBRARY_DEBUG
+    ENet_INCLUDE_DIR
+)
Index: code/branches/buildsystem2/cmake/FindOGRE.cmake
===================================================================
--- code/branches/buildsystem2/cmake/FindOGRE.cmake	(revision 2578)
+++ code/branches/buildsystem2/cmake/FindOGRE.cmake	(revision 2579)
@@ -17,5 +17,4 @@
 FIND_PATH(OGRE_INCLUDE_DIR Ogre.h
     PATHS
-    $ENV{OGREDIR}
     $ENV{OGRE_HOME}
     /usr/local
@@ -23,49 +22,33 @@
     PATH_SUFFIXES include include/OGRE
 )
+FIND_LIBRARY(OGRE_LIBRARY_OPTIMIZED
+    NAMES OgreMain
+    PATHS
+    $ENV{OGRE_HOME}
+    /usr/local
+    /usr
+    PATH_SUFFIXES lib
+)
+FIND_LIBRARY(OGRE_LIBRARY_DEBUG
+    NAMES OgreMain_${LIBRARY_DEBUG_POSTFIX}
+    PATHS
+    $ENV{OGRE_HOME}
+    /usr/local
+    /usr
+    PATH_SUFFIXES lib
+)
 
-IF(WIN32)
-    FIND_LIBRARY(OGRE_LIBRARY_
-        NAMES OgreMain
-        PATHS
-        $ENV{OGREDIR}
-        $ENV{OGRE_HOME}
-        PATH_SUFFIXES lib
-    )
-    FIND_LIBRARY(OGRE_LIBRARY_d
-        NAMES OgreMain_d
-        PATHS
-        $ENV{OGREDIR}
-        $ENV{OGRE_HOME}
-        PATH_SUFFIXES lib
-    )
-    IF(OGRE_LIBRARY_)
-        IF(OGRE_LIBRARY_d)
-            SET(OGRE_LIBRARY optimized ${OGRE_LIBRARY_} debug ${OGRE_LIBRARY_d})
-        ELSE(OGRE_LIBRARY_d)
-            SET(OGRE_LIBRARY ${OGRE_LIBRARY_})
-        ENDIF(OGRE_LIBRARY_d)
-    ENDIF(OGRE_LIBRARY_)
-ELSE(WIN32)
-    FIND_LIBRARY(OGRE_LIBRARY
-        NAMES OgreMain
-        PATHS
-        $ENV{OGREDIR}
-        $ENV{OGRE_HOME}
-        /usr/local
-        /usr
-        PATH_SUFFIXES lib
-    )
-ENDIF(WIN32)
-
-INCLUDE(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OGRE DEFAULT_MSG
-    OGRE_LIBRARY
+    OGRE_LIBRARY_OPTIMIZED
     OGRE_INCLUDE_DIR
 )
 
+# Set optimized and debug libraries
+HandleLibraryTypes(OGRE)
+
 MARK_AS_ADVANCED(
     OGRE_LIBRARY
-    OGRE_LIBRARY_
-    OGRE_LIBRARY_d
+    OGRE_LIBRARY_OPTIMIZED
+    OGRE_LIBRARY_DEBUG
     OGRE_INCLUDE_DIR
 )
Index: code/branches/buildsystem2/cmake/FindOggVorbis.cmake
===================================================================
--- code/branches/buildsystem2/cmake/FindOggVorbis.cmake	(revision 2578)
+++ code/branches/buildsystem2/cmake/FindOggVorbis.cmake	(revision 2579)
@@ -11,5 +11,6 @@
 #  VORBISFILE_LIBRARY
 #
-# $OGGVORBISDIR is an environment variable used for finding ogg/vorbis.
+# $OGGDIR and $VORBISDIR are environment variables used
+# for finding ogg/vorbis.
 #
 # Several changes and additions by Fabian 'x3n' Landau
@@ -18,5 +19,6 @@
 
 SET(OGG_SEARCH_PATHS
-  $ENV{OGGVORBISDIR}
+  $ENV{OGGDIR}
+  $ENV{VORBISDIR}
   /usr/local
   /usr
@@ -31,26 +33,29 @@
   PATH_SUFFIXES include
 )
-
 FIND_PATH(VORBIS_INCLUDE_DIR vorbis/codec.h
   PATHS ${OGG_SEARCH_PATHS}
   PATH_SUFFIXES include
 )
-
-FIND_LIBRARY(OGG_LIBRARY NAMES ogg
+FIND_LIBRARY(OGG_LIBRARY_OPTIMIZED NAMES ogg
   PATHS ${OGG_SEARCH_PATHS}
   PATH_SUFFIXES lib
 )
-
-FIND_LIBRARY(VORBIS_LIBRARY NAMES vorbis
+FIND_LIBRARY(OGG_LIBRARY_DEBUG NAMES ogg_${LIBRARY_DEBUG_POSTFIX}
   PATHS ${OGG_SEARCH_PATHS}
   PATH_SUFFIXES lib
 )
-
-#FIND_LIBRARY(VORBISENC_LIBRARY NAMES vorbisenc
-#  PATHS ${OGG_SEARCH_PATHS}
-#  PATH_SUFFIXES lib
-#)
-
-FIND_LIBRARY(VORBISFILE_LIBRARY NAMES vorbisfile
+FIND_LIBRARY(VORBIS_LIBRARY_OPTIMIZED NAMES vorbis
+  PATHS ${OGG_SEARCH_PATHS}
+  PATH_SUFFIXES lib
+)
+FIND_LIBRARY(VORBIS_LIBRARY_DEBUG NAMES vorbis_${LIBRARY_DEBUG_POSTFIX}
+  PATHS ${OGG_SEARCH_PATHS}
+  PATH_SUFFIXES lib
+)
+FIND_LIBRARY(VORBISFILE_LIBRARY_OPTIMIZED NAMES vorbisfile
+  PATHS ${OGG_SEARCH_PATHS}
+  PATH_SUFFIXES lib
+)
+FIND_LIBRARY(VORBISFILE_LIBRARY_DEBUG NAMES vorbisfile_${LIBRARY_DEBUG_POSTFIX}
   PATHS ${OGG_SEARCH_PATHS}
   PATH_SUFFIXES lib
@@ -59,19 +64,30 @@
 # handle the QUIETLY and REQUIRED arguments and set *_FOUND to TRUE if
 # all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(OGG DEFAULT_MSG OGG_LIBRARY OGG_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OGG DEFAULT_MSG
+  OGG_LIBRARY_OPTIMIZED
+  OGG_INCLUDE_DIR
+)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(VORBIS DEFAULT_MSG
-  VORBIS_LIBRARY
-  VORBISFILE_LIBRARY
-  #VORBISENC_LIBRARY
+  VORBIS_LIBRARY_OPTIMIZED
+  VORBISFILE_LIBRARY_OPTIMIZED
   VORBIS_INCLUDE_DIR
 )
 
+# Set optimized and debug libraries
+HandleLibraryTypes(OGG)
+HandleLibraryTypes(VORBIS)
+HandleLibraryTypes(VORBISFILE)
+
 MARK_AS_ADVANCED(
   OGG_LIBRARY
+  OGG_LIBRARY_OPTIMIZED
+  OGG_LIBRARY_DEBUG
   OGG_INCLUDE_DIR
   VORBIS_LIBRARY
+  VORBIS_LIBRARY_OPTIMIZED
+  VORBIS_LIBRARY_DEBUG
   VORBISFILE_LIBRARY
-  #VORBISENC_LIBRARY
+  VORBISFILE_LIBRARY_OPTIMIZED
+  VORBISFILE_LIBRARY_DEBUG
   VORBIS_INCLUDE_DIR
 )
Index: code/branches/buildsystem2/cmake/HandleLibraryTypes.cmake
===================================================================
--- code/branches/buildsystem2/cmake/HandleLibraryTypes.cmake	(revision 2579)
+++ code/branches/buildsystem2/cmake/HandleLibraryTypes.cmake	(revision 2579)
@@ -0,0 +1,44 @@
+ #
+ #   ORXONOX - the hottest 3D action shooter ever to exist
+ #                    > www.orxonox.net <
+ #
+ #
+ #   License notice:
+ #
+ #   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
+ #   Co-authors:
+ #      ...
+ #
+
+MACRO(HandleLibraryTypes _name)
+  # Additional libraries can be added as additional arguments
+  IF(${_name}_FOUND)
+    IF(${_name}_LIBRARY_DEBUG)
+      SET(${_name}_LIBRARY
+          OPTIMIZED ${${_name}_LIBRARY_OPTIMIZED} ${ARGN}
+          DEBUG     ${${_name}_LIBRARY_DEBUG}     ${ARGN}
+          CACHE STRING "${_name} library file(s)" FORCE
+      )
+    ELSE(${_name}_LIBRARY_DEBUG)
+      SET(${_name}_LIBRARY
+          ${${_name}_LIBRARY_OPTIMIZED} ${ARGN}
+          CACHE STRING "${_name} library file(s)" FORCE
+      )
+    ENDIF(${_name}_LIBRARY_DEBUG)
+  ENDIF(${_name}_FOUND)
+ENDMACRO(HandleLibraryTypes)
Index: code/branches/buildsystem2/src/audio/CMakeLists.txt
===================================================================
--- code/branches/buildsystem2/src/audio/CMakeLists.txt	(revision 2578)
+++ code/branches/buildsystem2/src/audio/CMakeLists.txt	(revision 2579)
@@ -21,3 +21,5 @@
 )
 
-INSTALL(TARGETS audio LIBRARY DESTINATION lib)
+IF (NOT WIN32)
+  INSTALL(TARGETS audio LIBRARY DESTINATION lib)
+ENDIF (NOT WIN32)
Index: code/branches/buildsystem2/src/ceguilua-0.5.0/ceguilua/CMakeLists.txt
===================================================================
--- code/branches/buildsystem2/src/ceguilua-0.5.0/ceguilua/CMakeLists.txt	(revision 2578)
+++ code/branches/buildsystem2/src/ceguilua-0.5.0/ceguilua/CMakeLists.txt	(revision 2579)
@@ -14,3 +14,5 @@
 )
 
-INSTALL(TARGETS ceguilua_orxonox LIBRARY DESTINATION lib)
+IF (NOT WIN32)
+  INSTALL(TARGETS ceguilua_orxonox LIBRARY DESTINATION lib)
+ENDIF (NOT WIN32)
Index: code/branches/buildsystem2/src/ceguilua-0.6.1/ceguilua/CMakeLists.txt
===================================================================
--- code/branches/buildsystem2/src/ceguilua-0.6.1/ceguilua/CMakeLists.txt	(revision 2578)
+++ code/branches/buildsystem2/src/ceguilua-0.6.1/ceguilua/CMakeLists.txt	(revision 2579)
@@ -14,3 +14,5 @@
 )
 
-INSTALL(TARGETS ceguilua_orxonox LIBRARY DESTINATION lib)
+IF (NOT WIN32)
+  INSTALL(TARGETS ceguilua_orxonox LIBRARY DESTINATION lib)
+ENDIF (NOT WIN32)
Index: code/branches/buildsystem2/src/core/CMakeLists.txt
===================================================================
--- code/branches/buildsystem2/src/core/CMakeLists.txt	(revision 2578)
+++ code/branches/buildsystem2/src/core/CMakeLists.txt	(revision 2579)
@@ -63,3 +63,5 @@
 )
 
-INSTALL(TARGETS core LIBRARY DESTINATION lib)
+IF (NOT WIN32)
+  INSTALL(TARGETS core LIBRARY DESTINATION lib)
+ENDIF (NOT WIN32)
Index: code/branches/buildsystem2/src/cpptcl/CMakeLists.txt
===================================================================
--- code/branches/buildsystem2/src/cpptcl/CMakeLists.txt	(revision 2578)
+++ code/branches/buildsystem2/src/cpptcl/CMakeLists.txt	(revision 2579)
@@ -5,3 +5,5 @@
 )
 
-INSTALL(TARGETS cpptcl_orxonox LIBRARY DESTINATION lib)
+IF (NOT WIN32)
+  INSTALL(TARGETS cpptcl_orxonox LIBRARY DESTINATION lib)
+ENDIF (NOT WIN32)
Index: code/branches/buildsystem2/src/network/CMakeLists.txt
===================================================================
--- code/branches/buildsystem2/src/network/CMakeLists.txt	(revision 2578)
+++ code/branches/buildsystem2/src/network/CMakeLists.txt	(revision 2579)
@@ -31,5 +31,7 @@
 )
 
-INSTALL(TARGETS network LIBRARY DESTINATION lib)
+IF (NOT WIN32)
+  INSTALL(TARGETS network LIBRARY DESTINATION lib)
+ENDIF (NOT WIN32)
 
 # build those parts only on request.
@@ -43,5 +45,5 @@
     ${OGRE_LIBRARY}
     network
-    ${ENet_LIBRARIES}
+    ${ENet_LIBRARY}
     ${ZLIB_LIBRARY}
   )
Index: code/branches/buildsystem2/src/ogreceguirenderer/CMakeLists.txt
===================================================================
--- code/branches/buildsystem2/src/ogreceguirenderer/CMakeLists.txt	(revision 2578)
+++ code/branches/buildsystem2/src/ogreceguirenderer/CMakeLists.txt	(revision 2579)
@@ -6,3 +6,6 @@
 
 ADD_LIBRARY(ogreceguirenderer_orxonox SHARED ${SRC_FILES})
-INSTALL(TARGETS ogreceguirenderer_orxonox LIBRARY DESTINATION lib)
+
+IF (NOT WIN32)
+  INSTALL(TARGETS ogreceguirenderer_orxonox LIBRARY DESTINATION lib)
+ENDIF (NOT WIN32)
Index: code/branches/buildsystem2/src/ois/CMakeLists.txt
===================================================================
--- code/branches/buildsystem2/src/ois/CMakeLists.txt	(revision 2578)
+++ code/branches/buildsystem2/src/ois/CMakeLists.txt	(revision 2579)
@@ -1,2 +1,4 @@
+INCLUDE_DIRECTORIES(.)
+
 SET( OIS_SRC_FILES
   OISEffect.cpp
@@ -39,10 +41,5 @@
 
 IF(WIN32)
-  LINK_DIRECTORIES(${DirectX_LIB_DIR})
-  TARGET_LINK_LIBRARIES( ois_orxonox
-    dxguid
-    dinput8
-  )
+  TARGET_LINK_LIBRARIES( ois_orxonox ${DirectX_LIBRARIES} )
 ENDIF(WIN32)
 
-INSTALL(TARGETS ois_orxonox LIBRARY DESTINATION lib)
Index: code/branches/buildsystem2/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/buildsystem2/src/orxonox/CMakeLists.txt	(revision 2578)
+++ code/branches/buildsystem2/src/orxonox/CMakeLists.txt	(revision 2579)
@@ -49,3 +49,5 @@
 )
 
-INSTALL(TARGETS orxonox RUNTIME DESTINATION bin)
+IF (NOT WIN32)
+  INSTALL(TARGETS orxonox RUNTIME DESTINATION bin)
+ENDIF (NOT WIN32)
Index: code/branches/buildsystem2/src/tinyxml/CMakeLists.txt
===================================================================
--- code/branches/buildsystem2/src/tinyxml/CMakeLists.txt	(revision 2578)
+++ code/branches/buildsystem2/src/tinyxml/CMakeLists.txt	(revision 2579)
@@ -8,3 +8,6 @@
 
 ADD_LIBRARY(tinyxml_orxonox SHARED ${TINYXML_SRC_FILES})
-INSTALL(TARGETS tinyxml_orxonox LIBRARY DESTINATION lib)
+
+IF (NOT WIN32)
+  INSTALL(TARGETS tinyxml_orxonox LIBRARY DESTINATION lib)
+ENDIF (NOT WIN32)
Index: code/branches/buildsystem2/src/tolua/CMakeLists.txt
===================================================================
--- code/branches/buildsystem2/src/tolua/CMakeLists.txt	(revision 2578)
+++ code/branches/buildsystem2/src/tolua/CMakeLists.txt	(revision 2579)
@@ -7,5 +7,7 @@
 )
 
-#INSTALL(TARGETS tolualib_orxonox LIBRARY DESTINATION lib)
+IF (NOT WIN32)
+#  INSTALL(TARGETS tolualib_orxonox LIBRARY DESTINATION lib)
+ENDIF (NOT WIN32)
 
 SET(TOLUAGEN_SRC_FILES
Index: code/branches/buildsystem2/src/util/CMakeLists.txt
===================================================================
--- code/branches/buildsystem2/src/util/CMakeLists.txt	(revision 2578)
+++ code/branches/buildsystem2/src/util/CMakeLists.txt	(revision 2579)
@@ -15,3 +15,6 @@
 ADD_LIBRARY(util SHARED ${UTIL_SRC_FILES})
 TARGET_LINK_LIBRARIES(util ${OGRE_LIBRARY})
-INSTALL(TARGETS util LIBRARY DESTINATION lib)
+
+IF (NOT WIN32)
+  INSTALL(TARGETS util LIBRARY DESTINATION lib)
+ENDIF (NOT WIN32)
