include(${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)

macro(CHECK_TYPE_SIZE_EX TYPE HEADER VARIABLE)
  set(CMAKE_EXTRA_INCLUDE_FILES ${HEADER})
  CHECK_TYPE_SIZE(${TYPE} ${VARIABLE})
  if(HAVE_${VARIABLE})
    set(HAVE_${VARIABLE} 1)
  else()
    set(HAVE_${VARIABLE} 0)
  endif()
  set(CMAKE_EXTRA_INCLUDE_FILES)
endmacro(CHECK_TYPE_SIZE_EX)

macro(FIND_DIRS_RECURSIVE VARIABLE REGEX PATH)
    file(GLOB children RELATIVE "${PATH}" ${PATH}/*)
    foreach(child ${children})
        if(IS_DIRECTORY ${PATH}/${child})
            if(child MATCHES "${REGEX}")
                list(APPEND ${VARIABLE} "${PATH}/${child}")
            endif()
            FIND_DIRS_RECURSIVE("${VARIABLE}" "${REGEX}" "${PATH}/${child}")
        endif()
    endforeach()
endmacro(FIND_DIRS_RECURSIVE)