Index: code/forks/sandbox_qt/cmake/tools/SourceFileUtilities.cmake
===================================================================
--- code/forks/sandbox_qt/cmake/tools/SourceFileUtilities.cmake	(revision 7465)
+++ code/forks/sandbox_qt/cmake/tools/SourceFileUtilities.cmake	(revision 7805)
@@ -34,52 +34,16 @@
 
 FUNCTION(PREPARE_SOURCE_FILES)
-  SET(_fullpath_sources)
+  SET(_source_files)
   FOREACH(_file ${ARGN})
-    IF(_file STREQUAL "COMPILATION_BEGIN")
-      SET(_compile TRUE)
-      # Next file is the name of the compilation
-      SET(_get_name TRUE)
-    ELSEIF(_get_name)
-      SET(_get_name FALSE)
-      SET(_compilation_name ${_file})
-    ELSEIF(_file STREQUAL "COMPILATION_END")
-      IF(NOT _compilation_name)
-        MESSAGE(FATAL_ERROR "No name provided for source file compilation")
-      ENDIF()
-      IF(NOT DISABLE_COMPILATIONS)
-        SET(_compilation_file ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name})
-        SET(_include_string)
-        FOREACH(_file2 ${_compilation})
-          SET(_include_string "${_include_string}#include \"${_file2}\"\n")
-        ENDFOREACH(_file2)
-        IF(EXISTS ${_compilation_file})
-          FILE(READ ${_compilation_file} _include_string_file)
-        ENDIF()
-        IF(NOT _include_string STREQUAL "${_include_string_file}")
-          FILE(WRITE ${_compilation_file} "${_include_string}")
-        ENDIF()
-        LIST(APPEND _fullpath_sources ${_compilation_file})
-        # MSVC hack that excludes the compilations from the intellisense database
-        # (There is a bug with the "-" instead of "/". Only works for "Zm#" argument)
-        # 2nd Note: Exploiting this results in a strange separation of the compilation
-        # file, causing the compiler not to use multi processing --> slower compiling.
-        #IF(MSVC)
-        #    SET_SOURCE_FILES_PROPERTIES(${_compilation_file} PROPERTIES COMPILE_FLAGS "-Zm1000")
-        #ENDIF()
-      ENDIF()
-      SET(_compilation_name)
-      SET(_compilation)
-      SET(_compile FALSE)
+    IF(_file MATCHES "^(COMPILATION_BEGIN|COMPILATION_END|QT)$")
+      # Append keywords verbatim
+      LIST(APPEND _source_files ${_file})
     ELSE()
-      # Prefix the full path
-      GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION)
-      LIST(APPEND _fullpath_sources ${_filepath})
-      IF(_compile AND NOT DISABLE_COMPILATIONS)
-        LIST(APPEND _compilation ${_filepath})
-        LIST(APPEND _fullpath_sources "H")
-      ENDIF()
+      # Store file with path relative to the root source directory
+      FILE(RELATIVE_PATH _file_rel ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
+      LIST(APPEND _source_files ${_file_rel})
     ENDIF()
   ENDFOREACH(_file)
-  SET(_fullpath_sources ${_fullpath_sources} PARENT_SCOPE)
+  SET(_source_files ${_source_files} PARENT_SCOPE)
 ENDFUNCTION(PREPARE_SOURCE_FILES)
 
@@ -89,5 +53,5 @@
   PREPARE_SOURCE_FILES(${ARGN})
   # Write into the cache to avoid variable scoping in subdirs
-  SET(${_varname} ${${_varname}} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
+  SET(${_varname} ${${_varname}} ${_source_files} CACHE INTERNAL "Do not edit")
 ENDFUNCTION(ADD_SOURCE_FILES)
 
@@ -97,5 +61,5 @@
   PREPARE_SOURCE_FILES(${ARGN})
   # Write into the cache to avoid variable scoping in subdirs
-  SET(${_varname} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
+  SET(${_varname} ${_source_files} CACHE INTERNAL "Do not edit")
 ENDFUNCTION(SET_SOURCE_FILES)
 
@@ -113,5 +77,5 @@
     GET_SOURCE_FILE_PROPERTY(_full_filepath ${_file} LOCATION)
     FILE(RELATIVE_PATH _relative_path ${CMAKE_CURRENT_SOURCE_DIR} ${_full_filepath})
-    IF(NOT _relative_path MATCHES "^\\.\\.")
+    IF(NOT _relative_path MATCHES "^\\.\\./") # Has "../" at the beginning
       GET_FILENAME_COMPONENT(_relative_path ${_relative_path} PATH)
       STRING(REPLACE "/" "\\\\" _group_path "${_relative_path}")
Index: code/forks/sandbox_qt/cmake/tools/TargetUtilities.cmake
===================================================================
--- code/forks/sandbox_qt/cmake/tools/TargetUtilities.cmake	(revision 7465)
+++ code/forks/sandbox_qt/cmake/tools/TargetUtilities.cmake	(revision 7805)
@@ -48,6 +48,4 @@
  #      PCH_EXCLUDE:       Source files to be excluded from PCH support
  #      OUTPUT_NAME:       If you want a different name than the target name
- #      QT_MOC_FILES:      List of files to be processed by Qt MOC
- #      QT_UIC_FILES:      List of files to be processed by Qt UIC
  #  Note:
  #    This function also installs the target!
@@ -85,17 +83,70 @@
   SET(_list_names LINK_LIBRARIES     VERSION           SOURCE_FILES
                   DEFINE_SYMBOL      PCH_FILE          PCH_EXCLUDE
-                  OUTPUT_NAME        QT_MOC_FILES      QT_UIC_FILES)
+                  OUTPUT_NAME)
 
   PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN})
 
 
