cmake : How to change file permissions when instal

2019-04-07 08:18发布

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

How do I do it? How to change the file permission, without changing the permissions of the source file?


My install command is this :

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

and this is what I tried (but it doesn't work) :

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

1条回答
太酷不给撩
2楼-- · 2019-04-07 09:07

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

install(
    FILES common.sh
    PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
    DESTINATION /rootfs/usr/bin
)
查看更多
登录 后发表回答