Checking for both a CMake config file and a pkg-config file is needed because some distros only ship the latter. Related to #6833 and #7044