Index: code/branches/pch/cmake/BuildConfigGCC.cmake
===================================================================
--- code/branches/pch/cmake/BuildConfigGCC.cmake	(revision 3115)
+++ code/branches/pch/cmake/BuildConfigGCC.cmake	(revision 3116)
@@ -23,4 +23,7 @@
  #    Sets the right compiler and linker flags for GCC.
  #
+
+# Shortcut for CMAKE_COMPILER_IS_GNUCXX and ..._GNUC
+SET(CMAKE_COMPILER_IS_GNU TRUE)
 
 # Determine compiler version
Index: code/branches/pch/cmake/BuildConfigMSVC.cmake
===================================================================
--- code/branches/pch/cmake/BuildConfigMSVC.cmake	(revision 3115)
+++ code/branches/pch/cmake/BuildConfigMSVC.cmake	(revision 3116)
@@ -24,7 +24,17 @@
  #
 
+################### Compiler Version ####################
+
+# We make use of variadic macros, which is only supported by MSVC 8 and above
+IF(MSVC_VERSION LESS 1400)
+  MESSAGE(FATAL_ERROR "Microsoft Visual Studio versions below 8 (2005) are not supported because of missing compiler extensions.")
+ENDIF()
+
+
 ######################## Options ########################
 
-OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" FALSE)
+IF(MSVC80)
+  OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" FALSE)
+ENDIF(MSVC80)
 
 #################### Compiler Flags #####################
