Switch to CMake and build shared library.