diff options
author | Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> | 2021-10-05 11:24:38 +0100 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2021-10-21 20:40:08 +0000 |
commit | 0516940f89f0b30d40e86c92b2876398de14cdb0 (patch) | |
tree | b6d7981240f6bcc56e52ac6824c29f10751947f2 | |
parent | e62246c5ee18649e4e89eb69a4cf51b2586ced83 (diff) | |
download | extra-cmake-modules-0516940f89f0b30d40e86c92b2876398de14cdb0.tar.gz extra-cmake-modules-0516940f89f0b30d40e86c92b2876398de14cdb0.tar.bz2 |
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.
-rw-r--r-- | find-modules/FindWayland.cmake | 11 |
1 files changed, 11 insertions, 0 deletions
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 |