Index: code/branches/pch/cmake/CapitaliseName.cmake
===================================================================
--- code/branches/pch/cmake/CapitaliseName.cmake	(revision 3116)
+++ code/branches/pch/cmake/CapitaliseName.cmake	(revision 3116)
@@ -0,0 +1,33 @@
+ #
+ #             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:
+ #    Reto Grieder
+ #  Examples:
+ #    "orxonox"  --> "Orxonox"
+ #    "ORXONOX"  --> "ORXONOX"
+ #    "1orxonox" --> "1orxonox"
+ #
+
+FUNCTION(CAPITALISE_NAME _name _output_var)
+  STRING(SUBSTRING "${_name}" 0 1 _first_letter)
+  STRING(TOUPPER "${_first_letter}" _first_letter)
+  STRING(REGEX REPLACE "^.(.*)$" "\\1" _rest "${_name}")
+  SET(${_output_var} "${_first_letter}${_rest}" PARENT_SCOPE)
+ENDFUNCTION(CAPITALISE_NAME)
Index: code/branches/pch/cmake/InstallUtilities.cmake
===================================================================
--- code/branches/pch/cmake/InstallUtilities.cmake	(revision 3115)
+++ 	(revision )
@@ -1,34 +1,0 @@
- #
- #             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:
- #    Reto Grieder
- #  Description:
- #    Helps configuring the INSTALL command in more global way.
- #  Parameters:
- #    Specifiy the targets as additional parameter.
- #
-
-FUNCTION(ORXONOX_INSTALL)
-  INSTALL(TARGETS ${ARGN}
-    RUNTIME DESTINATION ${ORXONOX_RUNTIME_INSTALL_PATH}
-    LIBRARY DESTINATION ${ORXONOX_LIBRARY_INSTALL_PATH}
-    #ARCHIVE DESTINATION ${ORXONOX_ARCHIVE_INSTALL_PATH}
-  )
-ENDFUNCTION(ORXONOX_INSTALL)
Index: code/branches/pch/cmake/ParseMacroArguments.cmake
===================================================================
--- code/branches/pch/cmake/ParseMacroArguments.cmake	(revision 3116)
+++ code/branches/pch/cmake/ParseMacroArguments.cmake	(revision 3116)
@@ -0,0 +1,76 @@
+ #
+ #             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:
+ #    Reto Grieder
+ #  Description:
+ #    Parses a list of macro arguments which are separated by keywords and
+ #    writes the result to the _arg_KEYWORD variable. Switches are set to their
+ #    literal name if found and the lists contain their elements.
+ #    The order of the arguments is arbitrary.
+ #  Note:
+ #    You have to specify the switches and list_names as a
+ #    semicolon separated list or all hell breaks loose!
+ #  Example:
+ #    The arguments  BLUBB_FILES foo.cc bar.c NO_ASDF  will do the following:
+ #    SET(_arg_NO_ASDF _arg_NO_ASDF)
+ #    SET(_arg_BLUBB_FILES foo.cc bar.c)
+ #    But NO_FOO will not be set at all if it was specified as a switch
+ #
+
+MACRO(PARSE_MACRO_ARGUMENTS _switches _list_names)
+  # Parse all the arguments and set the corresponding variable
+  # If the option is just a switch, set the variable to its name for later use
+  FOREACH(_arg ${ARGN})
+    SET(_arg_found FALSE)
+
+    # Switches
+    FOREACH(_switch ${_switches})
+      IF(${_switch} STREQUAL ${_arg})
+        SET(_arg_${_switch} ${_switch})
+	SET(_arg_found TRUE)
+        # Avoid interpreting arguments after this one as options args for the previous one
+	SET(_storage_var)
+        BREAK()
+      ENDIF()
+    ENDFOREACH(_switch)
+
+    # Input options
+    IF(NOT _arg_found)
+      FOREACH(_list_name ${_list_names})
+        IF(${_list_name} STREQUAL ${_arg})
+          SET(_storage_var _arg_${_list_name})
+	  SET(_arg_found TRUE)
+          BREAK()
+        ENDIF()
+      ENDFOREACH(_list_name)
+    ENDIF(NOT _arg_found)
+
+    # Arguments of an input option (like source files for SOURCE_FILES)
+    IF(NOT _arg_found)
+      IF(_storage_var)
+        # Store in variable define above in the foreach loop
+        SET(${_storage_var} ${${_storage_var}} ${_arg})
+      ELSE()
+        MESSAGE(FATAL_ERROR "ORXONOX_ADD_${_target_type} was given a non compliant argument: ${_arg}")
+      ENDIF(_storage_var)
+    ENDIF(NOT _arg_found)
+
+  ENDFOREACH(_arg)
+ENDMACRO(PARSE_MACRO_ARGUMENTS)
Index: code/branches/pch/cmake/TargetUtilities.cmake
===================================================================
--- code/branches/pch/cmake/TargetUtilities.cmake	(revision 3116)
+++ code/branches/pch/cmake/TargetUtilities.cmake	(revision 3116)
@@ -0,0 +1,154 @@
+ #
+ #             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:
+ #    Reto Grieder
+ #  Description:
+ #    Adds a library or an executable like ADD_LIBRARY/ADD_EXECUTABLE, but
+ #    accepts a lot more input information. Simply supply the keywords
+ #    described below in any order you wish.
+ #
+ #    Switches: (when given --> TRUE, FALSE otherwise)
+ #      FIND_HEADER_FILES: Searches the current directory for all header files
+ #                         and adds them to the target.
+ #      EXCLUDE_FROM_ALL:  Inherited from ADD_LIBRARY/ADD_EXECUTABLE
+ #      ORXONOX_EXTERNAL:  Specify this for third party libraries
+ #      NO_DLL_INTERFACE:  Link statically with MSVC
+ #      NO_SOURCE_GROUPS:  Don't create msvc source groups
+ #      STATIC/SHARED:     Inherited from ADD_LIBRARY
+ #      WIN32:             Inherited from ADD_EXECUTABLE
+ #    Lists:
+ #      LINK_LIBRARIES:    Redirects to TARGET_LINK_LIBRARIES
+ #      VERSION:           Set version to the binary
+ #      SOURCE_FILES:      Source files for the target
+ #      DEFINE_SYMBOL:     Sets the DEFINE_SYMBOL target property
+ #      TOLUA_FILES:       Files with tolua interface
+ #  Note:
+ #    This function also installs the target!
+ #  Prerequisistes:
+ #    ORXONOX_DEFAULT_LINK, ORXONOX_CONFIG_FILES
+ #  Parameters:
+ #    _target_name, ARGN for the macro arguments
+ #
+
+INCLUDE(CapitaliseName)
+INCLUDE(GenerateToluaBindings)
+INCLUDE(ParseMacroArguments)
+INCLUDE(SourceFileUtilities)
+
+FUNCTION(ORXONOX_ADD_LIBRARY _target_name)
+  TU_ADD_TARGET(${_target_name} LIBRARY "STATIC;SHARED" ${ARGN})
+ENDFUNCTION(ORXONOX_ADD_LIBRARY)
+
+FUNCTION(ORXONOX_ADD_EXECUTABLE _target_name)
+  TU_ADD_TARGET(${_target_name} EXECUTABLE "WIN32" ${ARGN})
+ENDFUNCTION(ORXONOX_ADD_EXECUTABLE)
+
+
+FUNCTION(TU_ADD_TARGET _target_name _target_type _additional_switches)
+  CAPITALISE_NAME(${_target_name} _target_name_capitalised)
+
+  # Specify all possible options (either switch or with add. arguments)
+  SET(_switches   FIND_HEADER_FILES  EXCLUDE_FROM_ALL  ORXONOX_EXTERNAL
+                  NO_DLL_INTERFACE   NO_SOURCE_GROUPS  ${_additional_switches})
+  SET(_list_names LINK_LIBRARIES  VERSION   SOURCE_FILES  DEFINE_SYMBOL
+                  TOLUA_FILES)
+  PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN})
+
+
+  # GET_HEADER_FILES
+  IF(_arg_FIND_HEADER_FILES)
+    GET_ALL_HEADER_FILES(_${target_name}_header_files)
+  ENDIF()
+
+  # Remove potential duplicates
+  SET(_${_target_name}_files ${_${target_name}_header_files} ${_arg_SOURCE_FILES})
+  LIST(REMOVE_DUPLICATES _${_target_name}_files)
+
+  # Generate the source groups
+  IF(NOT _arg_NO_SOURCE_GROUPS)
+    GENERATE_SOURCE_GROUPS(${_${_target_name}_files})
+
+    IF(NOT _arg_ORXONOX_EXTERNAL)
+      # Move the prereqs.h file to the config section
+      IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_target_name_capitalised}Prereqs.h)
+        SOURCE_GROUP("Config" FILES ${_target_name_capitalised}Prereqs.h)
+      ENDIF()
+      # Add the config files in a special source group
+      LIST(APPEND _${_target_name}_files ${ORXONOX_CONFIG_FILES})
+      SOURCE_GROUP("Config" FILES ${ORXONOX_CONFIG_FILES})
+    ENDIF()
+  ENDIF(NOT _arg_NO_SOURCE_GROUPS)
+
+  # TOLUA_FILES
+  IF(_arg_TOLUA_FILES)
+    GENERATE_TOLUA_BINDINGS(${_target_name_capitalised} _${_target_name}_files
+                            INPUTFILES ${_arg_TOLUA_FILES})
+  ENDIF()
+
+  # Certain libraries don't have dllexport/dllimport and can't be linked shared with msvc
+  IF(MSVC AND _arg_NO_DLL_INTERFACE)
+    SET(_arg_SHARED)
+    SET(_arg_STATIC STATIC)
+  ENDIF()
+
+  # Set default linking if required
+  IF(NOT _arg_SHARED AND NOT _arg_STATIC)
+    IF("${ORXONOX_DEFAULT_LINK}" STREQUAL "STATIC")
+      SET(_arg_STATIC STATIC)
+    ELSEIF("${ORXONOX_DEFAULT_LINK}" STREQUAL "SHARED")
+      SET(_arg_SHARED SHARED)
+    ENDIF()
+  ENDIF()
+
+  # Add the library/executable
+  IF("${_target_type}" STREQUAL "LIBRARY")
+    ADD_LIBRARY(${_target_name} ${_arg_STATIC} ${_arg_SHARED}
+                ${_arg_EXCLUDE_FROM_ALL} ${_${_target_name}_files})
+  ELSE()
+    ADD_EXECUTABLE(${_target_name} ${_arg_WIN32} ${_arg_EXCLUDE_FROM_ALL}
+                   ${_${_target_name}_files})
+  ENDIF()
+
+  # LINK_LIBRARIES
+  IF(_arg_LINK_LIBRARIES)
+    TARGET_LINK_LIBRARIES(${_target_name} ${_arg_LINK_LIBRARIES})
+  ENDIF()
+
+  # DEFINE_SYMBOL
+  IF(_arg_DEFINE_SYMBOL)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES DEFINE_SYMBOL ${_arg_DEFINE_SYMBOL})
+  ENDIF()
+
+  # VERSION
+  IF(_arg_VERSION)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES VERSION ${_arg_VERSION})
+  ELSEIF(NOT ORXONOX_EXTERNAL)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES VERSION ${ORXONOX_VERSION})
+  ENDIF()
+
+  IF(NOT _arg_STATIC)
+    INSTALL(TARGETS ${_target_name}
+      RUNTIME DESTINATION ${ORXONOX_RUNTIME_INSTALL_PATH}
+      LIBRARY DESTINATION ${ORXONOX_LIBRARY_INSTALL_PATH}
+      #ARCHIVE DESTINATION ${ORXONOX_ARCHIVE_INSTALL_PATH}
+    )
+  ENDIF()
+
+ENDFUNCTION(TU_ADD_TARGET)
Index: code/branches/pch/src/CMakeLists.txt
===================================================================
--- code/branches/pch/src/CMakeLists.txt	(revision 3115)
+++ code/branches/pch/src/CMakeLists.txt	(revision 3116)
@@ -22,7 +22,5 @@
 # various macro includes
 INCLUDE(FlagUtilities)
