Index: /code/branches/buildsystem2/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem2/CMakeLists.txt	(revision 2581)
+++ /code/branches/buildsystem2/CMakeLists.txt	(revision 2582)
@@ -3,7 +3,9 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
 
-# Also forbid to use the root directory as binary directory
+############### Various Options #################
+
+# Keep devs from using the root directory as binary directory (messes up the source tree)
 IF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
-  MESSAGE(FATAL_ERROR "Do not use the root directory as CMake output directory! Mkdir a new subdir and invoke cmake ..")
+  MESSAGE(FATAL_ERROR "Do not use the root directory as CMake output directory! mkdir build; cd build; cmake ..")
 ENDIF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
 
@@ -11,5 +13,17 @@
 SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
 
-# Configre special platforms if required
+# Set binary output directories
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(LIBRARY_OUTPUT_PATH    ${PROJECT_BINARY_DIR}/bin)
+MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
+
+# 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)
+
+############## Platform Config ##################
+
+# Configre platform specific options
 INCLUDE(ConfigPlatforms)
 
@@ -23,33 +37,4 @@
 OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.")
 OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.")
-
-########## Compiler/Linker options ##############
-
-# Set binary output directories
-SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
-SET(LIBRARY_OUTPUT_PATH    ${PROJECT_BINARY_DIR}/bin)
-MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
-
-# Compiler/Linker flags.
-IF(NOT CMAKE_BUILD_TYPE)
-  SET(CMAKE_BUILD_TYPE "Debug")
-ENDIF(NOT CMAKE_BUILD_TYPE)
-#SET(CMAKE_C_FLAGS   "$ENV{CFLAGS}   -Wall -Wextra -Wno-unused-parameter")
-SET(CMAKE_C_FLAGS   "$ENV{CFLAGS}   -Wall ${ORXONOX_FPIC_FLAG}")
-#SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall -Wextra -Wno-unused-parameter")
-SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall ${ORXONOX_FPIC_FLAG}")
-SET(CMAKE_C_FLAGS_DEBUG            "-g -ggdb")
-SET(CMAKE_CXX_FLAGS_DEBUG          "-g -ggdb")
-SET(CMAKE_C_FLAGS_RELEASE          "-O3 -DNDEBUG")
-SET(CMAKE_CXX_FLAGS_RELEASE        "-O3 -DNDEBUG")
-SET(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -DNDEBUG -g -ggdb")
-SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -DNDEBUG -g -ggdb")
-SET(CMAKE_C_FLAGS_MINSIZEREL       "-Os -DNDEBUG")
-SET(CMAKE_CXX_FLAGS_MINSIZEREL     "-Os -DNDEBUG")
-
-SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}")
-SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined")
-SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined")
-SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined")
 
 ############### Library finding #################
@@ -97,5 +82,6 @@
 )
 
-# Add main source dir
+############### Orxonox Source ##################
+
 ADD_SUBDIRECTORY(src)
 ADD_SUBDIRECTORY(bin)
Index: /code/branches/buildsystem2/cmake/ConfigMSVC.cmake
===================================================================
--- /code/branches/buildsystem2/cmake/ConfigMSVC.cmake	(revision 2581)
+++ /code/branches/buildsystem2/cmake/ConfigMSVC.cmake	(revision 2582)
@@ -32,26 +32,56 @@
 
 IF (MSVC)
