About Uninstalling Something That Was Made With CMake

When I custom-compile source-code, which I downloaded, I usually use either one of

  • ‘./configure’
  • ‘cmake-gui’

In this previous posting, I described how to use ‘CMake’ in detail, especially in a case which entailed complications.

(I should add that this only works, when the source-code has specifically been set up, to use either of the above build-systems, which Open-Source software usually has. And, neither of the above configuration tools is actually a compiler, which anybody needs to provide, to use in conjunction with he configuration tools named above. )

But there is a second question related to CMake, which I feel I need an answer to, before I commit anything I compiled to the root file-system.

Usually, after having created the Makefiles, the course of action might be:


make -j 4

make install


But before I do the last bit, I want to be sure that I could uninstall anything which I might have installed ! So, as root, the way to uninstall would be:


make uninstall


But we might find, that with some Makefiles, there is no longer a target named ‘uninstall’ ! The way I find out about this, is to run:


make uninstall


as user, before running ‘make install’. If we happen to be using ‘CMake’, then we have a graceful way to exit. As root, in the build-directory, we can run the command:


cat install_manifest.txt | while read f; do rm -f "$f"; done


This will usually uninstall the project again.