Qt5 cmake fixes

A series of fixes on top of PCMan qt5 branch.