Convert to using CMake in order to speed up compilation and to fix compilation under glibc. Add extra dependencies since they're now needed. Signed-off-by: Rosen Penev <rosenp@gmail.com>