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.
This commit is contained in:
Kornel Benko 2016-07-20 02:10:23 +02:00
parent 9940acc506
commit 64b2989020

View File

@ -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)