# Find GLES2
#
# GLES2_INCLUDE_DIRS
# GLES2_LIBRARIES
# GLES2_FOUND

find_package(PkgConfig)

pkg_check_modules(PC_GLES2 glesv2)

if (PC_GLES2_FOUND)
    set(GLES2_DEFINITIONS ${PC_GLES2_CFLAGS} ${PC_GLES2_CFLAGS_OTHER})
endif ()

find_path(GLES2_INCLUDE_DIRS NAMES "GLES2/gl2.h"
        HINTS ${PC_GLES2_INCLUDEDIR} ${PC_GLES2_INCLUDE_DIRS})

find_library(GLES2_LIBRARIES NAMES "GLESv2"
        HINTS ${PC_GLES2_LIBDIR} ${PC_GLES2_LIBRARY_DIRS})

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLES2 DEFAULT_MSG GLES2_INCLUDE_DIRS GLES2_LIBRARIES)

mark_as_advanced(GLES2_INCLUDE_DIRS GLES2_LIBRARIES)
