On Sun, Jul 10, 2016 at 10:47:08AM +0200, Kornel Benko wrote: > Am Samstag, 9. Juli 2016 um 21:26:51, schrieb Enrico Forestieri > <for...@lyx.org> > > 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. > > OK, next try.
I suggest that I commit the previous patch you posted and then you can start from there. As regards the name of variables, I suggest that you simply rename QT_USES_X11 as HAVE_QT5_X11_EXTRAS, because that is what really that test is for. If you need to use QT_USES_X11 somewhere else, it should be set to true if QPA_XCB is true, because that is what really guarantees that X11 is the default backend. > diff --git a/CMakeLists.txt b/CMakeLists.txt > index 76cbdde..74d0ac8 100644 > --- a/CMakeLists.txt > +++ b/CMakeLists.txt > @@ -925,11 +925,6 @@ endif() > include(${LYX_CMAKE_DIR}/ConfigureChecks.cmake) > configure_file(${LYX_CMAKE_DIR}/configCompiler.h.cmake > ${TOP_BINARY_DIR}/configCompiler.h) > > -set(QPA_XCB) > -if(Qt5X11Extras_FOUND AND QT_USES_X11) > - # QPA_XCB is only valid if QT5+X11 > - set(QPA_XCB 1) > -endif() > configure_file(${LYX_CMAKE_DIR}/config.h.cmake ${TOP_BINARY_DIR}/config.h) > > if(QTVERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*") > diff --git a/development/cmake/ConfigureChecks.cmake > b/development/cmake/ConfigureChecks.cmake > index 46d3f80..2d5c166 100644 > --- a/development/cmake/ConfigureChecks.cmake > +++ b/development/cmake/ConfigureChecks.cmake > @@ -12,6 +12,7 @@ include(CheckFunctionExists) > include(CheckLibraryExists) > include(CheckTypeSize) > include(CheckCXXSourceCompiles) > +include(CheckCXXSourceRuns) > include(MacroBoolTo01) > include(TestBigEndian) > > @@ -197,7 +198,30 @@ else() > endif() > endif() > > +set(QPA_XCB) > +set(HAVE_QT5_X11_EXTRAS) > if(LYX_USE_QT MATCHES "QT5") > + > + set(CMAKE_REQUIRED_INCLUDES ${Qt5Core_INCLUDE_DIRS}) > + set(CMAKE_REQUIRED_FLAGS) > + #message(STATUS "Qt5Core_INCLUDE_DIRS = ${Qt5Core_INCLUDE_DIRS}") > + check_cxx_source_runs( > + " > + #include <QtCore/qconfig.h> > + #include <string> > + using namespace std; > + string a(QT_QPA_DEFAULT_PLATFORM_NAME); > + int main(int argc, char **argv) > + { > + if (a.compare(\"xcb\") == 0) > + return(0); > + else > + return 1; > + } > + " > + QT_XCB_FOUND) > + set(QPA_XCB ${QT_XCB_FOUND}) > + > if (Qt5X11Extras_FOUND) > get_target_property(_x11extra_prop Qt5::X11Extras > IMPORTED_CONFIGURATIONS) > get_target_property(_x11extra_link_libraries Qt5::X11Extras > IMPORTED_LOCATION_${_x11extra_prop}) > @@ -216,6 +240,7 @@ if(LYX_USE_QT MATCHES "QT5") > } > " > QT_USES_X11) > + set(HAVE_QT5_X11_EXTRAS ${QT_USES_X11}) > endif() > if (Qt5WinExtras_FOUND) > get_target_property(_winextra_prop Qt5::WinExtras > IMPORTED_CONFIGURATIONS) -- Enrico