MACRO(GetListOfSubDirectories result curdir)
  FILE(GLOB_RECURSE  children LIST_DIRECTORIES ON RELATIVE ${curdir} ${curdir}/*)
  SET(dirlist "")
  FOREACH(child ${children})
    IF(IS_DIRECTORY ${curdir}/${child})
      LIST(APPEND dirlist ${curdir}/${child})
    ENDIF()
  ENDFOREACH()
  SET(${result} ${dirlist})
ENDMACRO()


# TODO
MACRO(GetListOfAllFilesInSubDirectories result dirlist filename)
  SET(filelist "")
  FOREACH(dir ${${dirlist}})
    FILE(GLOB file   ${dir}/${filename})
    IF(IS_DIRECTORY ${file})
    ELSE()
        LIST(APPEND filelist ${file})
        message(STATUS "file = ${file}")
    ENDIF()
  ENDFOREACH()
  SET(${result} ${filelist})
ENDMACRO()

FUNCTION(print_foreach input)
    FOREACH(element ${${input}})
        message(STATUS "${input}: ${element}")
    ENDFOREACH()
ENDFUNCTION()

FUNCTION(print input)
     message(STATUS "${input}: ${${input}}")
ENDFUNCTION()
