find_library: Misses libraries with mismatched CMAKE_LIBRARY_ARCHITECTURE between the compiler and toolchain
As an example, attempting a build with clang15.0.3 from https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.3/clang+llvm-15.0.3-powerpc64le-linux-ubuntu-18.04.5.tar.xz on a PowerPC machine causes CMake to set CMAKE_LIBRARY_ARCHITECTURE to powerpc64le-unknown-linux-gnu because that is the arch subdirectory where Clang puts its libraries. However, that version of clang obviously does not include the complete toolchain, so it relies on the GNU toolchain that is part of the system.
Most system GNU toolchains on PowerPC place libraries in powerpc64le-linux-gnu. Then when CMake attempts to build a list of search paths for libraries, it appends CMAKE_LIBRARY_ARCHITECTURE to the system toolchain paths which of course do not exist (because of the presence of -unknown in the arch subdirectory). This in turn makes CMake unable to find libraries and we get output such as:
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
(I suppose the string that outlines the version that seems to disagree with the statement that it could NOT find the library is because clang itself knows how to find the headers and libraries for ZLIB)