-  # Workaround: Source file properties get lost when leaving a subdirectory
-  # Therefore an "H" after a file means we have to set it as HEADER_FILE_ONLY
+  # Process source files with support for compilations and QT special files
+  # Note: All file paths are relative to the root source directory, even the
+  #       name of the compilation file.
+  SET(_${_target_name}_source_files)
+  SET(_get_compilation_file FALSE)
+  SET(_add_to_compilation FALSE)
+  SET(_compile_qt_next FALSE)
   FOREACH(_file ${_arg_SOURCE_FILES})
-    IF(_file STREQUAL "H")
-      SET_SOURCE_FILES_PROPERTIES(${_last_file} PROPERTIES HEADER_FILE_ONLY TRUE)
+    IF(_file STREQUAL "COMPILATION_BEGIN")
+      # Next file is the name of the compilation
+      SET(_get_compilation_file TRUE)
+    ELSEIF(_file STREQUAL "COMPILATION_END")
+      IF(NOT _compilation_file)
+        MESSAGE(FATAL_ERROR "No name provided for source file compilation")
+      ENDIF()
+      IF(NOT _compilation_include_string)
+        MESSAGE(STATUS "Warning: Empty source file compilation!")
+      ENDIF()
+      IF(NOT DISABLE_COMPILATIONS)
+        IF(EXISTS ${_compilation_file})
+          FILE(READ ${_compilation_file} _include_string_file)
+        ENDIF()
+        IF(NOT _compilation_include_string STREQUAL "${_include_string_file}")
+          FILE(WRITE ${_compilation_file} "${_compilation_include_string}")
+        ENDIF()
+        LIST(APPEND _${_target_name}_source_files ${_compilation_file})
+      ENDIF()
+      SET(_add_to_compilation FALSE)
+    ELSEIF(_get_compilation_file)
+      SET(_compilation_file ${CMAKE_BINARY_DIR}/${_file})
+      SET(_get_compilation_file FALSE)
+      SET(_add_to_compilation TRUE)
+      SET(_compilation_include_string)
+    ELSEIF(_file STREQUAL "QT")
+      SET(_compile_qt_next TRUE)
     ELSE()
-      SET(_last_file ${_file})
+      # Default, add source file
+      SET(_file ${CMAKE_SOURCE_DIR}/${_file})
       LIST(APPEND _${_target_name}_source_files ${_file})
