Fix OSX-compatible build on Linux
Use cmake-defined platform macros instead of cpp macro detection.

Allows cppcheck to run without whining.