This patch updates the CMakeLists.txt file for the LLVM Intel JIT event listener to fix a problem I encountered when building on Windows. It also incorporates changes from D16883 which I was preparing for commit when I encountered the Windows problem (see https://llvm.org/bugs/show_bug.cgi?id=26433).
Rafael, I am asking you to review this because you authored the previous change which introduced the pthread and libdl dependencies (which are needed on Linux but cause failures on Windows). I've tested this on Windows and on Linux (with and without the -DBUILD_SHARED_LIBS=ON option on Linux), but I'm always finding new subtleties in the build system that I've overlooked so I figure it's worth having you take a look to make sure I didn't re-break something you fixed with the previous change.
I'm hoping these changes can be made in the 3.8 branch as well.