This work was spawned by a Gentoo Prefix downstream report: https://bugs.gentoo.org/733480
Gentoo Prefix is an installation of Gentoo on an offset location on e.g. another distribution or even MacOS or Windows.
The problem is that cmake inside the Prefix installation makes wrong assumptions if the root distribution is e.g. Debian. cmake modules in various places are making checks if
/etc/debian_version exists (
/etc/arch-release in one place) to guess libdir name. This MR would move that check to one central place and provides an override option to not perform these detections. It could in the future also be expanded with further special cases if need be.