On Sat, Jul 09, 2016 at 09:02:09PM +0200, Enrico Forestieri wrote: > > Then, looking at development/cmake/ConfigureChecks.cmake, it seems to > me that QT_USES_X11 is correctly set for Qt4, because the QX11Info header > is always installed on all platforms and compilation fails if X11 is > not the correct backend. This is not true for Qt5, as QtX11Extras/QX11Info > is only present if the Qt5X11Extras module is installed, and not otherwise. > So, compilation of the code snippet at lines 212-216 may fail even if X11 > is the backend, so that QT_USES_X11 may not be correctly guessed with Qt5.
Sorry, I now see that it is guarded by "if (Qt5X11Extras_FOUND)". In this case, the last sentence above should read: So, compilation of the code snippet at lines 212-216 is not attempted even if X11 is the backend, so that QT_USES_X11 may not be guessed with Qt5. A more safe approach is based on looking at QtCore/qconfig.h, which directly tells you what is the default backend. Indeed it contains #define QT_QPA_DEFAULT_PLATFORM_NAME "xcb" if X11 is the backend. -- Enrico