Index: code/branches/kicklib2/cmake/BundleConfig.cmake
===================================================================
--- code/branches/kicklib2/cmake/BundleConfig.cmake	(revision 8285)
+++ code/branches/kicklib2/cmake/BundleConfig.cmake	(revision 8285)
@@ -0,0 +1,65 @@
+#
+#             ORXONOX - the hottest 3D action shooter ever to exist
+#                             > www.orxonox.net <
+#
+#        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:
+#    Kevin Young
+#  Description:
+#    Sets all necessary variables for CPack package generation
+#
+
+# Common properties across all generators
+
+#SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY FALSE)
+SET(CPACK_INSTALL_CMAKE_PROJECTS ${CMAKE_BINARY_DIR};${PROJECT_NAME};ALL;/)
+SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME}")
+SET(CPACK_PACKAGE_EXECUTABLES ${ORXONOX_EXECUTABLE_NAME};${PROJECT_NAME})
+SET(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}")
+SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${ORXONOX_VERSION_NAME}")
+SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PROJECT_NAME} ${ORXONOX_VERSION}")
+# Defaults to PROJECT_NAME anyway
+#SET(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
+SET(CPACK_PACKAGE_VENDOR "www.orxonox.net")
+SET(CPACK_PACKAGE_VERSION_MAJOR ${ORXONOX_VERSION_MAJOR})
+SET(CPACK_PACKAGE_VERSION_MINOR ${ORXONOX_VERSION_MINOR})
+SET(CPACK_PACKAGE_VERSION_PATCH ${ORXONOX_VERSION_PATCH})
+#SET(CPACK_PROJECT_CONFIG_FILE ${CMAKE_BINARY_DIR}/CPackOptions.cmake)
+SET(CPACK_SOURCE_GENERATOR TGZ;ZIP)
+# Unsure what pattern to set here
+#SET(CPACK_SOURCE_IGNORE_FILES /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*)
+SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${ORXONOX_VERSION}")
+#SET(CPACK_SOURCE_STRIP_FILES FALSE)
+# Defaults to CMAKE_SYSTEM_NAME anyway
+#SET(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
+
+# Advanced settings
+SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENCE")
+  
+# Apple specific settings
+IF(APPLE)
+  SET(CPACK_GENERATOR "Bundle")
+
+  SET(CPACK_BUNDLE_NAME "${CPACK_PACKAGE_FILE_NAME}")
+  SET(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/${DEFAULT_DATA_PATH}/mac/Icon.icns")
+  SET(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/${DEFAULT_DATA_PATH}/mac/Orxonox-Info.plist")
+  SET(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_SOURCE_DIR}/${DEFAULT_RUNTIME_PATH}/mac/OrxonoxMac")
+ENDIF(APPLE)
+
+# Fire up CPack
+INCLUDE(CPack)
Index: code/branches/kicklib2/cmake/CompilerConfigMSVC.cmake
===================================================================
--- code/branches/kicklib2/cmake/CompilerConfigMSVC.cmake	(revision 8284)
+++ code/branches/kicklib2/cmake/CompilerConfigMSVC.cmake	(revision 8285)
@@ -68,7 +68,4 @@
 # Note: It hasn't been checked yet whether we have code that might break
 #ADD_COMPILER_FLAGS("-fp:fast" CACHE)
-
-# No iterator checking for release builds (MSVC 8 dosn't understand this though)
-ADD_COMPILER_FLAGS("-D_SECURE_SCL=0" ReleaseAll CACHE)
 
 # Newer MSVC versions come with std::shared_ptr which conflicts with
Index: code/branches/kicklib2/cmake/LibraryConfig.cmake
===================================================================
--- code/branches/kicklib2/cmake/LibraryConfig.cmake	(revision 8284)
+++ code/branches/kicklib2/cmake/LibraryConfig.cmake	(revision 8285)
@@ -58,5 +58,5 @@
   ELSEIF(MSVC90)
     SET(_compiler_prefix msvc9)
-  ELSEIF(MSVC100)
+  ELSEIF(MSVC10)
     SET(_compiler_prefix msvc10)
   ENDIF()
@@ -98,6 +98,6 @@
 # Performs the search and sets the variables    #
 
-FIND_PACKAGE(OGRE     1.6    REQUIRED)
-#FIND_PACKAGE(ENet     1.1    REQUIRED)
+#FIND_PACKAGE(ENet     1.2    REQUIRED)
+FIND_PACKAGE(CEGUI    0.6    REQUIRED)
 FIND_PACKAGE(Lua5.1          REQUIRED)
 FIND_PACKAGE(Ogg             REQUIRED)
@@ -105,9 +105,5 @@
 FIND_PACKAGE(ALUT            REQUIRED)
 FIND_PACKAGE(ZLIB            REQUIRED)
-IF(POCO_REQUIRED)
-  FIND_PACKAGE(POCO          REQUIRED)
-  # Always link against POCO too because of threading
-  SET(OGRE_LIBRARY ${OGRE_LIBRARY} ${POCO_LIBRARY})
-ENDIF()
+
 IF(WIN32)
   FIND_PACKAGE(DbgHelp)
@@ -115,12 +111,4 @@
 ENDIF()
 
-##### CEGUI #####
-# We make use of the CEGUI script module called CEGUILua.
-# However there is a small issue with that: Both CEGUILua and Orxonox use
-# Lua library functions on the same objects. And it turns out that in this case
-# the linked library must be EXACTLY the same.
-# Since Lua v5.1 has been out for a long while, this does not seem to be a
-# problem anymore, at least as long as Lua 5.2 is not released.
-FIND_PACKAGE(CEGUI 0.6 REQUIRED)
 
 ##### OpenAL #####
@@ -147,20 +135,23 @@
 ##### Boost #####
 # Expand the next statement if newer boost versions are released
-SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0 1.38 1.38.0 1.39 1.39.0 1.40 1.40.0
-                              1.41 1.41.0 1.42 1.42.0 1.43 1.43.0 1.44 1.44.0
-                              1.45 1.45.0 1.46 1.46.0 1.46.1)
-IF( NOT TARDIS )
-  FIND_PACKAGE(Boost 1.35 REQUIRED thread filesystem system date_time)
+SET(Boost_ADDITIONAL_VERSIONS 1.40 1.40.0 1.41 1.41.0 1.42 1.42.0 1.43 1.43.0
+                              1.44 1.44.0 1.45 1.45.0 1.46 1.46.0 1.46.1)
+IF(NOT TARDIS)
+  FIND_PACKAGE(Boost 1.40 REQUIRED thread filesystem system date_time)
 ENDIF()
 # No auto linking, so this option is useless anyway
 MARK_AS_ADVANCED(Boost_LIB_DIAGNOSTIC_DEFINITIONS)
-# Complain about incompatibilities
-IF(GCC_VERSION)
-  COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.4.0" _compare_result)
-  IF(NOT _compare_result LESS 0)
-    IF(${Boost_VERSION} LESS 103700)
-      MESSAGE(STATUS "Warning: Boost versions earlier than 1.37 may not compile with GCC 4.4 or later!")
-    ENDIF()
-  ENDIF()
+
+##### OGRE #####
+FIND_PACKAGE(OGRE 1.6 REQUIRED)
+# For Ogre >= 1.7, we might need a threading library
+# Variables are either defined by dependency package config or by FindOGRE
+IF(OGRE_NEEDS_POCO)
+  FIND_PACKAGE(POCO REQUIRED)
+  # Always link against POCO too because of threading
+  SET(OGRE_LIBRARY ${OGRE_LIBRARY} ${POCO_LIBRARY})
+ELSEIF(OGRE_NEEDS_BOOST)
+  # Always link against boost too because of threading
+  SET(OGRE_LIBRARY ${OGRE_LIBRARY} ${Boost_THREAD_LIBRARY})
 ENDIF()
 
Index: code/branches/kicklib2/cmake/PackageConfig.cmake
===================================================================
--- code/branches/kicklib2/cmake/PackageConfig.cmake	(revision 8284)
+++ code/branches/kicklib2/cmake/PackageConfig.cmake	(revision 8285)
@@ -33,5 +33,5 @@
 COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} 5 _result TRUE)
 IF(NOT _result EQUAL -1 AND NOT APPLE)
