From: Kornel Benko Date: Wed, 20 Jul 2016 00:10:23 +0000 (+0200) Subject: Cmake build with Qt4: Link lyx executable also to X11 library X-Git-Tag: 2.3.0alpha1~1230 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=64b298902017e628a7cf5a75b65b7a192c9dc04c;p=features.git 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. --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ffcb34debd..0c56ce62e4 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)