2 #add_subdirectory(tests)
3 KDE4_NO_ENABLE_FINAL(kxkb)
5 OPTION(USE_XKLAVIER "Use libxklavier to get keyboard layouts configuration" ON)
7 #if we are in here, we know that the X extension for Xkb is available.
9 SET(HAVE_XKLAVIER FALSE)
10 if(USE_XKLAVIER STREQUAL ON)
11 macro_optional_find_package(LibXKlavier)
12 macro_optional_find_package(GObject)
14 if(LIBXKLAVIER_FOUND AND GLIB2_FOUND AND GOBJECT_FOUND)
15 SET(HAVE_XKLAVIER TRUE)
17 SET(CMAKE_REQUIRED_DEFINITIONS ${LIBXKLAVIER_DEFINITIONS})
18 SET(CMAKE_REQUIRED_LIBRARIES ${LIBXKLAVIER_LIBRARIES})
20 SET(XKB_SUPPORT_SRC xklavier_adaptor.cpp)
21 SET(XKB_SUPPORT_LIB ${LIBXKLAVIER_LIBRARIES} ${GOBJECT_LIBRARIES})
22 ADD_DEFINITIONS(-DHAVE_XKLAVIER=1 ${LIBXKLAVIER_DEFINITIONS} ${_LibGLIB2Cflags})
23 include_directories(${GLIB2_INCLUDE_DIR})
25 else(LIBXKLAVIER_FOUND AND GLIB2_FOUND AND GOBJECT_FOUND)
26 MESSAGE(STATUS "Could not find libxklavier >= 3.0, glib or gobject which are recommended for kxkb.")
27 endif(LIBXKLAVIER_FOUND AND GLIB2_FOUND AND GOBJECT_FOUND)
29 else(USE_XKLAVIER STREQUAL ON)
31 MESSAGE(STATUS "Will attempt to use xkbfile to get keyboard layouts, per user request.")
33 endif(USE_XKLAVIER STREQUAL ON)
35 # we can build against libxklavier+xkbfile or xkbfile alone, but libxklavier+xbfile is preferred
38 # cannot use libxklavier, try xkbfile
39 if(NOT X11_Xkbfile_FOUND)
41 MESSAGE(STATUS "\n Could not find libxklavier or xkbfile - kxkb won't be built!\n Please install libxklavier\n--")
42 else(NOT X11_Xkbfile_FOUND)
43 # oh well, xkbfile it is
44 SET(XKB_SUPPORT_LIB ${X11_Xkbfile_LIB})
45 MESSAGE(STATUS "Using xkbfile to get keyboard layouts for kxkb")
46 endif(NOT X11_Xkbfile_FOUND)
47 endif(NOT HAVE_XKLAVIER)
49 if(USE_XKLAVIER STREQUAL ON)
50 macro_log_feature(LIBXKLAVIER_FOUND "libxklavier" "A XKB foundation library for keyboard handling software" "http://freedesktop.org/wiki/Software/LibXklavier" FALSE "3.0" "Recommended for kxkb, the KDE keyboard map switching utility.")
51 endif(USE_XKLAVIER STREQUAL ON)
52 macro_log_feature(X11_Xkbfile_FOUND "xkbfile" "X11 KXB library for keyboard handling software" "http://www.x.org" FALSE "" "xkbfile is required to build kxkb.")
54 macro_bool_to_01(X11_Xinput_FOUND HAVE_XINPUT)
55 ADD_DEFINITIONS(-DHAVE_XINPUT=${HAVE_XINPUT})
57 if(X11_Xkbfile_FOUND AND HAVE_XKLAVIER)
59 #MESSAGE("xkb support libs:: ${XKB_SUPPORT_LIB}")
61 ########### common sources ############
72 ########### KCM ###############
74 set(kcm_keyboard_layout_PART_SRCS
79 kde4_add_ui_files(kcm_keyboard_layout_PART_SRCS kcmlayoutwidget.ui)
81 kde4_add_plugin(kcm_keyboard_layout ${kcm_keyboard_layout_PART_SRCS})
83 target_link_libraries(kcm_keyboard_layout ${KDE4_KIO_LIBS}
89 target_link_libraries(kcm_keyboard_layout ${X11_XTest_LIB})
90 endif(X11_XTest_FOUND)
93 target_link_libraries(kcm_keyboard_layout ${X11_Xinput_LIB})
94 endif(X11_Xinput_FOUND)
96 install(TARGETS kcm_keyboard_layout DESTINATION ${PLUGIN_INSTALL_DIR})
97 install(FILES keyboard_layout.desktop DESTINATION ${SERVICES_INSTALL_DIR})
100 ########### KXKB kdeinit ###############
102 set(kxkb_KDEINIT_SRCS ${kxkb_COMMON_SRCS}
111 kde4_add_kdeinit_executable(kxkb ${kxkb_KDEINIT_SRCS})
113 target_link_libraries(kdeinit_kxkb ${X11_X11_LIB} ${X11_Xext_LIB} ${KDE4_KDEUI_LIBS}
117 target_link_libraries(kdeinit_kxkb ${X11_Xinput_LIB})
118 endif(X11_Xinput_FOUND)
120 install(TARGETS kdeinit_kxkb ${INSTALL_TARGETS_DEFAULT_ARGS})
121 install(TARGETS kxkb ${INSTALL_TARGETS_DEFAULT_ARGS})
122 #install(FILES kxkb_component.h DESTINATION ${INCLUDE_INSTALL_DIR})
125 ########### KXKB Plasma Applet ###############
127 if(FALSE) # don't generate applet - it's not finished yet
129 set(plasma_applet_kxkb_SRCS kxkb_applet.cpp ${kxkb_COMMON_SRCS}
135 kde4_add_plugin(plasma_applet_kxkb ${plasma_applet_kxkb_SRCS})
137 target_link_libraries(plasma_applet_kxkb ${KDE4_PLASMA_LIBS}
138 ${KDE4_KDEUI_LIBS} ${XKB_SUPPORT_LIB})
141 target_link_libraries(plasma_applet_kxkb ${X11_XTest_LIB})
142 endif(X11_XTest_FOUND)
144 install(TARGETS plasma_applet_kxkb DESTINATION ${PLUGIN_INSTALL_DIR})
145 install(FILES plasma-applet-kxkb.desktop DESTINATION ${SERVICES_INSTALL_DIR})
147 ADD_DEPENDENCIES(plasma_applet_kxkb kdeinit_kxkb)
151 ########### KXKB KPart ###############
152 # we're not using KPart for now - it's too heavy
154 #set(kxkb_part_PART_SRCS kxkb_part.cpp)
156 #kde4_add_plugin(kxkb_part ${kxkb_part_PART_SRCS})
158 #target_link_libraries(kxkb_part kdeinit_kxkb
163 # target_link_libraries(kxkb_part ${X11_XTest_LIB})
164 #endif(X11_XTest_FOUND)
166 #install(TARGETS kxkb_part DESTINATION ${PLUGIN_INSTALL_DIR})
167 #install(FILES kxkb_part.desktop DESTINATION ${SERVICES_INSTALL_DIR})
168 ##install(FILES kxkb_part.rc DESTINATION ${DATA_INSTALL_DIR}/kxkb_part)
170 endif(X11_Xkbfile_FOUND AND HAVE_XKLAVIER)