Cmake: Fix build issues

Fixes the build issues discussed and detailed in [this comment](https://github.com/Homebrew/homebrew/issues/29988#issuecomment-57258985) in #29988.
Ok cool.