cmake:安装时如何更改文件权限? [英] cmake : How to change file permissions when installing?
本文介绍了cmake:安装时如何更改文件权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个设置了660
标志的文件,但是我想安装设置了700
标志的文件.
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
)
推荐答案
install(FILES ...)
.使用PERMISSIONS
代替:
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
)
这篇关于cmake:安装时如何更改文件权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文