-  SET(POCO_REQUIRED TRUE)
+  SET(OGRE_NEEDS_POCO TRUE)
 ENDIF()
 
@@ -75,11 +75,22 @@
 
   ## RELEASE
-  # Try to filter out all the debug libraries. If the regex doesn't do the
-  # job anymore, simply adjust it.
-  INSTALL(
-    DIRECTORY ${DEP_BINARY_DIR}/
-    DESTINATION bin
-    CONFIGURATIONS Release RelWithDebInfo MinSizeRel
-    REGEX "_[Dd]\\.[a-zA-Z0-9+-]+$|-mt-gd-|^.*\\.pdb$" EXCLUDE
-  )
+  IF(EXISTS ${DEP_BINARY_DIR}/install_manifest.txt)
+    FILE(STRINGS ${DEP_BINARY_DIR}/install_manifest.txt _files)
+    FOREACH(_file ${_files})
+      INSTALL(
+        FILES ${DEP_BINARY_DIR}/${_file}
+        DESTINATION bin
+        CONFIGURATIONS Release RelWithDebInfo MinSizeRel
+      )
+    ENDFOREACH(_file)
+  ELSE()
+    # Try to filter out all the debug libraries. If the regex doesn't do the
+    # job anymore, simply adjust it.
+    INSTALL(
+      DIRECTORY ${DEP_BINARY_DIR}/
+      DESTINATION bin
+      CONFIGURATIONS Release RelWithDebInfo MinSizeRel
+      REGEX "_[Dd]\\.[a-zA-Z0-9+-]+$|-mt-gd-|^.*\\.pdb$" EXCLUDE
+    )
+  ENDIF()
 ENDIF()
