build with cmake
fix build errors with clang
cmake: only do -Wl,-Bsymbolic on unix environments
fix build on OSX