Cmake: How to change file permissions during installation?

I have a file with 660 flags set, but I want to install it with 700 flags set.

How can I do it? How to change file resolution without changing the resolution of the source file?


My installation command:

 install( FILES common.sh DESTINATION /rootfs/usr/bin ) 

and this is what I tried (but this does not work):

 install( FILES common.sh FILE_PERMISSIONS "600" DESTINATION /rootfs/usr/bin ) 
+6
source share
1 answer

There is no FILE_PERMISSIONS argument to install(FILES ...) . Use PERMISSIONS instead:

 install( FILES common.sh PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ DESTINATION /rootfs/usr/bin ) 
+9
source

Source: https://habr.com/ru/post/956065/


All Articles