Upgrade to new lib version

Replace function invocations and variable declarations with
the current one.
Replace Makefile with CMake