-INCLUDE(GenerateToluaBindings)
-INCLUDE(InstallUtilities)
-INCLUDE(SourceFileUtilities)
+INCLUDE(TargetUtilities)
 
 # Use TinyXML++
@@ -32,4 +30,7 @@
 # Tolua binding speedup if required
 ADD_COMPILER_FLAGS("-DTOLUA_RELEASE" Release MinSizeRel TOLUA_PARSER_RELEASE)
+
+# Default linking is SHARED
+SET(ORXONOX_DEFAULT_LINK SHARED)
 
 ################ OrxonoxConfig.h ################
@@ -83,4 +84,10 @@
 CONFIGURE_FILE(SpecialConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h)
 
+SET(ORXONOX_CONFIG_FILES
+  ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/OrxonoxConfig.h.in
+  ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/SpecialConfig.h.in
+)
 
 ############## Include Directories ##############
Index: code/branches/pch/src/bullet/CMakeLists.txt
===================================================================
--- code/branches/pch/src/bullet/CMakeLists.txt	(revision 3115)
+++ code/branches/pch/src/bullet/CMakeLists.txt	(revision 3116)
@@ -27,16 +27,14 @@
 ADD_SUBDIRECTORY(LinearMath)
 
-GENERATE_SOURCE_GROUPS(${BULLET_FILES})
-
 # No warnings needed from third party libraries
 REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)
 ADD_COMPILER_FLAGS("-w")
 
