cmake : How to change file permissions when installing?

孤街浪徒 提交于 2019-11-30 03:35:00

问题


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:


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
)


来源:https://stackoverflow.com/questions/19399705/cmake-how-to-change-file-permissions-when-installing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!