From 0516940f89f0b30d40e86c92b2876398de14cdb0 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Tue, 5 Oct 2021 11:24:38 +0100 Subject: Fix Wayland_DATADIR when cross-compiling PKG_CONFIG_SYSROOT_DIR only applies to -I and -L flags, so pkg-config does not prepend CMAKE_SYSROOT when cross-compiling unless you pass --define-prefix explicitly. Therefore we have to manually do prepend it here when cross-compiling. See https://gitlab.kitware.com/cmake/cmake/-/issues/16647#note_844761. With this change I no longer get errors related to wayland.xml when cross-compiling KWaylandServer. --- find-modules/FindWayland.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/find-modules/FindWayland.cmake b/find-modules/FindWayland.cmake index 4b6eb403..22558f7e 100644 --- a/find-modules/FindWayland.cmake +++ b/find-modules/FindWayland.cmake @@ -118,6 +118,17 @@ find_package_handle_standard_args(Wayland ) pkg_get_variable(Wayland_DATADIR wayland-server pkgdatadir) +if (CMAKE_CROSSCOMPILING AND (NOT EXISTS "${Wayland_DATADIR}/wayland.xml")) + # PKG_CONFIG_SYSROOT_DIR only applies to -I and -L flags, so pkg-config + # does not prepend CMAKE_SYSROOT when cross-compiling unless you pass + # --define-prefix explicitly. Therefore we have to manually do prepend + # it here when cross-compiling. + # See https://gitlab.kitware.com/cmake/cmake/-/issues/16647#note_844761 + set(Wayland_DATADIR ${CMAKE_SYSROOT}${Wayland_DATADIR}) +endif() +if (NOT EXISTS "${Wayland_DATADIR}/wayland.xml") + message(WARNING "Could not find wayland.xml in ${Wayland_DATADIR}") +endif() include(FeatureSummary) set_package_properties(Wayland PROPERTIES -- cgit v1.2.1