-IF(MSVC)
-  ADD_LIBRARY(bullet_orxonox STATIC ${BULLET_FILES})
-ELSE(MSVC)
-  ADD_LIBRARY(bullet_orxonox SHARED ${BULLET_FILES})
-  ORXONOX_INSTALL(bullet_orxonox)
-ENDIF(MSVC)
-
-SET_TARGET_PROPERTIES(bullet_orxonox PROPERTIES VERSION 2.73)
+ORXONOX_ADD_LIBRARY(bullet_orxonox
+  ORXONOX_EXTERNAL
+  NO_DLL_INTERFACE
+  VERSION
+    2.74
+  SOURCE_FILES
+    ${BULLET_FILES}
+)
Index: code/branches/pch/src/ceguilua/CMakeLists.txt
===================================================================
--- code/branches/pch/src/ceguilua/CMakeLists.txt	(revision 3115)
+++ code/branches/pch/src/ceguilua/CMakeLists.txt	(revision 3116)
@@ -75,13 +75,16 @@
 SET(CEGUILUA_LIBRARY ceguilua_orxonox)
 SET(CEGUILUA_LIBRARY ${CEGUILUA_LIBRARY} PARENT_SCOPE)
-ADD_LIBRARY(${CEGUILUA_LIBRARY} SHARED ${CEGUILUA_FILES})
-SET_TARGET_PROPERTIES(${CEGUILUA_LIBRARY} PROPERTIES DEFINE_SYMBOL "CEGUILUA_EXPORTS")
-TARGET_LINK_LIBRARIES(${CEGUILUA_LIBRARY}
-  tolua++_orxonox
-  ${LUA_LIBRARIES}
-  ${CEGUI_LIBRARY}
+ORXONOX_ADD_LIBRARY(${CEGUILUA_LIBRARY}
+  ORXONOX_EXTERNAL
+  NO_SOURCE_GROUPS
+  DEFINE_SYMBOL
+    "CEGUILUA_EXPORTS"
+  VERSION
+    ${CEGUI_VERSION}
+  LINK_LIBRARIES
+    tolua++_orxonox
+    ${LUA_LIBRARIES}
+    ${CEGUI_LIBRARY}
+  SOURCE_FILES
+    ${CEGUILUA_FILES}
 )
-
-SET_TARGET_PROPERTIES(ceguilua_orxonox PROPERTIES VERSION ${CEGUI_VERSION})
-
-ORXONOX_INSTALL(ceguilua_orxonox)
Index: code/branches/pch/src/core/CMakeLists.txt
===================================================================
--- code/branches/pch/src/core/CMakeLists.txt	(revision 3115)
+++ code/branches/pch/src/core/CMakeLists.txt	(revision 3116)
@@ -63,26 +63,26 @@
 )
 ADD_SUBDIRECTORY(input)
