Adds libatomic to libraries to link against if the compiler requires it.
With cases like this it's usually preferred to do feature detection instead of checking for specific versions.
You should add a check with CMake to test whether a simple test program can be compiled with/without linking libatomic, or use an existing CheckAtomic.cmake from an appropriate source.
Turns out there is a CheckAtomic.cmake already created, in the LLVM project. I don't know how to handle licensing, I've never done it before, so I included the license in the file copied over from LLVM.
Alright so this patch was long overdue to be fixed, considering how simple the fix turned out to be.
I've tested it out on FreeBSD under KVM and it compiled just fine.
I haven't yet ran all tests, I'll send another message when I deem the patch ready to merge.