Some build fixes

I added a CMakeLists file to allow use of cmake.

Also fixed some warnings produced by turning on -Wall and -Wextra