-GET_ALL_HEADER_FILES(CORE_HDR_FILES)
-SET(CORE_FILES ${CORE_SRC_FILES} ${CORE_HDR_FILES})
 
-GENERATE_SOURCE_GROUPS(${CORE_FILES})
-GENERATE_TOLUA_BINDINGS(Core CORE_FILES INPUTFILES LuaBind.h CommandExecutor.h Game.h)
-
-ADD_LIBRARY(core SHARED ${CORE_FILES})
-
-SET_TARGET_PROPERTIES(core PROPERTIES DEFINE_SYMBOL "CORE_SHARED_BUILD")
-TARGET_LINK_LIBRARIES(core
-  ${OGRE_LIBRARY}
-  ${Boost_THREAD_LIBRARY}
-  ${Boost_FILESYSTEM_LIBRARY}
-  ${Boost_SYSTEM_LIBRARY}
-  ${Boost_DATE_TIME_LIBRARY} # MSVC only
-  ${LUA_LIBRARIES}
-  cpptcl_orxonox
-  ois_orxonox
-  tinyxml++_orxonox
-  tolua++_orxonox
-  util
+ORXONOX_ADD_LIBRARY(core
+  FIND_HEADER_FILES
+  TOLUA_FILES
+    CommandExecutor.h
+    Game.h
+    LuaBind.h
+  DEFINE_SYMBOL
+    "CORE_SHARED_BUILD"
+  LINK_LIBRARIES
+    ${OGRE_LIBRARY}
+    ${Boost_THREAD_LIBRARY}
+    ${Boost_FILESYSTEM_LIBRARY}
+    ${Boost_SYSTEM_LIBRARY}
+    ${Boost_DATE_TIME_LIBRARY} # MSVC only
+    ${LUA_LIBRARIES}
+    cpptcl_orxonox
+    ois_orxonox
+    tinyxml++_orxonox
+    tolua++_orxonox
+    util
+  SOURCE_FILES
+    ${CORE_SRC_FILES}
 )
-
-ORXONOX_INSTALL(core)
Index: code/branches/pch/src/cpptcl/CMakeLists.txt
===================================================================
--- code/branches/pch/src/cpptcl/CMakeLists.txt	(revision 3115)
+++ code/branches/pch/src/cpptcl/CMakeLists.txt	(revision 3116)
@@ -31,5 +31,4 @@
   details/methods_v.h
 )
-GENERATE_SOURCE_GROUPS(${CPPTCL_FILES})
 
 # No warnings needed from third party libraries
@@ -37,12 +36,12 @@
 ADD_COMPILER_FLAGS("-w")
 
-IF(MSVC)
-  ADD_LIBRARY(cpptcl_orxonox STATIC ${CPPTCL_FILES})
-ELSE()
-  ADD_LIBRARY(cpptcl_orxonox SHARED ${CPPTCL_FILES})
-  ORXONOX_INSTALL(cpptcl_orxonox)
-ENDIF()
-
-TARGET_LINK_LIBRARIES(cpptcl_orxonox ${TCL_LIBRARY})
-
-SET_TARGET_PROPERTIES(cpptcl_orxonox PROPERTIES VERSION 1.1.3)
+ORXONOX_ADD_LIBRARY(cpptcl_orxonox
+  ORXONOX_EXTERNAL
+  NO_DLL_INTERFACE
+  VERSION
+    1.1.3
+  LINK_LIBRARIES
+    ${TCL_LIBRARY}
+  SOURCE_FILES
+    ${CPPTCL_FILES}
+)
Index: code/branches/pch/src/network/CMakeLists.txt
===================================================================
--- code/branches/pch/src/network/CMakeLists.txt	(revision 3115)
+++ code/branches/pch/src/network/CMakeLists.txt	(revision 3116)
@@ -37,18 +37,16 @@
 ADD_SUBDIRECTORY(packet)
 ADD_SUBDIRECTORY(synchronisable)
