commit 64b298902017e628a7cf5a75b65b7a192c9dc04c
Author: Kornel Benko <[email protected]>
Date:   Wed Jul 20 02:10:23 2016 +0200

    Cmake build with Qt4: Link lyx executable also to X11 library
    
    With the commit cb0c881 we reference XSendEvent in X11-lib
    if qt uses X11.
    For QT5, this library is pulled by Qt5X11Extras, but
    for QT4 we have to add it too.
    
    Spotted by Scott Kostyshak.
---
 src/CMakeLists.txt |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ffcb34d..0c56ce6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -134,12 +134,16 @@ target_link_libraries(${_lyx}
 
 qt_use_modules(${_lyx} Core Gui)
 
-if(QT_HAS_X11_EXTRAS)
-  find_library(XCB_LIBRARY NAMES xcb)
-  if (XCB_LIBRARY MATCHES "NOTFOUND")
-    message(FATAL_ERROR "Need xcb library to use with QT5_X11_EXTRAS")
+if(QT_USES_X11)
+  find_package(X11 REQUIRED)
+  target_link_libraries(${_lyx} ${X11_X11_LIB}) # we need it because we use 
XSendEvent
+  if(HAVE_QT5_X11_EXTRAS)
+    find_library(XCB_LIBRARY NAMES xcb)
+    if (XCB_LIBRARY MATCHES "NOTFOUND")
+      message(FATAL_ERROR "Need xcb library to use with QT5_X11_EXTRAS")
+    endif()
+    target_link_libraries(${_lyx} ${LYX_QT5_X11_EXTRAS_LIBRARY} ${XCB_LIBRARY})
   endif()
-  target_link_libraries(${_lyx} ${LYX_QT5_X11_EXTRAS_LIBRARY} ${XCB_LIBRARY})
 endif()
 
 lyx_target_link_libraries(${_lyx} HUNSPELL ASPELL ENCHANT Magic)

Reply via email to