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
)
The installation directory is usually left at its default, which is /usr/local . Installing software here ensures that it is automatically available to users. It is possible to specify a different installation directory by adding -DCMAKE_INSTALL_PREFIX=/path/to/install/dir to the CMake command line.
Dependencies do not necessarily have to be pre-built in order to use them with CMake. They can be built from sources as part of the main project. The FetchContent module provides functionality to download content (typically sources, but can be anything) and add it to the main project if the dependency also uses CMake.
CMake provides the install command to specify how a project is to be installed. This command is invoked by a project in the CMakeLists file and tells CMake how to generate installation scripts. The scripts are executed at install time to perform the actual installation of files.
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
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With