-GET_ALL_HEADER_FILES(NETWORK_HDR_FILES)
-SET(NETWORK_FILES ${NETWORK_SRC_FILES} ${NETWORK_HDR_FILES})
 
-GENERATE_SOURCE_GROUPS(${NETWORK_FILES})
-
-ADD_LIBRARY(network SHARED ${NETWORK_FILES})
-SET_TARGET_PROPERTIES(network PROPERTIES DEFINE_SYMBOL "NETWORK_SHARED_BUILD")
-TARGET_LINK_LIBRARIES(network
-  ${ZLIB_LIBRARY}
-  ${ENET_LIBRARY}
-  ${Boost_THREAD_LIBRARY}
-  util
-  core
+ORXONOX_ADD_LIBRARY(network
+  FIND_HEADER_FILES
+  DEFINE_SYMBOL
+    "NETWORK_SHARED_BUILD"
+  LINK_LIBRARIES
+    ${ZLIB_LIBRARY}
+    ${ENET_LIBRARY}
+    ${Boost_THREAD_LIBRARY}
+    util
+    core
+  SOURCE_FILES
+    ${NETWORK_SRC_FILES}
 )
-
-ORXONOX_INSTALL(network)
Index: code/branches/pch/src/ogreceguirenderer/CMakeLists.txt
===================================================================
--- code/branches/pch/src/ogreceguirenderer/CMakeLists.txt	(revision 3115)
+++ code/branches/pch/src/ogreceguirenderer/CMakeLists.txt	(revision 3116)
@@ -27,5 +27,4 @@
   OgreCEGUITexture.cpp
 )
-GENERATE_SOURCE_GROUPS(${OCR_FILES})
 
 # No warnings needed from third party libraries
@@ -33,12 +32,14 @@
 ADD_COMPILER_FLAGS("-w")
 
-ADD_LIBRARY(ogreceguirenderer_orxonox SHARED ${OCR_FILES})
-SET_TARGET_PROPERTIES(ogreceguirenderer_orxonox PROPERTIES DEFINE_SYMBOL "OGRE_GUIRENDERER_EXPORTS")
-TARGET_LINK_LIBRARIES(ogreceguirenderer_orxonox
-  ${OGRE_LIBRARY}
-  ${CEGUI_LIBRARY}
+ORXONOX_ADD_LIBRARY(ogreceguirenderer_orxonox
+  ORXONOX_EXTERNAL
+  LINK_LIBRARIES
+    ${OGRE_LIBRARY}
+    ${CEGUI_LIBRARY}
+  DEFINE_SYMBOL
+    "OGRE_GUIRENDERER_EXPORTS"
+  VERSION
+    1.4.9
+  SOURCE_FILES
+    ${OCR_FILES}
 )
-
-SET_TARGET_PROPERTIES(ogreceguirenderer_orxonox PROPERTIES VERSION 1.4.9)
-
-ORXONOX_INSTALL(ogreceguirenderer_orxonox)
Index: code/branches/pch/src/ois/CMakeLists.txt
===================================================================
--- code/branches/pch/src/ois/CMakeLists.txt	(revision 3115)
+++ code/branches/pch/src/ois/CMakeLists.txt	(revision 3116)
@@ -50,6 +50,4 @@
 ENDIF()
 
-GENERATE_SOURCE_GROUPS(${OIS_FILES})
-
 # No warnings needed from third party libraries
 REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)
@@ -58,12 +56,15 @@
 INCLUDE_DIRECTORIES(.)
 
-ADD_LIBRARY(ois_orxonox SHARED ${OIS_FILES})
-SET_TARGET_PROPERTIES(ois_orxonox PROPERTIES DEFINE_SYMBOL "OIS_NONCLIENT_BUILD")
+ORXONOX_ADD_LIBRARY(ois_orxonox
+  ORXONOX_EXTERNAL
+  DEFINE_SYMBOL
+    "OIS_NONCLIENT_BUILD"
+  VERSION
+    1.2
+  SOURCE_FILES
+    ${OIS_FILES}
+)
 
 IF(WIN32)
   TARGET_LINK_LIBRARIES(ois_orxonox ${DIRECTX_LIBRARIES})
 ENDIF()