-  MESSAGE(STATUS "Running on MSVC. Using customized paths.")
-  SET(MSVC_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8")
+  MESSAGE(STATUS "Running on MSVC. Using customized paths and options.")
+
+  # Determine library directory
+  IF(EXISTS ${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8)
+    SET(MSVC_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8")
+  ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/../lib_dist/vc8/dependencies/orxonox_vc8)
+    SET(MSVC_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/../lib_dist/vc8/dependencies/orxonox_vc8")
+  ELSE(EXISTS ${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8)
+    MESSAGE(FATAL_ERROR "Could not find dependency directory for the Visual Studio libraries")
+  ENDIF(EXISTS ${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 variables for the include directories and the libraries
+  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)
+  # Do some hacking to avoid "Tclsh not found" message
+  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_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)
+
+
+  # Set standard compiler flags
+  SET(CMAKE_C_FLAGS   "$ENV{CFLAGS}   ${ORXONOX_WARNING_FLAGS} -fPIC")
+  SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${ORXONOX_WARNING_FLAGS} -fPIC")
+  # These flags are added to the flags above
+  SET(CMAKE_C_FLAGS_DEBUG            "    -g -ggdb")
+  SET(CMAKE_CXX_FLAGS_DEBUG          "    -g -ggdb")
+  SET(CMAKE_C_FLAGS_RELEASE          "-O3          -DNDEBUG")
+  SET(CMAKE_CXX_FLAGS_RELEASE        "-O3          -DNDEBUG")
+  SET(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g -ggdb -DNDEBUG")
+  SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -ggdb -DNDEBUG")
+  SET(CMAKE_C_FLAGS_MINSIZEREL       "-Os          -DNDEBUG")
+  SET(CMAKE_CXX_FLAGS_MINSIZEREL     "-Os          -DNDEBUG")
+
+  # Linker flags
+  SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}")
+  SET(CMAKE_EXE_LINKER_FLAGS    " --no-undefined")
+  SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined")
+  SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined")
 ENDIF (MSVC)
Index: /code/branches/buildsystem2/cmake/ConfigMinGW.cmake
===================================================================
--- /code/branches/buildsystem2/cmake/ConfigMinGW.cmake	(revision 2581)
+++ /code/branches/buildsystem2/cmake/ConfigMinGW.cmake	(revision 2582)
@@ -32,6 +32,14 @@
 
 IF (MINGW)
-  MESSAGE(STATUS "Running on MinGW. Using customized paths.")
-  SET(MINGW_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/../libs")
+  MESSAGE(STATUS "Running on MinGW. Using customized paths and options.")
+
+  # Determine library directory
+  IF(EXISTS ${CMAKE_SOURCE_DIR}/libs)
+    SET(MINGW_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/libs")
+  ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/../lis)
+    SET(MINGW_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/../libs")
+  ELSE(EXISTS ${CMAKE_SOURCE_DIR}/libs)
+    MESSAGE(FATAL_ERROR "Could not find dependency directory for the MinGW libraries")
+  ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/libs)
   MARK_AS_ADVANCED(MING_LIBRARY_DIR)
 
@@ -41,6 +49,4 @@
   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
@@ -61,7 +67,6 @@
   ENDIF (NOT ENV{DXSDK_DIR})
 
-  # MINGW doesn't like the -fPIC flag very much
-  SET(ORXONOX_FPIC_FLAG "")
+  # 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)")
 ENDIF (MINGW)
-
-#MARK_AS_ADVANCED(MINGW_LIBRARY_DIR)
Index: /code/branches/buildsystem2/cmake/ConfigPlatforms.cmake
===================================================================
--- /code/branches/buildsystem2/cmake/ConfigPlatforms.cmake	(revision 2581)
+++ /code/branches/buildsystem2/cmake/ConfigPlatforms.cmake	(revision 2582)
@@ -26,17 +26,45 @@
  #
  
-############## Platform config ################
-# Do some platform specific fiddling.
-###############################################
+# If you want to set specific options for your platform, simply
+# create a file called "ConfigUser.cmake" in the binary folder
+# (see at the bottom of the file)
 
-# Set some variables to default values that may be configured below
-SET(ENET_ADDITIONAL_LIBRARIES "")
-SET(ORXONOX_FPIC_FLAG "-fPIC")
+############ Misc Default Options ###############
+
 SET(LIBRARY_DEBUG_POSTFIX "_d")
+
+OPTION(EXTRA_WARNINGS "Enable some extra warnings (pollutes the output heavily)")
+IF(EXTRA_WARNINGS)
+  SET(ORXONOX_WARNING_FLAGS "-Wextra --Wno-unsued-parameter")
+ELSE(EXTRA_WARNINGS)
+  SET(ORXONOX_WARNING_FLAGS "-Wall")
+ENDIF(EXTRA_WARNINGS)
+
 MARK_AS_ADVANCED(
-  ENET_ADDITIONAL_LIBRARIES
-  ORXONOX_FPIC_FLAG
   LIBRARY_DEBUG_POSTFIX
+  ORXONOX_WARNINGS_FLAGS
 )
+
+###### Default Compiler/Linker Options ##########
+# Most people use GCC to compile orxonox, so use that as default
+
+SET(CMAKE_C_FLAGS   "$ENV{CFLAGS}   ${ORXONOX_WARNING_FLAGS} -fPIC")
+SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${ORXONOX_WARNING_FLAGS} -fPIC")
+# These flags are added to the flags above
+SET(CMAKE_C_FLAGS_DEBUG            "    -g -ggdb")
+SET(CMAKE_CXX_FLAGS_DEBUG          "    -g -ggdb")
+SET(CMAKE_C_FLAGS_RELEASE          "-O3          -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELEASE        "-O3          -DNDEBUG")
+SET(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g -ggdb -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -ggdb -DNDEBUG")
+SET(CMAKE_C_FLAGS_MINSIZEREL       "-Os          -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_MINSIZEREL     "-Os          -DNDEBUG")
+
+SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}")
+SET(CMAKE_EXE_LINKER_FLAGS    " --no-undefined")
+SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined")
+SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined")
+
+########## Plaform Specific Config ##############
 
 # Set the platform specific options and paths
@@ -44,2 +72,6 @@
 INCLUDE(ConfigMSVC)
 INCLUDE(ConfigMinGW)
+# User can create his own file if required
+IF(EXISTS ${CMAKE_BINARY_DIR}/ConfigUser.cmake)
+  INCLUDE(${CMAKE_BINARY_DIR}/ConfigUser)
+ENDIF(EXISTS ${CMAKE_BINARY_DIR}/ConfigUser.cmake)
Index: /code/branches/buildsystem2/cmake/FindENet.cmake
===================================================================
--- /code/branches/buildsystem2/cmake/FindENet.cmake	(revision 2581)
+++ /code/branches/buildsystem2/cmake/FindENet.cmake	(revision 2582)
@@ -47,5 +47,10 @@
 
 # Set optimized and debug libraries
-HandleLibraryTypes(ENET ${ENET_ADDITIONAL_LIBRARIES})
+IF(MINGW)
+  # ENet is linked statically, hence we need to add some windows dependencies
+  HandleLibraryTypes(ENET ws2_32 winmm)
+ELSE(MINGW)
+  HandleLibraryTypes(ENET)
+ENDIF(MINGW)
 
 MARK_AS_ADVANCED(
