AddUninstallTarget¶
Add the “uninstall” target for your project:
include(AddUninstallTarget)
will create a file cmake_uninstall.cmake
in the build directory and add a
custom target uninstall
(or UNINSTALL
on Visual Studio and Xcode) that
will remove the files installed by your package (using
install_manifest.txt
).
See also
https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake
The AddUninstallTarget
module must be included in your main
CMakeLists.txt
. If included in a subdirectory it does nothing.
This allows you to use it safely in your main CMakeLists.txt
and include
your project using add_subdirectory
(for example when using it with
FetchContent
).
If the uninstall
target already exists, the module does nothing.