-
-SET_TARGET_PROPERTIES(ois_orxonox PROPERTIES VERSION 1.2)
-
-ORXONOX_INSTALL(ois_orxonox)
Index: code/branches/pch/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/pch/src/orxonox/CMakeLists.txt	(revision 3115)
+++ code/branches/pch/src/orxonox/CMakeLists.txt	(revision 3116)
@@ -30,38 +30,39 @@
 ADD_SUBDIRECTORY(objects)
 ADD_SUBDIRECTORY(overlays)
+ADD_SUBDIRECTORY(sound)
 ADD_SUBDIRECTORY(tools)
-ADD_SUBDIRECTORY(sound)
-GET_ALL_HEADER_FILES(ORXONOX_HDR_FILES)
-SET(ORXONOX_FILES ${ORXONOX_SRC_FILES} ${ORXONOX_HDR_FILES})
 
-GENERATE_SOURCE_GROUPS(${ORXONOX_FILES})
-GENERATE_TOLUA_BINDINGS(Orxonox ORXONOX_FILES INPUTFILES gui/GUIManager.h objects/quest/QuestManager.h objects/quest/QuestDescription.h objects/pickup/PickupInventory.h objects/pickup/BaseItem.h)
+ORXONOX_ADD_EXECUTABLE(orxonox
+  FIND_HEADER_FILES
+  TOLUA_FILES
+    gui/GUIManager.h
+    objects/pickup/BaseItem.h
+    objects/pickup/PickupInventory.h
+    objects/quest/QuestDescription.h
+    objects/quest/QuestManager.h
+  LINK_LIBRARIES
+    ${OGRE_LIBRARY}
+    ${CEGUI_LIBRARY}
+    ${LUA_LIBRARIES}
+    ${CEGUILUA_LIBRARY}
+    ${Boost_SYSTEM_LIBRARY}
+    ${OPENAL_LIBRARY}
+    ${ALUT_LIBRARY}
+    ${VORBISFILE_LIBRARY}
+    ${VORBIS_LIBRARY}
+    ${OGG_LIBRARY}
+    ogreceguirenderer_orxonox
+    tinyxml++_orxonox
+    tolua++_orxonox
+    bullet_orxonox
+    util
+    core
+    network
+  SOURCE_FILES ${ORXONOX_SRC_FILES}
+)
 
-ADD_EXECUTABLE(orxonox ${ORXONOX_FILES})
 GET_TARGET_PROPERTY(_exec_loc orxonox LOCATION)
 GET_FILENAME_COMPONENT(_exec_name ${_exec_loc} NAME)
 SET(ORXONOX_EXECUTABLE_NAME ${_exec_name} CACHE INTERNAL "")
-
-TARGET_LINK_LIBRARIES(orxonox
-  ${OGRE_LIBRARY}
-  ${CEGUI_LIBRARY}
-  ${LUA_LIBRARIES}
-  ${CEGUILUA_LIBRARY}
-  ${Boost_SYSTEM_LIBRARY}
-  ${OPENAL_LIBRARY}
-  ${ALUT_LIBRARY}
-  ${VORBISFILE_LIBRARY}
-  ${VORBIS_LIBRARY}
-  ${OGG_LIBRARY}
-  ogreceguirenderer_orxonox
-  tinyxml++_orxonox
-  tolua++_orxonox
-  bullet_orxonox
-  util
-  core
-  network
-)
-
-ORXONOX_INSTALL(orxonox)
 
 
Index: code/branches/pch/src/tinyxml/CMakeLists.txt
===================================================================
--- code/branches/pch/src/tinyxml/CMakeLists.txt	(revision 3115)
+++ code/branches/pch/src/tinyxml/CMakeLists.txt	(revision 3116)
@@ -30,5 +30,4 @@
   tinyxmlparser.cpp
 )
-GENERATE_SOURCE_GROUPS(${TINYXML++_FILES})
 
 # No warnings needed from third party libraries
@@ -36,10 +35,10 @@
 ADD_COMPILER_FLAGS("-w")
 
-IF(MSVC)
-  ADD_LIBRARY(tinyxml++_orxonox STATIC ${TINYXML++_FILES})
-ELSE()
-  ADD_LIBRARY(tinyxml++_orxonox SHARED ${TINYXML++_FILES})
-  ORXONOX_INSTALL(tinyxml++_orxonox)
-ENDIF()
-
-SET_TARGET_PROPERTIES(tinyxml++_orxonox PROPERTIES VERSION 2.5.3)
+ORXONOX_ADD_LIBRARY(tinyxml++_orxonox
+  ORXONOX_EXTERNAL
+  NO_DLL_INTERFACE
+  VERSION
+    2.5.3
+  SOURCE_FILES
+    ${TINYXML++_FILES}
+)
Index: code/branches/pch/src/tolua/CMakeLists.txt
===================================================================
--- code/branches/pch/src/tolua/CMakeLists.txt	(revision 3115)
+++ code/branches/pch/src/tolua/CMakeLists.txt	(revision 3116)
@@ -36,17 +36,28 @@
 ADD_COMPILER_FLAGS("-w")
 
