[CMake] How to set suid for an executable with CMake and CPack?

Eric Noulard eric.noulard at gmail.com
Mon Aug 10 10:55:52 EDT 2009


2009/8/10 Dong Tiger <idlecat511 at gmail.com>:
> Thanks. I'll take a look although I feel CPack should be able to take care
> of that automatically.

That's your point of view and I respect it but...

> Especially the owner of files should not be the user who builds the package.

this is precisely the jobs of the packager (or the final packaging
tool, rpm, dpkg etc...)
to chose that kind of thing.
How would CPack decide to change ownership?

root may be an option for your particular package and distros but other
choices may be valid too. Moreover giving ownership to root mostly
need to be root unless you use something like fakeroot (already
pointed-out previously).

That said some CPack generator (DEB, RPM) mostly relies on underlying
tools (dpkg, rpmbuild)
so the CPACK_DEBIAN_xxx or CPACK_RPM_xxx are used to control actual feature
of the underlying tool.
See:
http://www.vtk.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29
http://www.vtk.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29

If you know the dpkg specific features or file from DEB format which
should be used
to tune the package build, do not hesitate to propose patches.

Concerned file for CPack Deb generator are
CMake/Source/CPack/cmCPackDebGenerator.cxx
CMake/Source/CPack/cmCPackDebGenerator.h
CMake/Modules/CPackDeb.cmake

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list