Trying to build llvm-mt with libxml2 enabled, on a system where
libxml2 and zlib had to be provided as static libraries, I found that
linking llvm-mt failed, because cmake had set up the link line so that
zlib.a came before libxml2.a. But libxml2 refers to zlib, and Unix ld
semantics only search each library once, so it was too late for ld to
go back to zlib and satisfy the unresolved references from libxml2.
This is the smallest fix I could find: reorder llvm-mt's
LLVM_LINK_COMPONENTS so that WindowsManifest (which adds the libxml2
dependency) comes before Support (which adds the zlib one). That way,
they end up on the link line in the opposite order, and the link
works.
I'm not very happy with this as a means of making sure it _stays_
fixed, on the other hand! I'd prefer to write some kind of explicit
rule that says libxml2 must appear before zlib. But I don't know if
cmake has such a thing.