Fix cmake script to compile on linux/osx