Stop using deprecated API and simplify CMake.