-ADD_LIBRARY(tolua++_orxonox SHARED ${TOLUA++_FILES})
-SET_TARGET_PROPERTIES(tolua++_orxonox PROPERTIES DEFINE_SYMBOL "TOLUA_SHARED_BUILD")
-TARGET_LINK_LIBRARIES(tolua++_orxonox ${LUA_LIBRARIES})
-
-SET_TARGET_PROPERTIES(tolua++_orxonox PROPERTIES VERSION 1.0.92)
-
-ORXONOX_INSTALL(tolua++_orxonox)
+ORXONOX_ADD_LIBRARY(tolua++_orxonox
+  ORXONOX_EXTERNAL
+  DEFINE_SYMBOL
+    "TOLUA_SHARED_BUILD"
+  VERSION
+    1.0.92
+  LINK_LIBRARIES
+    ${LUA_LIBRARIES}
+  SOURCE_FILES
+    ${TOLUA++_FILES}
+)
 
 
 ################## Tolua++ generator ##################
 
-ADD_EXECUTABLE(tolua++app_orxonox tolua.c)
-TARGET_LINK_LIBRARIES(tolua++app_orxonox tolua++_orxonox ${LUA_LIBRARIES})
+ORXONOX_ADD_EXECUTABLE(tolua++app_orxonox
+  ORXONOX_EXTERNAL
+  VERSION
+    1.0.92
+  LINK_LIBRARIES
+    ${LUA_LIBRARIES}
+  SOURCE_FILES
+    tolua.c
+)
 
 OPTION(TOLUA_PARSER_RELEASE "Disable all debug messages from tolua bind files for Release and MinSizeRel build types." FALSE)
Index: code/branches/pch/src/util/CMakeLists.txt
===================================================================
--- code/branches/pch/src/util/CMakeLists.txt	(revision 3115)
+++ code/branches/pch/src/util/CMakeLists.txt	(revision 3116)
@@ -52,20 +52,4 @@
   SubString.cc
 )
-#GET_ALL_HEADER_FILES(UTIL_HDR_FILES)
-#SET(UTIL_FILES ${UTIL_SRC_FILES} ${UTIL_HDR_FILES})
-GENERATE_SOURCE_GROUPS(${UTIL_FILES})
-# Also add OrxonoxConfig to have it least somewhere in the IDE
-LIST(APPEND UTIL_FILES
-  ${CMAKE_BINARY_DIR}/src/OrxonoxConfig.h
-  ${CMAKE_SOURCE_DIR}/src/OrxonoxConfig.h.in
-  ${CMAKE_BINARY_DIR}/src/SpecialConfig.h
-  ${CMAKE_SOURCE_DIR}/src/SpecialConfig.h.in
-)
-SOURCE_GROUP("" FILES
-  ${CMAKE_BINARY_DIR}/src/OrxonoxConfig.h
-  ${CMAKE_SOURCE_DIR}/src/OrxonoxConfig.h.in
-  ${CMAKE_BINARY_DIR}/src/SpecialConfig.h
-  ${CMAKE_SOURCE_DIR}/src/SpecialConfig.h.in
-)
 
 IF(GCC_NO_SYSTEM_HEADER_SUPPORT)
@@ -74,7 +58,11 @@
 ENDIF()
 
-ADD_LIBRARY(util SHARED ${UTIL_FILES})
-SET_TARGET_PROPERTIES(util PROPERTIES DEFINE_SYMBOL "UTIL_SHARED_BUILD")
-TARGET_LINK_LIBRARIES(util ${OGRE_LIBRARY})
-
-ORXONOX_INSTALL(util)
+ORXONOX_ADD_LIBRARY(util
+  #FIND_HEADER_FILES
+  DEFINE_SYMBOL
+    "UTIL_SHARED_BUILD"
+  LINK_LIBRARIES
+    ${OGRE_LIBRARY}
+  SOURCE_FILES
+    ${UTIL_FILES}
+)
