GLEW does not support GLX and EGL at the same time, and the distribution version is likely to have GLX.
This also refactors the code so all OpenGL related CMake options are together.
#### Context for Original Patch
To eventually support Wayland, Blender has to support OpenGL context creation via EGL.
The reason to enable EGL for X11 too are:
# GLEW does not support GLX and EGL at the same time. Most distributions build GLEW with GLX support, so we have to use the externally provided GLEW and build with EGL support.
# Using EGL for X11 and Wayland allows us to remove `GHOST_ContextGLX` in the long-term and to better support window-less context creation for offscreen rendering.
# EGL is not tied to X11 and therefore considered the better option to support other windowing systems, especially embedded systems, such as those used by Android, webOS, Raspberry Pi VideoCore
Ideally, all EGL context creation (in X11 and Wayland) would use GLVND and link `libOpenGL` and `libEGL`. However, Blender is in the unfortunate position of distributing binary packages without all the required libraries and thus relies on distributions to have those libraries installed by default. This would not be an issue for packaged Blender versions (deb, flatpak, snap) as those would include the dependencies. The OpenGL functions and symbols (gl*) are defined in `libOpenGL` (the GLVND way) and `libGL` (the old legacy way). Since `libOpenGL` is nether installed by default nor does Blender have a way to install it, we just link against `libGL` to get the OpenGL symbols.
This prepares the GLEW and GLES settings to support building with EGL.