set(WAYLAND_FOUND FALSE)

find_path(_WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h)
find_path(_WAYLAND_EXTENSIONS_INCLUDE_DIR NAMES xdg-shell-client-protocol.h HINTS ENV WAYLAND_EXTENSION_DIR)
find_library(_WAYLAND_CLIENT_LIBRARY NAMES wayland-client libwayland-client)

if (_WAYLAND_CLIENT_INCLUDE_DIR AND _WAYLAND_EXTENSIONS_INCLUDE_DIR AND _WAYLAND_CLIENT_LIBRARY)
    set(WAYLAND_FOUND TRUE)
    set(WAYLAND_INCLUDE_DIRS ${_WAYLAND_EXTENSIONS_INCLUDE_DIR})
    set(WAYLAND_XDG_SOURCE ${_WAYLAND_EXTENSIONS_INCLUDE_DIR}/xdg-shell-protocol.cpp)
    set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARY} wayland-egl)
endif()