CMake: support for linking against qt5

Here's the needed cmake changes in order to link against qt5 or qt4. Qt4 still works; if both qt4 and qt5 are available, qt5 get picked up first.
I saw some code still needs fixing in order to compile correctly against qt5.