Try with cmake --build . -- -j1. Linking rootcling and libCling require a lot of memory to do in parallel.
cmake --build . -- -j1