Would it be possible to allow the various detected libraries (libX11, KF5WaylandClient, Qt5X11Extras) to be disabled even if they're found to be installed?
An autoconf/configure cache variable would work well enough for our needs too.
In Gentoo, we refer to these as "automagic dependencies". They're problematic when building on a machine with many libraries installed where you wish to deploy the resultant binary on a system which might not have them installed. When the usage & linkage of libraries is unpredictable, we can't accurately set dependencies.