Convert the build system to cmake

This easily allows us to build OSX targets in addition to Linux. I
haven't done any work to support Windows.
main needs to return an int
Merge branch 'cmakeify'