This patch is a squash for:
https://reviews.llvm.org/D74564
https://reviews.llvm.org/D74907
And a fix for the issue that got both changes reverted. The case on Windows when both STATIC and SHARED options were generated, which on on Windows is not possible.
Essentially, this is the fix: don't try to build both libclang.lib for static linking and libclang.dll (and implicitly libclang.lib) on Windows. Is that accurate?