Add a USE dependency for OpenGL implementation (look at kwin ebuild). In addition to the find_package calls, it does this (see Modules/CMakeLists.txt):

if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GL"))