SET(K3D_OPENGL_FOUND 0)

FIND_PACKAGE(OpenGL)

pkg_search_module(GLEW glewmx glew)

IF(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLEW_FOUND)
  SET(K3D_OPENGL_INCLUDE_DIR ${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_DIRS})
  SET(K3D_OPENGL_LIBRARIES ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES})
	SET(K3D_GLEW_VERSION ${GLEW_VERSION})
	string(REPLACE "." ";" GLEW_VERSION_LIST ${GLEW_VERSION})
	list(GET GLEW_VERSION_LIST 0 K3D_GLEW_MAJOR_VERSION)
  SET(K3D_OPENGL_FOUND 1)
ENDIF()