Index: code/branches/kicklib2/cmake/PackageConfigMSVC.cmake
===================================================================
--- code/branches/kicklib2/cmake/PackageConfigMSVC.cmake	(revision 8284)
+++ code/branches/kicklib2/cmake/PackageConfigMSVC.cmake	(revision 8285)
@@ -57,6 +57,19 @@
   # Certain find scripts don't behave as ecpected to we have
   # to specify the libraries ourselves.
-  SET(TCL_LIBRARY  ${DEP_LIBRARY_DIR}/tcl85.lib CACHE FILEPATH "")
-  SET(ZLIB_LIBRARY ${DEP_LIBRARY_DIR}/zdll.lib  CACHE FILEPATH "")
+  IF(MSVC10)
+    SET(TCL_LIBRARY
+      optimized ${DEP_LIBRARY_DIR}/tcl85t.lib
+      debug     ${DEP_LIBRARY_DIR}/tcl85tg.lib
+      CACHE FILEPATH ""
+    )
+    SET(ZLIB_LIBRARY
+      optimized ${DEP_LIBRARY_DIR}/zlib-vc100.lib
+      debug     ${DEP_LIBRARY_DIR}/zlib-vc100_d.lib
+      CACHE FILEPATH ""
+    )
+  ELSE()
+    SET(TCL_LIBRARY  ${DEP_LIBRARY_DIR}/tcl85.lib CACHE FILEPATH "")
+    SET(ZLIB_LIBRARY ${DEP_LIBRARY_DIR}/zdll.lib  CACHE FILEPATH "")
+  ENDIF()
   # Part of Platform SDK and usually gets linked automatically
   SET(WMI_LIBRARY  wbemuuid.lib)
Index: code/branches/kicklib2/cmake/PackageConfigOSX.cmake
===================================================================
--- code/branches/kicklib2/cmake/PackageConfigOSX.cmake	(revision 8284)
+++ code/branches/kicklib2/cmake/PackageConfigOSX.cmake	(revision 8285)
@@ -30,25 +30,32 @@
 IF(NOT _INTERNAL_PACKAGE_MESSAGE)
   MESSAGE(STATUS "Using library package for the dependencies.")
