Fix build dependencies and add CMake config.