Index: code/branches/resource2/src/OrxonoxConfig.cmake
===================================================================
--- code/branches/resource2/src/CMakeLists.txt	(revision 3373)
+++ code/branches/resource2/src/OrxonoxConfig.cmake	(revision 5664)
@@ -17,17 +17,35 @@
  #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Configures the header files OrxonoxConfig.h and SpecialConfig.h
+ #    and sets some other options. All the build related options should be
+ #    found and set here if possible.
+ #
 
-################ Various Options ################
+#################### Options ####################
 
-# various macro includes
-INCLUDE(FlagUtilities)
-INCLUDE(TargetUtilities)
+# Default linking is SHARED
+SET(ORXONOX_DEFAULT_LINK SHARED)
 
-# Use TinyXML++
-ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP")
-# OIS dynamic linking requires macro definition, at least for Windows
-ADD_COMPILER_FLAGS("-DOIS_DYNAMIC_LIB")
+# Use, i.e. don't skip the full RPATH for the build tree
+SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
 
-################ OrxonoxConfig.h ################
+# Global switch to disable Precompiled Header Files
+IF(PCH_COMPILER_SUPPORT)
+  OPTION(PCH_ENABLE "Global PCH switch" TRUE)
+ENDIF()
+
+# Enable expensive optimisations: use this for a binary release build
+OPTION(ORXONOX_RELEASE "Enable when building restributable releases" FALSE)
+
+# Use WinMain() or main()?
+IF(WIN32)
+  OPTION(ORXONOX_USE_WINMAIN "Use WinMain (doesn't show console) or main" FALSE)
+ENDIF()
+
+################ Platform Config ################
 
 # Check endianness
@@ -60,14 +78,16 @@
 ENDIF(MSVC)
 
-# Check ciso646 include (literal operators)
+# Check iso646.h include (literal operators)
 INCLUDE(CheckIncludeFileCXX)
 CHECK_INCLUDE_FILE_CXX(iso646.h HAVE_ISO646_H)
 
-# XCode and Visual Studio support multiple configurations. In order to tell the
-# which one we have to define the macros separately for each configuration
+# XCode and Visual Studio support multiple configurations. In order to tell
+# about the active one we have to define the macro for each configuration
 ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Debug"          Debug)
 ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Release"        Release)
 ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=RelWithDebInfo" RelWithDebInfo)
 ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=MinSizeRel"     MinSizeRel)
+
+############## Configured Headers ###############
 
 SET(GENERATED_FILE_COMMENT
@@ -85,65 +105,2 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/SpecialConfig.h.in
 )
-
-############## Include Directories ##############
-
-# Set the search paths for include files
-INCLUDE_DIRECTORIES(
-  # External
-  ${OGRE_INCLUDE_DIR}
-  ${CEGUI_INCLUDE_DIR}
-  ${ENET_INCLUDE_DIR}
-  ${Boost_INCLUDE_DIRS}
-  ${OPENAL_INCLUDE_DIRS}
-  ${ALUT_INCLUDE_DIR}
-  ${VORBIS_INCLUDE_DIR}
-  ${OGG_INCLUDE_DIR}
-  ${LUA_INCLUDE_DIR}
-  ${TCL_INCLUDE_PATH}
-  ${DIRECTX_INCLUDE_DIR}
-  ${ZLIB_INCLUDE_DIR}
-  ${VLD_INCLUDE_DIR}
-
-  # All library includes are prefixed with the path to avoid conflicts
-  ${CMAKE_CURRENT_SOURCE_DIR}
-  # Bullet headers really need the include directory
-  ${CMAKE_CURRENT_SOURCE_DIR}/bullet
-  # OIS headers need the root dir as well
-  ${CMAKE_CURRENT_SOURCE_DIR}/ois
-  # Convenience directory
-  ${CMAKE_CURRENT_SOURCE_DIR}/orxonox
-  # OrxonoxConfig.h
-  ${CMAKE_CURRENT_BINARY_DIR}
-  # Tolua bind files for Core
-  ${CMAKE_CURRENT_BINARY_DIR}/core/${CMAKE_CFG_INTDIR}
-  # Tolua bind files for Orxonox
-  ${CMAKE_CURRENT_BINARY_DIR}/orxonox/${CMAKE_CFG_INTDIR}
-)
-
-
-################ Sub Directories ################
-
-# Third party libraries
-ADD_SUBDIRECTORY(tolua)
-
-# Include CEGUILua if not requested otherwise
-IF(CEGUILUA_USE_INTERNAL_LIBRARY)
-  IF(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ceguilua/ceguilua-${CEGUI_VERSION})
-    MESSAGE(FATAL_ERROR "CEGUILua version not found in src folder. Update list of supported versions in LibraryConfig.cmake!")
-  ENDIF()
-
-  INCLUDE_DIRECTORIES(ceguilua/ceguilua-${CEGUI_VERSION})
-  ADD_SUBDIRECTORY(ceguilua)
-ENDIF()
-
-ADD_SUBDIRECTORY(bullet)
-ADD_SUBDIRECTORY(cpptcl)
-ADD_SUBDIRECTORY(ogreceguirenderer)
-ADD_SUBDIRECTORY(ois)
-ADD_SUBDIRECTORY(tinyxml)
-
-# Orxonox code
-ADD_SUBDIRECTORY(util)
-ADD_SUBDIRECTORY(core)
-ADD_SUBDIRECTORY(network)
-ADD_SUBDIRECTORY(orxonox)