+  
+  # The following shell script sets the appropriate install_names for our libraries
+  # and therefore it must be run before anything else is set, dep-package-wise.
+  EXECUTE_PROCESS(
+    COMMAND ${DEPENDENCY_PACKAGE_DIR}/install_dependencies.sh
+    WORKING_DIRECTORY ${DEPENDENCY_PACKAGE_DIR}
+    OUTPUT_FILE ${CMAKE_BINARY_DIR}/dep_pack_install_log.keep_me 
+  )
   SET(_INTERNAL_PACKAGE_MESSAGE 1 CACHE INTERNAL "Do not edit!" FORCE)
 ENDIF()
 
-SET(DEP_INCLUDE_DIR ${DEPENDENCY_PACKAGE_DIR}/include)
-SET(DEP_LIBRARY_DIR ${DEPENDENCY_PACKAGE_DIR}/lib)
-SET(DEP_BINARY_DIR  ${DEPENDENCY_PACKAGE_DIR}/bin)
+SET(DEP_INCLUDE_DIR   ${DEPENDENCY_PACKAGE_DIR}/include)
+SET(DEP_LIBRARY_DIR   ${DEPENDENCY_PACKAGE_DIR}/lib)
+SET(DEP_BINARY_DIR    ${DEPENDENCY_PACKAGE_DIR}/bin)
 SET(DEP_FRAMEWORK_DIR ${DEPENDENCY_PACKAGE_DIR}/Library/Frameworks)
 
-# Sets the library path for the FIND_LIBRARY
-SET(CMAKE_LIBRARY_PATH ${DEP_LIBRARY_DIR})
+# Sets the library and framwork paths for the FIND_LIBRARY commands
+SET(CMAKE_LIBRARY_PATH   ${DEP_LIBRARY_DIR})
+SET(CMAKE_FRAMEWORK_PATH ${DEP_FRAMEWORK_DIR})
 
 # Include paths and other special treatments
-SET(ENV{ALUTDIR}               ${DEP_FRAMEWORK_DIR})
-SET(ENV{BOOST_ROOT}            ${DEPENDENCY_PACKAGE_DIR})
-SET(ENV{CEGUIDIR}              ${DEP_FRAMEWORK_DIR})
-SET(ENV{LUA_DIR}               ${DEP_INCLUDE_DIR}/lua)
-SET(ENV{LUA5.1_DIR}            ${DEP_INCLUDE_DIR}/lua)
-SET(ENV{OGGDIR}                ${DEP_INCLUDE_DIR})
-SET(ENV{VORBISDIR}             ${DEP_INCLUDE_DIR})
-SET(ENV{OGRE_HOME}             ${DEP_FRAMEWORK_DIR})
-SET(ENV{OGRE_PLUGIN_DIR}       ${DEP_BINARY_DIR})
+SET(ENV{BOOST_ROOT}      ${DEPENDENCY_PACKAGE_DIR})
+SET(ENV{OGGDIR}          ${DEP_INCLUDE_DIR})
+SET(ENV{VORBISDIR}       ${DEP_INCLUDE_DIR})
+SET(ENV{OGRE_PLUGIN_DIR} ${DEP_BINARY_DIR})
+
+# Linking to OGRE requires linking to the boost threading library
+SET(OGRE_NEEDS_BOOST TRUE)
 
 # For OS X 10.5 we have to ship modified headers to make it compile
@@ -59,16 +66,9 @@
 ENDIF()
 
