Adapt to API changes, clean up CMakeLists