Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake support "make uninstall"?

I am trying to find some sudo-free solution to enable my users install and unistall my application. Using

set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/opt/${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}/") SET(CMAKE_INSTALL_RPATH "$ENV{HOME}/${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}/") 

I can direct the files to the user's home directory, and

make install 

works fine. With reference to What's the opposite of 'make install', ie. how do you uninstall a library in Linux? I did not find any idea, which is sudo-free and is not complex for a non-system-admin person.

  1. Is anyhow make uninstall supported by CMake?

  2. My uninstall is quite simple: all files go in a subdirectory of the user's home. In principle, removed that new subdirectory could solve the problem. Has make install, with parameters above, any side effect, or I can write in my user's guide that the newly produced subdirectory can be removed as 'uninstall'?

like image 862
katang Avatar asked Jan 04 '17 19:01

katang


People also ask

How do you remove make install package?

If sudo make uninstall is unavailable: In a Debian based system, instead of (or after*) doing make install you can run sudo checkinstall to make a . deb file that gets automatically installed. You can then remove it using the system package manager (e.g. apt / synaptic / aptitude / dpkg ).

What is CMake install prefix?

The installation directory is usually left at its default, which is /usr/local . Installing software here ensures that it is automatically available to users. It is possible to specify a different installation directory by adding -DCMAKE_INSTALL_PREFIX=/path/to/install/dir to the CMake command line.


2 Answers

If you want to add an uninstall target you can take a look to the official CMake FAQ at:

https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake

If you just want a quick way to uninstall all files, just run:

xargs rm < install_manifest.txt 

install_manifest.txt file is created when you run make install.

like image 166
Emilio González Montaña Avatar answered Sep 20 '22 12:09

Emilio González Montaña


No there is not. See in the FAQ from CMake wiki:

By default, CMake does not provide the "make uninstall" target, so you cannot do this. We do not want "make uninstall" to remove useful files from the system.

If you want an "uninstall" target in your project, then nobody prevents you from providing one. You need to delete the files listed in install_manifest.txt file. [followed by some example code]

like image 24
usr1234567 Avatar answered Sep 18 '22 12:09

usr1234567