diff --git a/CMakeLists.txt b/CMakeLists.txt index 04f3954350..0ceebc96a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -512,6 +512,7 @@ endif() find_package(Qt5Core QUIET) if (Qt5Core_FOUND) find_package(Qt5Widgets REQUIRED) + find_package(Qt5X11Extras) set(QTVERSION ${Qt5Core_VERSION}) macro (qt_use_modules) qt5_use_modules(${ARGN}) diff --git a/development/autotests/CMakeLists.txt b/development/autotests/CMakeLists.txt index 9a6e6c4e8c..c1e19a4aff 100644 --- a/development/autotests/CMakeLists.txt +++ b/development/autotests/CMakeLists.txt @@ -8,7 +8,7 @@ set(LYX_HOME "out-home") set(LOCALE_DIR "${CMAKE_CURRENT_BINARY_DIR}/locale") file(MAKE_DIRECTORY "${LOCALE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}") -if(Q_WS_X11) +if(QT_USES_X11) set(Missing) set(XVFBDLIBS) # Make sure, the needed programs are in PATH diff --git a/development/cmake/ConfigureChecks.cmake b/development/cmake/ConfigureChecks.cmake index 71291a53a5..035a62b0f6 100644 --- a/development/cmake/ConfigureChecks.cmake +++ b/development/cmake/ConfigureChecks.cmake @@ -112,3 +112,33 @@ check_cxx_source_compiles( " SIZEOF_WCHAR_T_IS_4) +if (Qt5X11Extras_FOUND) + get_target_property(_x11extra_prop Qt5::X11Extras IMPORTED_CONFIGURATIONS) + get_target_property(_x11extra_lib Qt5::X11Extras IMPORTED_SONAME_${_x11extra_prop}) + set(CMAKE_REQUIRED_LIBRARIES ${_x11extra_lib}) + set(CMAKE_REQUIRED_INCLUDES ${Qt5X11Extras_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_FLAGS ${Qt5X11Extras_EXECUTABLE_COMPILE_FLAGS}) + check_cxx_source_compiles( + " + #include + int main() + { + bool isX11 = QX11Info::isPlatformX11(); + } + " + QT_USES_X11) +elseif(QT4_FOUND) + set(CMAKE_REQUIRED_LIBRARIES ${QT_QTGUI_LIBRARY}) + set(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES}) + check_cxx_source_compiles( + " + #include + int main() + { + QX11Info *qxi = new QX11Info; + qxi->~QX11Info(); + } + " + QT_USES_X11) +endif() +