# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/extra-cmake-modules/hotfix-cross-sysroot-datadir.patch # Copyright (C) 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- --- extra-cmake-modules-6.29.0/find-modules/FindWayland.cmake.orig +++ extra-cmake-modules-6.29.0/find-modules/FindWayland.cmake @@ -120,12 +120,10 @@ ) pkg_get_variable(Wayland_DATADIR wayland-scanner pkgdatadir) -if (CMAKE_CROSSCOMPILING AND (NOT EXISTS "${Wayland_DATADIR}/wayland.xml")) +if (CMAKE_CROSSCOMPILING AND EXISTS "${CMAKE_SYSROOT}${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 + # does not prepend CMAKE_SYSROOT when cross-compiling. Always prefer the + # sysroot copy over the build host's, which may be a different version. set(Wayland_DATADIR ${CMAKE_SYSROOT}${Wayland_DATADIR}) endif() if (NOT EXISTS "${Wayland_DATADIR}/wayland.xml") --- extra-cmake-modules-6.29.0/find-modules/FindWaylandProtocols.cmake.orig +++ extra-cmake-modules-6.29.0/find-modules/FindWaylandProtocols.cmake @@ -25,6 +25,10 @@ set(WaylandProtocols_VERSION ${PKG_wayland_protocols_VERSION}) pkg_get_variable(WaylandProtocols_DATADIR wayland-protocols pkgdatadir) +if (CMAKE_CROSSCOMPILING AND EXISTS "${CMAKE_SYSROOT}${WaylandProtocols_DATADIR}") + # prefer the sysroot copy over the build host's, which may be a different version + set(WaylandProtocols_DATADIR ${CMAKE_SYSROOT}${WaylandProtocols_DATADIR}) +endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(WaylandProtocols