Convert Makefile to use CMake

This is started, but I'm having linking issues on linux, haven't tested on windows or osx yet.