-# Xcode won't be able to run the toluabind code generation if we're using the dependency package
-#IF(DEPENDENCY_PACKAGE_ENABLE)
-#  IF(${CMAKE_GENERATOR} STREQUAL "Xcode")
-#    SET(ENV{DYLD_LIBRARY_PATH}               ${DEPENDENCY_PACKAGE_DIR}/lib)
-#    SET(ENV{DYLD_FRAMEWORK_PATH}             ${DEPENDENCY_PACKAGE_DIR}/Library/Frameworks)
-#  ENDIF(${CMAKE_GENERATOR} STREQUAL "Xcode")
-#ENDIF(DEPENDENCY_PACKAGE_ENABLE)
-
 ### INSTALL ###
 
 # Tcl script library
 # TODO: How does this work on OS X?
+# Concerning all OS X install procedures: use CPACK
 #INSTALL(
 #  DIRECTORY ${DEP_LIBRARY_DIR}/tcl/
Index: code/branches/kicklib2/cmake/PrepareDevBundle.cmake
===================================================================
--- code/branches/kicklib2/cmake/PrepareDevBundle.cmake	(revision 8285)
+++ code/branches/kicklib2/cmake/PrepareDevBundle.cmake	(revision 8285)
@@ -0,0 +1,59 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        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:
+ #    Kevin Young
+ #  Description:
+ #    Creates the file structure for the development application bundle
+ #
+
+IF(NOT CMAKE_CONFIGURATION_TYPES)
+  SET(_subdirs .)
+  SET(_default_subdir .)
+ELSE()
+  SET(_subdirs ${CMAKE_CONFIGURATION_TYPES})
+  SET(_default_subdir) # No default subdir
+ENDIF()
+
+FOREACH(_subdir ${_subdirs})
+  GET_FILENAME_COMPONENT(CURRENT_RUNTIME_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_subdir} ABSOLUTE)
+
+  # Convenience variables
+  # Note that this is just an empty bundle! The executable itself will
+  # be added at build time
+  SET(DEVBUNDLE_CURRENT_DIR "${CURRENT_RUNTIME_DIR}/${PROJECT_NAME}.app/Contents")
+  SET(DEVBUNDLE_CURRENT_BIN "${DEVBUNDLE_CURRENT_DIR}/MacOS")
+  SET(DEVBUNDLE_CURRENT_RESOURCES "${DEVBUNDLE_CURRENT_DIR}/Resources")
+  SET(DEVBUNDLE_DEFAULT_LANGFILE "English.lproj")
+  SET(DEVBUNDLE_NIB_FILE "MainMenu.nib")
+
+  # Create bundle folder structure
+  FILE(MAKE_DIRECTORY "${DEVBUNDLE_CURRENT_DIR}")
+  FILE(MAKE_DIRECTORY "${DEVBUNDLE_CURRENT_BIN}")
+  FILE(MAKE_DIRECTORY "${DEVBUNDLE_CURRENT_RESOURCES}")
+  FILE(MAKE_DIRECTORY "${DEVBUNDLE_CURRENT_RESOURCES}/${DEVBUNDLE_DEFAULT_LANGFILE}/${DEVBUNDLE_NIB_FILE}")
+  
+  # Populate with Info.plist, NIB-file and the Icon.icns
+  CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/${DEFAULT_DATA_PATH}/mac/Orxonox-Info.plist" "${DEVBUNDLE_CURRENT_DIR}/Info.plist")
+  CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/${DEFAULT_DATA_PATH}/mac/Icon.icns" "${DEVBUNDLE_CURRENT_RESOURCES}/Icon.icns" COPYONLY)
+  CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/${DEFAULT_DATA_PATH}/mac/${DEVBUNDLE_DEFAULT_LANGFILE}/${DEVBUNDLE_NIB_FILE}/designable.nib" "${DEVBUNDLE_CURRENT_RESOURCES}/${DEVBUNDLE_DEFAULT_LANGFILE}/${DEVBUNDLE_NIB_FILE}/designable.nib" COPYONLY)
+  CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/${DEFAULT_DATA_PATH}/mac/${DEVBUNDLE_DEFAULT_LANGFILE}/${DEVBUNDLE_NIB_FILE}/keyedobjects.nib" "${DEVBUNDLE_CURRENT_RESOURCES}/${DEVBUNDLE_DEFAULT_LANGFILE}/${DEVBUNDLE_NIB_FILE}/keyedobjects.nib" COPYONLY)
+  CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/${DEFAULT_DATA_PATH}/mac/${DEVBUNDLE_DEFAULT_LANGFILE}/InfoPlist.strings" "${DEVBUNDLE_CURRENT_RESOURCES}/${DEVBUNDLE_DEFAULT_LANGFILE}/InfoPlist.strings")
+
+ENDFOREACH(_subdir)
Index: code/branches/kicklib2/cmake/tools/FindALUT.cmake
===================================================================
--- code/branches/kicklib2/cmake/tools/FindALUT.cmake	(revision 8284)
+++ code/branches/kicklib2/cmake/tools/FindALUT.cmake	(revision 8285)
@@ -32,5 +32,5 @@
 FIND_PATH(ALUT_INCLUDE_DIR alut.h
   PATHS $ENV{ALUTDIR}
-  PATH_SUFFIXES include include/AL Headers Headers/AL
+  PATH_SUFFIXES include include/AL
 )
 FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED
