Generic PLATFORM_LIBRARIES var

This both reduces redundancy in add_executable definitions, and makes it easier to link additional libraries. In particular, extra libraries are needed on OSX - see next commit.
Link Cocoa, IOKit and CoreVideo on OSX

These are implicitly linked by Xcode, but with this, you can also build it with any other generator, which does not have this behavior.

CoreFoundation is included as a part of Cocoa (which is an umbrella framework), and Cocoa is generally recommended to link against, rather than its individual components (CoreFoundation, Foundation, libobjc, ...).
Use -pthread where and only where needed

Passing -pthread to GCC as a flag makes it both link to libpthread, and make C standard library routines reentrant. This makes the additional explicit links unnecessary.

Additionally, on OSX, this is the default behavior, and clang will print a message about it being unused if it's present there.

I still have to test this on a Linux machine, but the theory is sound.