alice
(alice)
1
I want to let postrm run when uninstalling.
But it run on installing, so my folder test be remove.
set(DEBIAN_PRERM prerm.in)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/deb/linux/${DEBIAN_PRERM}
${CMAKE_CURRENT_BINARY_DIR}/prerm @ONLY)
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_BINARY_DIR}/prerm;")
prerm
#!/bin/bash
set -e
ROOT=/opt/test/
BIN_DIR="${ROOT}"
# Remove entire folder
rm -rf "${BIN_DIR}"
ben.boeckel
(Ben Boeckel (Kitware))
2
You can use install(CODE)
to inject CMake code into the install scripts.
alice
(alice)
3
Thanks for your reply.
Do you have the sample code?
And I want to delete my project folder when uninstalling (*.deb)
ben.boeckel
(Ben Boeckel (Kitware))
4
install(CODE "
cmake_code_you_want_to_call()
multiple_commands_work()
")
alice
(alice)
5
How can I trigger it when uninstalling.
ben.boeckel
(Ben Boeckel (Kitware))
6
CMake has no built-in uninstall support.
alice
(alice)
7
YOU mean CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ( prerm postrm )doesnt work when uninstalling.
All of them (prerm postrm preinst postinst ) just work on install.
ben.boeckel
(Ben Boeckel (Kitware))
8
Oh, this is for Debian CPack stuff? @kyle.edwards might know.