macro(CHECK_MMDEP option depends)
  set(${option}_AVAILABLE 1)
  set(missing)
  foreach(d ${depends})
    string(REGEX REPLACE " +" ";" CMAKE_DEPENDENT_OPTION_DEP "${d}")
    if(${CMAKE_DEPENDENT_OPTION_DEP})
    else()
      set(${option}_AVAILABLE 0)
      list(APPEND missing ${CMAKE_DEPENDENT_OPTION_DEP})
    endif()
  endforeach(d ${depends})
  if(NOT ${option}_AVAILABLE)
    unset(DEP_LIST CACHE)
    message(FATAL_ERROR "To enable ${option}, you need to also enable ${missing}")
  endif()
endmacro()
