build/meson: fix x11 test/demo compilation with non-standard xcb The x11 tests/demos did not depend on xcb and xcb-xkb directly, only indirectly through link_with: libxkbcommon_x11_internal. So linking worked, but the xcb and xcb-xkb cflags were *not* included when compiling them. So when using xcb installed in a non-standard location, what would happen is: - Library will link with custom xcb and compile with custom xcb headers. - Test will link with custom xcb and compile with system xcb headers (if exist, otherwise fail). Fixes: https://github.com/xkbcommon/libxkbcommon/issues/57 Reported-by: @remexre Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
diff --git a/meson.build b/meson.build
index 22b33d7..bf4a5f8 100644
--- a/meson.build
+++ b/meson.build
@@ -284,6 +284,16 @@ test_dep = declare_dependency(
include_directories: include_directories('src'),
link_with: libxkbcommon_test_internal,
)
+if get_option('enable-x11')
+ x11_test_dep = declare_dependency(
+ link_with: libxkbcommon_x11_internal,
+ dependencies: [
+ test_dep,
+ xcb_dep,
+ xcb_xkb_dep,
+ ],
+ )
+endif
test(
'keysym',
executable('test-keysym', 'test/keysym.c', dependencies: test_dep),
@@ -362,12 +372,12 @@ test(
if get_option('enable-x11')
test(
'x11',
- executable('test-x11', 'test/x11.c', dependencies: test_dep, link_with: libxkbcommon_x11_internal),
+ executable('test-x11', 'test/x11.c', dependencies: x11_test_dep),
env: test_env,
)
# test/x11comp is meant to be run, but it is (temporarily?) disabled.
# See: https://github.com/xkbcommon/libxkbcommon/issues/30
- executable('test-x11comp', 'test/x11comp.c', dependencies: test_dep, link_with: libxkbcommon_x11_internal)
+ executable('test-x11comp', 'test/x11comp.c', dependencies: x11_test_dep)
endif
@@ -378,7 +388,7 @@ if cc.has_header('linux/input.h')
executable('interactive-evdev', 'test/interactive-evdev.c', dependencies: test_dep)
endif
if get_option('enable-x11')
- executable('interactive-x11', 'test/interactive-x11.c', dependencies: test_dep, link_with: libxkbcommon_x11_internal)
+ executable('interactive-x11', 'test/interactive-x11.c', dependencies: x11_test_dep)
endif
if get_option('enable-wayland')
wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: false)