diff --git a/CMakeModules/SimoxMacros.cmake b/CMakeModules/SimoxMacros.cmake
index d6a56ab0305eb5fcf77f45f66713e8fd97ebc32a..c7b19f118d1d541067e211b98c9c0616a32e79b4 100644
--- a/CMakeModules/SimoxMacros.cmake
+++ b/CMakeModules/SimoxMacros.cmake
@@ -52,3 +52,59 @@ function(SimoxQtLibrary name srcs incs mocFiles uiFiles)
     # add Saba and GraspStudio
     TARGET_LINK_LIBRARIES(${name} PUBLIC GraspStudio Saba)
 endfunction()
+
+macro(simox_subdirs result curdir)
+    file(GLOB children ${curdir}/*)
+    set(${result})
+    foreach(child ${children})
+        if(IS_DIRECTORY ${child})
+            list(APPEND ${result} ${child})
+        endif()
+    endforeach()
+endmacro()
+
+macro(simox_update_file file content) #macro since we want to provide simox_file_up_to_date
+    set(simox_file_up_to_date 0)
+    if(EXISTS "${file}")
+        file(SHA512 "${file}" _simox_file_sha)
+        string(SHA512 _simox_cont_sha "${content}")
+        if("${_simox_cont_sha}" STREQUAL "${_simox_file_sha}")
+            set(simox_file_up_to_date 1)
+        endif()
+    endif()
+    #write file
+    if(${simox_file_up_to_date} EQUAL 0)
+        file(WRITE "${file}" "${content}")
+    endif()
+endmacro()
+
+macro(simox_generate_subdir_headers dir prefix_to_remove out_headers)
+    string(REPLACE "//" "/" prefix_to_remove_fixed "${prefix_to_remove}/")
+    string(REPLACE "${prefix_to_remove_fixed}" "" dir_rel "${dir}")
+    _simox_generate_subdir_headers_impl("${dir}" "${prefix_to_remove_fixed}" ${out_headers})
+endmacro()
+
+macro(_simox_generate_subdir_headers_impl dir prefix_to_remove out_headers)
+    simox_subdirs(subdirs ${dir})
+    foreach(subdir ${subdirs})
+        #recurse
+        _simox_generate_subdir_headers_impl("${subdir}" "${prefix_to_remove}" ${out_headers})
+
+        file(GLOB headers ${subdir}/*.h) 
+        list(LENGTH headers n)
+        string(REGEX REPLACE ".*/" "" subdir_name "${subdir}")
+        if(NOT ${n} EQUAL 0 AND NOT "${subdir_name}" STREQUAL "detail")
+            set(subdir_header_abs "${subdir}.h")
+            string(REPLACE "${prefix_to_remove}" "" subdir_header "${subdir_header_abs}")
+            list(APPEND ${out_headers} ${subdir_header})
+            #create file content
+            set(content "#pragma once\n\n// This file is generated!\n\n")
+            foreach(header ${headers})
+                string(REPLACE "${subdir}/" "${subdir_name}/" h "${header}")
+                set(content "${content}#include \"${h}\"\n")
+            endforeach()
+            #check for file change
+            simox_update_file("${subdir_header_abs}" "${content}")
+        endif()
+    endforeach()
+endmacro()