Index: code/branches/kicklib2/cmake/tools/FindCEGUI.cmake
===================================================================
--- code/branches/kicklib2/cmake/tools/FindCEGUI.cmake	(revision 8284)
+++ code/branches/kicklib2/cmake/tools/FindCEGUI.cmake	(revision 8285)
@@ -34,5 +34,5 @@
 FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
   PATHS $ENV{CEGUIDIR}
-  PATH_SUFFIXES include include/CEGUI CEGUI.framework/Headers
+  PATH_SUFFIXES include include/CEGUI
 )
 
@@ -44,5 +44,5 @@
   NAMES CEGUIBase CEGUI
   PATHS $ENV{CEGUIDIR}
-  PATH_SUFFIXES lib bin CEGUIBase.framework CEGUI.framework
+  PATH_SUFFIXES lib bin
 )
 FIND_LIBRARY(CEGUI_LIBRARY_DEBUG
@@ -56,16 +56,19 @@
 # Find CEGUILua headers
 FIND_PATH(CEGUILUA_INCLUDE_DIR CEGUILua.h
-  PATHS $ENV{CEGUIDIR} ${CEGUI_INCLUDE_DIR}/ScriptingModules/LuaScriptModule
-  PATH_SUFFIXES include include/CEGUI CEGUILuaScriptModule.framework/Headers
+  PATHS
+    $ENV{CEGUIDIR}
+    $ENV{CEGUILUADIR}
+    ${CEGUI_INCLUDE_DIR}/ScriptingModules/LuaScriptModule
+  PATH_SUFFIXES include include/CEGUI
 )
 # Find CEGUILua libraries
 FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
   NAMES CEGUILua CEGUILuaScriptModule
-  PATHS $ENV{CEGUIDIR}
-  PATH_SUFFIXES lib bin CEGUILuaScriptModule.framework
+  PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
+  PATH_SUFFIXES lib bin
 )
 FIND_LIBRARY(CEGUILUA_LIBRARY_DEBUG
   NAMES CEGUILuad CEGUILua_d CEGUILuaScriptModuled CEGUILuaScriptModule_d
-  PATHS $ENV{CEGUIDIR}
+  PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
   PATH_SUFFIXES lib bin
 )
@@ -79,18 +82,17 @@
     # For newer CEGUI versions >= 0.7
     ${CEGUILUA_INCLUDE_DIR}/support/tolua++
-    # For Apples
-    $ENV{CEGUIDIR}
-  PATH_SUFFIXES ceguitolua++.framework/Headers
-  NO_DEFAULT_PATH # MUST be in CEGUILUA_INCLUDE_DIR somewhere
+    # For Mac OS X, tolua++ is a separate framework in the dependency package
+    ${DEP_FRAMEWORK_DIR}
+  NO_DEFAULT_PATH # Don't attempt to find tolua++ installed on the system
 )
 # Find CEGUI Tolua++ libraries
 FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_OPTIMIZED
   NAMES CEGUItoluapp tolua++ ceguitolua++
