Only link qml/gl with the GL libraries.

Also, use -framework on darwin, as suggested by Raffaele Sena.