Index: /code/branches/libs/cmake/tools/FindCEGUI.cmake
===================================================================
--- /code/branches/libs/cmake/tools/FindCEGUI.cmake	(revision 9669)
+++ /code/branches/libs/cmake/tools/FindCEGUI.cmake	(revision 9670)
@@ -31,16 +31,31 @@
 INCLUDE(HandleLibraryTypes)
 
-# Find CEGUI headers
-FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
+# Determine CEGUI's version
+FIND_FILE(CEGUI_VERSION_FILE CEGUIVersion.h Version.h
   PATHS $ENV{CEGUIDIR}
   PATH_SUFFIXES include include/CEGUI
 )
+DETERMINE_VERSION(CEGUI ${CEGUI_VERSION_FILE})
 
-# Inspect CEGUIVersion.h for the version number
-DETERMINE_VERSION(CEGUI ${CEGUI_INCLUDE_DIR}/CEGUIVersion.h)
+# Find CEGUI headers
+COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.8" _version_0_8_compare TRUE)
+# Version 0.8 introduced a new directory and file naming convention
+IF(_version_0_8_compare GREATER -1)
+  # 0.8 and newer
+  FIND_PATH(CEGUI_INCLUDE_DIR CEGUI/CEGUI.h
+    PATHS $ENV{CEGUIDIR}
+    PATH_SUFFIXES include
+  )
+ELSE()
+  # 0.8 and older
+  FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
+    PATHS $ENV{CEGUIDIR}
+    PATH_SUFFIXES include include/CEGUI
+  )
+ENDIF()
 
 # Find CEGUI library
 FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED
-  NAMES CEGUIBase CEGUI
+  NAMES CEGUIBase CEGUI CEGUIBase-0
   PATHS $ENV{CEGUIDIR}
   PATH_SUFFIXES lib bin
@@ -55,14 +70,15 @@
 
 # Find CEGUILua headers
