title: Effective way of detecting X11 vs Wayland, preferrably with CMake
body: <p>So I've done some Google searching and this is something that has very little knowledge out there. What would be an effective and foolproof way of detecting whether X11 or Wayland is in use, preferrably at compile-time and with CMake? I need to apply this to a C++ project of mine.</p>