CMake: don't require GL when build with -no-opengl

Task-number: QTBUG-36509
Change-Id: I03451527ab91754d87ff2a43985952c7c7641826
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>