-FIND_PATH(CEGUILUA_INCLUDE_DIR CEGUILua.h
+FIND_PATH(CEGUILUA_INCLUDE_DIR CEGUILua.h Functor.h
   PATHS
     $ENV{CEGUIDIR}
     $ENV{CEGUILUADIR}
     ${CEGUI_INCLUDE_DIR}/ScriptingModules/LuaScriptModule
+    ${CEGUI_INCLUDE_DIR}/CEGUI/ScriptModules/Lua
   PATH_SUFFIXES include include/CEGUI
 )
 # Find CEGUILua libraries
 FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
-  NAMES CEGUILua CEGUILuaScriptModule
+  NAMES CEGUILua CEGUILuaScriptModule CEGUILuaScriptModule-0
   PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
   PATH_SUFFIXES lib bin
@@ -82,4 +98,5 @@
     # For newer CEGUI versions >= 0.7
     ${CEGUILUA_INCLUDE_DIR}/support/tolua++
+    ${DEP_INCLUDE_DIR}/tolua++/include
     # For Mac OS X, tolua++ is a separate framework in the dependency package
     ${DEP_FRAMEWORK_DIR}
@@ -99,8 +116,8 @@
 
 # Newer versions of CEGUI have the renderer for OGRE shipped with them
-COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.7" _version_compare TRUE)
-IF(_version_compare GREATER -1)
+COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.7" _version_0_7_compare TRUE)
+IF(_version_0_7_compare GREATER -1)
   # Find CEGUI OGRE Renderer headers
-  FIND_PATH(CEGUI_OGRE_RENDERER_INCLUDE_DIR CEGUIOgreRenderer.h
+  FIND_PATH(CEGUI_OGRE_RENDERER_INCLUDE_DIR CEGUIOgreRenderer.h Renderer.h
     PATHS
       $ENV{CEGUIDIR}
@@ -111,5 +128,5 @@
   # Find CEGUI OGRE Renderer libraries
   FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
-    NAMES CEGUIOgreRenderer
+    NAMES CEGUIOgreRenderer CEGUIOgreRenderer-0
     PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
     PATH_SUFFIXES lib bin
Index: /code/branches/libs/src/OrxonoxConfig.h.in
===================================================================
--- /code/branches/libs/src/OrxonoxConfig.h.in	(revision 9669)
+++ /code/branches/libs/src/OrxonoxConfig.h.in	(revision 9670)
@@ -246,3 +246,7 @@
 #endif
 
+// CEGUI changed its file naming convention in version 0.8 thus we cannot even include CEGUI's Version.h file before knowing its version
+#include <@CEGUI_VERSION_FILE@>
+#define CEGUI_VERSION ((CEGUI_VERSION_MAJOR << 16) | (CEGUI_VERSION_MINOR << 8) | CEGUI_VERSION_PATCH)
+
 #endif /* _OrxonoxConfig_H__ */
Index: /code/branches/libs/src/libraries/core/CorePrereqs.h
===================================================================
--- /code/branches/libs/src/libraries/core/CorePrereqs.h	(revision 9669)
+++ /code/branches/libs/src/libraries/core/CorePrereqs.h	(revision 9670)
@@ -38,5 +38,4 @@
 #include "OrxonoxConfig.h"
 #include <boost/version.hpp>
-#include <CEGUIVersion.h>
 
 //-----------------------------------------------------------------------
Index: /code/branches/libs/src/libraries/core/GUIManager.cc
===================================================================
--- /code/branches/libs/src/libraries/core/GUIManager.cc	(revision 9669)
+++ /code/branches/libs/src/libraries/core/GUIManager.cc	(revision 9670)
@@ -36,33 +36,55 @@
 #include <OgreRenderWindow.h>
 
-#include <CEGUIDefaultLogger.h>
-#include <CEGUIExceptions.h>
-#include <CEGUIFontManager.h>
-#include <CEGUIInputEvent.h>
-#include <CEGUIMouseCursor.h>
-#include <CEGUIResourceProvider.h>
-#include <CEGUISystem.h>
-#include <CEGUIWindow.h>
-#include <CEGUIWindowManager.h>
-#include <CEGUIXMLAttributes.h>
-#include <elements/CEGUIListbox.h>
-#include <elements/CEGUIListboxItem.h>
+#if CEGUI_VERSION >= 0x000800
+#   include <CEGUI/DefaultLogger.h>
+#   include <CEGUI/Exceptions.h>
+#   include <CEGUI/FontManager.h>
+#   include <CEGUI/InputEvent.h>
+#   include <CEGUI/MouseCursor.h>
+#   include <CEGUI/ResourceProvider.h>
+#   include <CEGUI/System.h>
+#   include <CEGUI/Window.h>
+#   include <CEGUI/WindowManager.h>
+#   include <CEGUI/XMLAttributes.h>
+#   include <CEGUI/widgets/Listbox.h>
+#   include <CEGUI/widgets/ListboxItem.h>
+#else
+#   include <CEGUIDefaultLogger.h>
+#   include <CEGUIExceptions.h>
+#   include <CEGUIFontManager.h>
+#   include <CEGUIInputEvent.h>
+#   include <CEGUIMouseCursor.h>
+#   include <CEGUIResourceProvider.h>
+#   include <CEGUISystem.h>
+#   include <CEGUIWindow.h>
+#   include <CEGUIWindowManager.h>
+#   include <CEGUIXMLAttributes.h>
+#   include <elements/CEGUIListbox.h>
+#   include <elements/CEGUIListboxItem.h>
+#endif
 
 #ifdef ORXONOX_OLD_CEGUI
-#  include <CEGUILua.h>
-#  include <ogreceguirenderer/OgreCEGUIRenderer.h>
+#   include <CEGUILua.h>
+#   include <ogreceguirenderer/OgreCEGUIRenderer.h>
 extern "C" {
-#  include <lauxlib.h>
+#   include <lauxlib.h>
 }
 #else
-#  include <ScriptingModules/LuaScriptModule/CEGUILua.h>
-#  include <RendererModules/Ogre/CEGUIOgreImageCodec.h>
-#  include <RendererModules/Ogre/CEGUIOgreRenderer.h>
-#  include <RendererModules/Ogre/CEGUIOgreResourceProvider.h>
-#  include <OgreCamera.h>
-#  include <OgreRenderQueueListener.h>
-#  include <OgreRenderSystem.h>
-#  include <OgreRoot.h>
-#  include <OgreSceneManager.h>
+#   if CEGUI_VERSION >= 0x000800
+#       include <CEGUI/ScriptModules/Lua/ScriptModule.h>
+#       include <CEGUI/RendererModules/Ogre/ImageCodec.h>
+#       include <CEGUI/RendererModules/Ogre/Renderer.h>
+#       include <CEGUI/RendererModules/Ogre/ResourceProvider.h>
+#   else
+#       include <ScriptingModules/LuaScriptModule/CEGUILua.h>
+#       include <RendererModules/Ogre/CEGUIOgreImageCodec.h>
+#       include <RendererModules/Ogre/CEGUIOgreRenderer.h>
+#       include <RendererModules/Ogre/CEGUIOgreResourceProvider.h>
+#   endif
+#   include <OgreCamera.h>
+#   include <OgreRenderQueueListener.h>
+#   include <OgreRenderSystem.h>
+#   include <OgreRoot.h>
+#   include <OgreSceneManager.h>
 #endif
 
Index: /code/branches/libs/src/libraries/core/GUIManager.h
===================================================================
--- /code/branches/libs/src/libraries/core/GUIManager.h	(revision 9669)
+++ /code/branches/libs/src/libraries/core/GUIManager.h	(revision 9670)
@@ -40,6 +40,13 @@
 #include <map>
 #include <string>
-#include <CEGUIForwardRefs.h>
-#include <CEGUIVersion.h>
+
+#if CEGUI_VERSION >= 0x000800
+#   include <CEGUI/ForwardRefs.h>
+#   include <CEGUI/Version.h>
+#else
+#   include <CEGUIForwardRefs.h>
+#   include <CEGUIVersion.h>
+#endif
+
 #include <boost/shared_ptr.hpp>
 
Index: /code/branches/libs/src/libraries/util/Exception.cc
===================================================================
--- /code/branches/libs/src/libraries/util/Exception.cc	(revision 9669)
+++ /code/branches/libs/src/libraries/util/Exception.cc	(revision 9670)
@@ -36,5 +36,11 @@
 
 #include <cstddef>
-#include <CEGUIExceptions.h>
+
+#if CEGUI_VERSION >= 0x000800
+#   include <CEGUI/Exceptions.h>
+#else
+#   include <CEGUIExceptions.h>
+#endif
+
 #include "Output.h"
 