-  PATHS $ENV{CEGUIDIR}
-  PATH_SUFFIXES lib bin ceguitolua++.framework
+  PATHS $ENV{CEGUIDIR} ${CEGUITOLUADIR}
+  PATH_SUFFIXES lib bin
 )
 FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_DEBUG
   NAMES CEGUItoluappd CEGUItoluapp_d tolua++d tolua++_d
-  PATHS $ENV{CEGUIDIR}
+  PATHS $ENV{CEGUIDIR} ${CEGUITOLUADIR}
   PATH_SUFFIXES lib bin
 )
@@ -101,16 +103,19 @@
   # Find CEGUI OGRE Renderer headers
   FIND_PATH(CEGUI_OGRE_RENDERER_INCLUDE_DIR CEGUIOgreRenderer.h
-    PATHS $ENV{CEGUIDIR} ${CEGUI_INCLUDE_DIR}/RendererModules/Ogre
-    PATH_SUFFIXES include include/CEGUI CEGUI.framework/Headers
+    PATHS
+      $ENV{CEGUIDIR}
+      $ENV{CEGUIOGRERENDERERDIR}
+      ${CEGUI_INCLUDE_DIR}/RendererModules/Ogre
+    PATH_SUFFIXES include include/CEGUI
   )
   # Find CEGUI OGRE Renderer libraries
   FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
     NAMES CEGUIOgreRenderer
-    PATHS $ENV{CEGUIDIR}
+    PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
     PATH_SUFFIXES lib bin
   )
   FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
     NAMES CEGUIOgreRendererd CEGUIOgreRenderer_d
-    PATHS $ENV{CEGUIDIR}
+    PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
     PATH_SUFFIXES lib bin
   )
Index: code/branches/kicklib2/cmake/tools/FindLua5.1.cmake
===================================================================
--- code/branches/kicklib2/cmake/tools/FindLua5.1.cmake	(revision 8284)
+++ code/branches/kicklib2/cmake/tools/FindLua5.1.cmake	(revision 8285)
@@ -56,5 +56,5 @@
 # Find include path
 FIND_PATH(LUA5.1_INCLUDE_DIR lua.h
-  PATHS $ENV{LUA5.1_DIR}
+  PATHS $ENV{LUA5.1_DIR} $ENV{LUA_DIR}
   PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
 )
Index: code/branches/kicklib2/cmake/tools/FindOGRE.cmake
===================================================================
--- code/branches/kicklib2/cmake/tools/FindOGRE.cmake	(revision 8284)
+++ code/branches/kicklib2/cmake/tools/FindOGRE.cmake	(revision 8285)
@@ -23,5 +23,5 @@
 FIND_PATH(OGRE_INCLUDE_DIR Ogre.h
   PATHS $ENV{OGRE_HOME}
-  PATH_SUFFIXES include include/OGRE Ogre.framework/Headers
+  PATH_SUFFIXES include include/OGRE
 )
 FIND_LIBRARY(OGRE_LIBRARY_OPTIMIZED
@@ -33,5 +33,5 @@
   NAMES OgreMaind OgreMain_d OgreMainD OgreMain_D Ogred Ogre_d OgreD Ogre_d
   PATHS $ENV{OGRE_HOME}
-  PATH_SUFFIXES lib bin/Debug bin/debug Debug debug Versions/A
+  PATH_SUFFIXES lib bin/Debug bin/debug Debug debug
 )
 