+
+      # Handle compilations
+      IF(_add_to_compilation AND NOT DISABLE_COMPILATIONS)
+        IF(_file MATCHES "\\.(c|cc|cpp|cxx)$")
+          SET(_compilation_include_string "${_compilation_include_string}#include \"${_file}\"\n")
+        ENDIF()
+        # Don't compile these files, even if they are source files
+        SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES HEADER_FILE_ONLY TRUE)
+      ENDIF()
+
+      # Handle Qt MOC and UI files
+      IF(_compile_qt_next)
+        GET_FILENAME_COMPONENT(_ext ${_file} EXT)
+        IF(_ext STREQUAL ".ui")
+          QT4_WRAP_UI(_${_target_name}_source_files ${_file})
+        ELSEIF(_ext STREQUAL ".qrc")
+          QT4_ADD_RESOURCES(_${_target_name}_source_files ${_file})
+        ELSEIF(_ext MATCHES "^\\.(h|hpp|hxx)$")
+          QT4_WRAP_CPP(_${_target_name}_source_files ${_file})
+        ENDIF()
+        SET(_compile_qt_next FALSE)
+      ENDIF()
     ENDIF()
   ENDFOREACH(_file)
@@ -106,20 +157,11 @@
   ENDIF()
 
-  # Combine source, header and QT designer files
+  # Combine source and header files
   SET(_${_target_name}_files
     ${_${_target_name}_header_files}
     ${_${_target_name}_source_files}
-    ${_arg_QT_UIC_FILES}
   )
   # Remove potential duplicates
   LIST(REMOVE_DUPLICATES _${_target_name}_files)
-
-  # QT MOC and UIC preprocessing
-  IF(_arg_QT_MOC_FILES)
-      QT4_WRAP_CPP(_${_target_name}_files ${_arg_QT_MOC_FILES})
-  ENDIF()
-  IF(_arg_QT_UIC_FILES)
-      QT4_WRAP_UI(_${_target_name}_files ${_arg_QT_UIC_FILES})
-  ENDIF()
 
   # First part (pre target) of precompiled header files
@@ -174,5 +216,5 @@
   # Don't compile header files
   FOREACH(_file ${_${_target_name}_files})
-    IF(NOT _file MATCHES "\\.(c|cc|cpp)")
+    IF(NOT _file MATCHES "\\.(c|cc|cpp|cxx)$")
       SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES HEADER_FILE_ONLY TRUE)
     ENDIF()
Index: code/forks/sandbox_qt/src/CMakeLists.txt
===================================================================
--- code/forks/sandbox_qt/src/CMakeLists.txt	(revision 7465)
+++ code/forks/sandbox_qt/src/CMakeLists.txt	(revision 7805)
@@ -80,4 +80,6 @@
 ################## Executable ###################
 
+SET_SOURCE_FILES(ORXONOX_MAIN_SRC_FILES Orxonox.cc)
+
 INCLUDE_DIRECTORIES(
   ${CMAKE_CURRENT_SOURCE_DIR}/libraries
@@ -97,5 +99,5 @@
     orxonox
   SOURCE_FILES
-    Orxonox.cc
+    ${ORXONOX_MAIN_SRC_FILES}
   OUTPUT_NAME orxonox
 )
Index: code/forks/sandbox_qt/src/orxonox/CMakeLists.txt
===================================================================
--- code/forks/sandbox_qt/src/orxonox/CMakeLists.txt	(revision 7465)
+++ code/forks/sandbox_qt/src/orxonox/CMakeLists.txt	(revision 7805)
@@ -20,10 +20,13 @@
 INCLUDE_DIRECTORIES(
   ${CMAKE_SOURCE_DIR}/src/libraries
-  ${CMAKE_CURRENT_SOURCE_DIR}
+  # Make Qt UIC generated header files visible
+  ${CMAKE_CURRENT_BINARY_DIR}
 )
 
 SET_SOURCE_FILES(ORXONOX_SRC_FILES
   Main.cc
-  MainWindow.cc
+
+  QT MainWindow.h       MainWindow.cc
+  QT MainWindow.ui
 )
 
@@ -31,9 +34,4 @@
 
 ORXONOX_ADD_LIBRARY(orxonox
-  FIND_HEADER_FILES
-  QT_MOC_FILES
-    MainWindow.h
-  QT_UIC_FILES
-    MainWindow.ui
   LINK_LIBRARIES
     ${QT_QTCORE_LIBRARY}
