Use proper dependencies in compile tests
Upstream change: https://codereview.qt-project.org/c/qt/qtwayland/+/393967
Use the dependencies as found by the "libraries" section instead of relying
on them being available in the default location (e.g. "-ldrm").
Additionally, VK_USE_PLATFORM_WAYLAND_KHR requires <wayland-client.h>, so
add the wayland-client dependency.
This fixes those tests if e.g. wayland-client headers need to be found through
pkgconfig.
This part of the code changed completely in Qt 6, so this is a totally
different patch and not a cherry-pick of 5fc2e1915c3a
("CMake: Fix qtwayland feature detection").
Fixes: QTBUG-100475