Fixed a few issues in the cmake build script