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

MACRO(CONFIGVAL result varname)
  string(REGEX MATCH "(${varname}=([\ A-Za-z0-9\_\.\"/-]+))" varstrg ${configfile})
  if (varstrg)
    string(REGEX MATCH "^[^=]+" var ${varstrg})
    string(REPLACE "${var}=" "" Value ${varstrg})
    string(REPLACE \" "" varout ${Value})
  endif()
  SET(${result} ${varout})
ENDMACRO()

MACRO(GETCONFIG result varname)
  string(REGEX MATCH "(${varname})=y" varstrg ${configfile})
  if (varstrg)
    SET(${result} y)
  else ()
    SET(${result} n)
  endif()
ENDMACRO()
