From 93831428589d417c51740ba4c4e7e76c7c526603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 6 Feb 2019 16:01:18 +0100 Subject: [PATCH] cmake: manually run pkg-config --variable=pkgdatadir wayland-protocols To get the path to the wayland protocol definitions, manually run pkg-config with --variable=pkgdatadir. Then use this instead of a hardcoded path into /usr/share/wayland-protocols when defining the custom commands to generate .c/.h files from the protocol XML definitions. --- CMakeLists.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd9cec2..68cce9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,23 +72,28 @@ if (ENABLE_WAYLAND) VERBATIM MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/external/wlroots/protocol/wlr-layer-shell-unstable-v1.xml ) + + execute_process( + COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols + OUTPUT_VARIABLE WAYLAND_PROTOCOLS + OUTPUT_STRIP_TRAILING_WHITESPACE) add_custom_command( OUTPUT xdg-shell.c - COMMAND wayland-scanner private-code < /usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml > xdg-shell.c + COMMAND wayland-scanner private-code < ${WAYLAND_PROTOCOLS}/stable/xdg-shell/xdg-shell.xml > xdg-shell.c VERBATIM - MAIN_DEPENDENCY /usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml + MAIN_DEPENDENCY ${WAYLAND_PROTOCOLS}/stable/xdg-shell/xdg-shell.xml ) add_custom_command( OUTPUT xdg-output-unstable-v1-client.h - COMMAND wayland-scanner client-header < /usr/share/wayland-protocols/unstable/xdg-output/xdg-output-unstable-v1.xml > xdg-output-unstable-v1-client.h + COMMAND wayland-scanner client-header < ${WAYLAND_PROTOCOLS}/unstable/xdg-output/xdg-output-unstable-v1.xml > xdg-output-unstable-v1-client.h VERBATIM - MAIN_DEPENDENCY /usr/share/wayland-protocols/unstable/xdg-output/xdg-output-unstable-v1.xml + MAIN_DEPENDENCY ${WAYLAND_PROTOCOLS}/unstable/xdg-output/xdg-output-unstable-v1.xml ) add_custom_command( OUTPUT xdg-output-unstable-v1.c - COMMAND wayland-scanner private-code < /usr/share/wayland-protocols/unstable/xdg-output/xdg-output-unstable-v1.xml > xdg-output-unstable-v1.c + COMMAND wayland-scanner private-code < ${WAYLAND_PROTOCOLS}/unstable/xdg-output/xdg-output-unstable-v1.xml > xdg-output-unstable-v1.c VERBATIM - MAIN_DEPENDENCY /usr/share/wayland-protocols/unstable/xdg-output/xdg-output-unstable-v1.xml + MAIN_DEPENDENCY ${WAYLAND_PROTOCOLS}/unstable/xdg-output/xdg-output-unstable-v1.xml ) add_library(wayland-protocols STATIC EXCLUDE_FROM_ALL