darling/cmake/setcap.cmake
Ariel Abreu 549fac0475
Fix Debian packaging and make setcap respect DESTDIR
Because we now build a single package, DESTDIR is actually
`debian/<package-name>` rather than `debian/tmp`
(see https://www.debian.org/doc/manuals/debmake-doc/ch05.en.html#rules).
This means that we actually don't need to add `usr` to be installed;
it's already installed to the staging directory.

Additionally, setcap now respects the DESTDIR variable (used when
building the Debian package).
2022-03-03 10:27:11 -05:00

19 lines
337 B
CMake

include(FindSetcap)
function(setcap file caps)
install(CODE "execute_process(
COMMAND
${SETCAP_EXECUTABLE}
${caps}
\$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/${file}
RESULT_VARIABLE
_SETCAP_RESULT
)
if( _SETCAP_RESULT )
message( WARNING \"setcap failed (${_SETCAP_RESULT}).\")
endif()"
)
endfunction(setcap)