[CMake] Fwd: CPack and executable permissions on linux

Domen Vrankar domen.vrankar at gmail.com
Wed Jun 8 14:01:44 EDT 2016


> Before running this cmake script, I am setting executable permissions on the
> build machine, where the package is created.

With install(FILES ...) command permissions set to source file will be
ignored by default (this is missing from documentation).
You could set permissions with PERMISSIONS attribute.

See: https://cmake.org/cmake/help/v3.5/command/install.html#installing-files

> Then, I create a docker image, where this RPM is downloaded and installed.
> But when I want to start the executable within a docker container, then I am
> getting the message "permission denied".
> When I look at the permissions of my installed package, then I see, I only
> have read permissions.

Since CPack relies on install commands to set permissions this is
expected behaviour.

> So the question is: What can I do for getting executable permissions for
> this executable? Is this a CMake/CPack problem?

For now either set PERMISSIONS or move executable into separate
directory and use install(DIRECTORY ... USE_SOURCE_PERMISSIONS)

This could probably be supported by adding USE_SOURCE_PERMISSIONS for
install(FILES ...) would you be willing to contribute a patch?

Regards,
Domen


More information about the CMake mailing list