FindWayland.cmake 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # - Find Wayland
  2. # Find the Wayland includes and libraries
  3. #
  4. # Following variables are provided:
  5. # WAYLAND_FOUND
  6. # True if Wayland has been found
  7. # WAYLAND_INCLUDE_DIRS
  8. # The include directories of Wayland
  9. # WAYLAND_LIBRARIES
  10. # Wayland library list
  11. find_package(PkgConfig REQUIRED)
  12. if(NOT PKGCONFIG_FOUND)
  13. message(FATAL_ERROR "Pkg-config not found.")
  14. endif()
  15. pkg_check_modules(PKG_WAYLAND QUIET wayland-client)
  16. if(PKG_WAYLAND_FOUND)
  17. set(WAYLAND_VERSION ${PKG_WAYLAND_VERSION})
  18. else()
  19. set(WAYLAND_VERSION 0)
  20. endif()
  21. find_path(WAYLAND_CLIENT_INCLUDE_DIR wayland-client.h)
  22. find_path(WAYLAND_CURSOR_INCLUDE_DIR wayland-cursor.h)
  23. find_path(WAYLAND_EGL_INCLUDE_DIR wayland-egl.h)
  24. find_path(XKBCOMMON_INCLUDE_DIR xkbcommon/xkbcommon.h)
  25. find_library(WAYLAND_CLIENT_LIBRARY NAMES wayland-client)
  26. find_library(WAYLAND_CURSOR_LIBRARY NAMES wayland-cursor)
  27. find_library(WAYLAND_EGL_LIBRARY NAMES wayland-egl)
  28. find_library(XKBCOMMON_LIBRARY NAMES xkbcommon)
  29. include(FindPackageHandleStandardArgs)
  30. find_package_handle_standard_args(Wayland DEFAULT_MSG WAYLAND_CLIENT_LIBRARY
  31. WAYLAND_CURSOR_LIBRARY
  32. WAYLAND_EGL_LIBRARY
  33. XKBCOMMON_LIBRARY
  34. WAYLAND_CLIENT_INCLUDE_DIR
  35. WAYLAND_CURSOR_INCLUDE_DIR
  36. WAYLAND_EGL_INCLUDE_DIR
  37. XKBCOMMON_INCLUDE_DIR)
  38. set(WAYLAND_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIR}
  39. ${WAYLAND_CURSOR_INCLUDE_DIR}
  40. ${WAYLAND_EGL_INCLUDE_DIR}
  41. ${XKBCOMMON_INCLUDE_DIR})
  42. set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARY}
  43. ${WAYLAND_CURSOR_LIBRARY}
  44. ${WAYLAND_EGL_LIBRARY}
  45. ${XKBCOMMON_LIBRARY})
  46. list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIRS)
  47. list(REMOVE_DUPLICATES WAYLAND_LIBRARIES)
  48. mark_as_advanced(WAYLAND_CLIENT_LIBRARY
  49. WAYLAND_CURSOR_LIBRARY
  50. WAYLAND_EGL_LIBRARY
  51. XKBCOMMON_LIBRARY
  52. WAYLAND_CLIENT_INCLUDE_DIR
  53. WAYLAND_CURSOR_INCLUDE_DIR
  54. WAYLAND_EGL_INCLUDE_DIR
  55. XKBCOMMON_INCLUDE_DIR)