Added basic cmake build structure and fixed a few compile errors on linux