Index: code/branches/kicklib2/cmake/tools/FindOgg.cmake
===================================================================
--- code/branches/kicklib2/cmake/tools/FindOgg.cmake	(revision 8284)
+++ code/branches/kicklib2/cmake/tools/FindOgg.cmake	(revision 8285)
@@ -22,10 +22,10 @@
 )
 FIND_LIBRARY(OGG_LIBRARY_OPTIMIZED
-  NAMES ogg ogg-0
+  NAMES ogg ogg-0 libogg
   PATHS $ENV{OGGDIR}
   PATH_SUFFIXES lib
 )
 FIND_LIBRARY(OGG_LIBRARY_DEBUG
-  NAMES oggd ogg_d oggD ogg_D
+  NAMES oggd ogg_d oggD ogg_D libogg_d
   PATHS $ENV{OGGDIR}
   PATH_SUFFIXES lib
Index: code/branches/kicklib2/cmake/tools/FindVorbis.cmake
===================================================================
--- code/branches/kicklib2/cmake/tools/FindVorbis.cmake	(revision 8284)
+++ code/branches/kicklib2/cmake/tools/FindVorbis.cmake	(revision 8285)
@@ -22,20 +22,20 @@
 )
 FIND_LIBRARY(VORBIS_LIBRARY_OPTIMIZED
-  NAMES vorbis vorbis-0
+  NAMES vorbis vorbis-0 libvorbis
   PATHS $ENV{VORBISDIR}
   PATH_SUFFIXES lib
 )
 FIND_LIBRARY(VORBIS_LIBRARY_DEBUG
-  NAMES vorbisd vorbis_d vorbisD vorbis_D
+  NAMES vorbisd vorbis_d vorbisD vorbis_D libvorbis_d
   PATHS $ENV{VORBISDIR}
   PATH_SUFFIXES lib
 )
 FIND_LIBRARY(VORBISFILE_LIBRARY_OPTIMIZED
-  NAMES vorbisfile vorbisfile-3
+  NAMES vorbisfile vorbisfile-3 libvorbisfile
   PATHS $ENV{VORBISDIR}
   PATH_SUFFIXES lib
 )
 FIND_LIBRARY(VORBISFILE_LIBRARY_DEBUG
-  NAMES vorbisfiled vorbisfile_d vorbisfileD vorbisfile_D
+  NAMES vorbisfiled vorbisfile_d vorbisfileD vorbisfile_D libvorbisfile_d
   PATHS $ENV{VORBISDIR}
   PATH_SUFFIXES lib
Index: code/branches/kicklib2/cmake/tools/TargetUtilities.cmake
===================================================================
--- code/branches/kicklib2/cmake/tools/TargetUtilities.cmake	(revision 8284)
+++ code/branches/kicklib2/cmake/tools/TargetUtilities.cmake	(revision 8285)
@@ -53,5 +53,5 @@
  #    This function also installs the target!
  #  Prerequisistes:
- #    ORXONOX_DEFAULT_LINK, ORXONOX_CONFIG_FILES, ORXONOX_CONFIG_FILES_GENERATED
+ #    ORXONOX_DEFAULT_LINK
  #  Parameters:
  #    _target_name, ARGN for the macro arguments
@@ -206,10 +206,4 @@
         SOURCE_GROUP("Config" FILES ${CMAKE_CURRENT_SOURCE_DIR}/${_arg_PCH_FILE})
       ENDIF()
-      # Also include all config files
-      LIST(APPEND _${_target_name}_files ${ORXONOX_CONFIG_FILES} ${ORXONOX_CONFIG_FILES_GENERATED})
-      # Add unprocessed config files to the 'Config' section
-      SOURCE_GROUP("Config" FILES ${ORXONOX_CONFIG_FILES})
-      # Add generated config files to the 'Generated' section
-      SOURCE_GROUP("Generated" FILES ${ORXONOX_CONFIG_FILES_GENERATED})
     ENDIF()
   ENDIF()
@@ -291,4 +285,13 @@
   IF(_arg_LINK_LIBRARIES)
     TARGET_LINK_LIBRARIES(${_target_name} ${_arg_LINK_LIBRARIES})
+  ENDIF()
+
+  # RPATH settings for the installation
+  IF(UNIX)
+    SET(_rpath ${LIBRARY_INSTALL_DIRECTORY})
+    IF(_arg_MODULE)
+      LIST(APPEND _rpath ${MODULE_INSTALL_DIRECTORY})
+    ENDIF()
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES INSTALL_RPATH "${_rpath}")
   ENDIF()
 
