# Try to find mangled Mesa libraries and include dir.
# Once done this will define
#
#  MANGLED_MESA_INCLUDE_DIR
#  MANGLED_MESA_LIBRARY
#  MANGLED_OSMESA_INCLUDE_DIR
#  MANGLED_OSMESA_LIBRARY

IF (NOT MANGLED_MESA_INCLUDE_DIR)
  FIND_PATH(MANGLED_MESA_INCLUDE_DIR GL/gl_mangle.h )
ENDIF (NOT MANGLED_MESA_INCLUDE_DIR)

IF (NOT MANGLED_MESA_LIBRARY)
  FIND_LIBRARY(MANGLED_MESA_LIBRARY MesaGL)
ENDIF (NOT MANGLED_MESA_LIBRARY)

IF (NOT MANGLED_OSMESA_INCLUDE_DIR)
  FIND_PATH(MANGLED_OSMESA_INCLUDE_DIR GL/osmesa.h)
ENDIF (NOT MANGLED_OSMESA_INCLUDE_DIR)

IF (NOT MANGLED_OSMESA_LIBRARY)
  FIND_LIBRARY(MANGLED_OSMESA_LIBRARY OSMesa)
ENDIF (NOT MANGLED_OSMESA_LIBRARY)

MARK_AS_ADVANCED(MANGLED_MESA_INCLUDE_DIR MANGLED_MESA_LIBRARY
                 MANGLED_OSMESA_INCLUDE_DIR MANGLED_OSMESA_LIBRARY)
