Index: /code/trunk/cmake/AddSourceFiles.cmake
===================================================================
--- /code/trunk/cmake/AddSourceFiles.cmake	(revision 2129)
+++ /code/trunk/cmake/AddSourceFiles.cmake	(revision 2130)
@@ -1,13 +1,22 @@
-MACRO(ADD_SOURCE_FILES _directory _source_list _target_list)
+MACRO(ADD_SOURCE_DIRECTORY _target_list _directory)
 
-  # Set the variable (_source_list) first
-  INCLUDE(${_directory}/CMakeLists.txt)
-#MESSAGE(STATUS ${_directory})
-#MESSAGE(STATUS "${_source_list}")
-#MESSAGE(STATUS "${${_source_list}}")
+  # Subfolder puts source files into CMake Cache variable _CACHED_SOURCE_FILES
+  ADD_SUBDIRECTORY(${_directory})
 
-  FOREACH(_source_file ${${_source_list}})
-	LIST(APPEND ${_target_list} "${_directory}/${_source_file}")
-#MESSAGE(STATUS ${${_target_list}})
+  # Put the directory name in front of each source file from the subfolder
+  # and add it to the source list in the current directory
+  FOREACH(_source_file ${_CACHED_SOURCE_FILES})
+    LIST(APPEND ${_target_list} "${_directory}/${_source_file}")
   ENDFOREACH(_source_file)
+
+ENDMACRO(ADD_SOURCE_DIRECTORY)
+
+
+MACRO(ADD_SOURCE_FILES _source_list)
+  
+  # Put the source file into a variable that still exists in this_folder/../
+  # Use FORCE to always overwrite the cache variable
+  SET(_CACHED_SOURCE_FILES ${${_source_list}} CACHE STRING "" FORCE)
+  MARK_AS_ADVANCED(_CACHED_SOURCE_FILES FORCE)
+
 ENDMACRO(ADD_SOURCE_FILES)
Index: /code/trunk/src/orxonox/CMakeLists.txt
===================================================================
--- /code/trunk/src/orxonox/CMakeLists.txt	(revision 2129)
+++ /code/trunk/src/orxonox/CMakeLists.txt	(revision 2130)
@@ -9,9 +9,9 @@
 )
 
-ADD_SOURCE_FILES(gamestates ORXONOX_GAMESTATES_SRC_FILES ORXONOX_SRC_FILES)
-ADD_SOURCE_FILES(gui        ORXONOX_GUI_SRC_FILES        ORXONOX_SRC_FILES)
-ADD_SOURCE_FILES(objects    ORXONOX_OBJECTS_SRC_FILES    ORXONOX_SRC_FILES)
-ADD_SOURCE_FILES(overlays   ORXONOX_OVERLAYS_SRC_FILES   ORXONOX_SRC_FILES)
-ADD_SOURCE_FILES(tools      ORXONOX_TOOLS_SRC_FILES      ORXONOX_SRC_FILES)
+ADD_SOURCE_DIRECTORY(ORXONOX_SRC_FILES gamestates)
+ADD_SOURCE_DIRECTORY(ORXONOX_SRC_FILES gui)
+ADD_SOURCE_DIRECTORY(ORXONOX_SRC_FILES objects)
+ADD_SOURCE_DIRECTORY(ORXONOX_SRC_FILES overlays)
+ADD_SOURCE_DIRECTORY(ORXONOX_SRC_FILES tools)
 
 GET_TARGET_PROPERTY(TOLUA_EXE tolua_orxonox LOCATION)
Index: /code/trunk/src/orxonox/gamestates/CMakeLists.txt
===================================================================
--- /code/trunk/src/orxonox/gamestates/CMakeLists.txt	(revision 2129)
+++ /code/trunk/src/orxonox/gamestates/CMakeLists.txt	(revision 2130)
@@ -1,3 +1,3 @@
-SET( ORXONOX_GAMESTATES_SRC_FILES
+SET( SRC_FILES
   GSDedicated.cc
   GSClient.cc
@@ -11,2 +11,4 @@
 )
 
+ADD_SOURCE_FILES(SRC_FILES)
+
Index: /code/trunk/src/orxonox/gui/CMakeLists.txt
===================================================================
--- /code/trunk/src/orxonox/gui/CMakeLists.txt	(revision 2129)
+++ /code/trunk/src/orxonox/gui/CMakeLists.txt	(revision 2130)
@@ -1,3 +1,3 @@
-SET( ORXONOX_GUI_SRC_FILES
+SET( SRC_FILES
   GUIManager.cc
   OgreCEGUIRenderer.cpp
@@ -6,2 +6,4 @@
 )
 
+ADD_SOURCE_FILES(SRC_FILES)
+
Index: /code/trunk/src/orxonox/objects/CMakeLists.txt
===================================================================
--- /code/trunk/src/orxonox/objects/CMakeLists.txt	(revision 2129)
+++ /code/trunk/src/orxonox/objects/CMakeLists.txt	(revision 2130)
@@ -1,3 +1,3 @@
-SET( ORXONOX_OBJECTS_SRC_FILES
+SET( SRC_FILES
   EventListener.cc
   EventDispatcher.cc
@@ -64,3 +64,6 @@
 )
 
-ADD_SOURCE_FILES(controllers      ORXONOX_OBJECTS_CONTROLLERS_SRC_FILES      ORXONOX_OBJECTS_SRC_FILES)
+ADD_SOURCE_DIRECTORY(SRC_FILES controllers)
+
+ADD_SOURCE_FILES(SRC_FILES)
+
Index: /code/trunk/src/orxonox/objects/controllers/CMakeLists.txt
===================================================================
--- /code/trunk/src/orxonox/objects/controllers/CMakeLists.txt	(revision 2129)
+++ /code/trunk/src/orxonox/objects/controllers/CMakeLists.txt	(revision 2130)
@@ -1,4 +1,7 @@
-SET( ORXONOX_OBJECTS_CONTROLLERS_SRC_FILES
+SET( SRC_FILES
   Controller.cc
   HumanController.cc
 )
+
+ADD_SOURCE_FILES(SRC_FILES)
+
Index: /code/trunk/src/orxonox/overlays/CMakeLists.txt
===================================================================
--- /code/trunk/src/orxonox/overlays/CMakeLists.txt	(revision 2129)
+++ /code/trunk/src/orxonox/overlays/CMakeLists.txt	(revision 2130)
@@ -1,3 +1,3 @@
-SET( ORXONOX_OVERLAYS_SRC_FILES
+SET( SRC_FILES
   OrxonoxOverlay.cc
   OverlayGroup.cc
@@ -16,2 +16,4 @@
 )
 
+ADD_SOURCE_FILES(SRC_FILES)
+
Index: /code/trunk/src/orxonox/tools/CMakeLists.txt
===================================================================
--- /code/trunk/src/orxonox/tools/CMakeLists.txt	(revision 2129)
+++ /code/trunk/src/orxonox/tools/CMakeLists.txt	(revision 2130)
@@ -1,3 +1,3 @@
-SET( ORXONOX_TOOLS_SRC_FILES
+SET( SRC_FILES
   BillboardSet.cc
   Mesh.cc
@@ -8,2 +8,4 @@
 )
 
+ADD_SOURCE_FILES(SRC_FILES)
+
