Almost done converting to cmake
Ported over to cmake