Fix cmake on OSX

Resolves #307