[CMake] Permissions for new folders and files

Брюков Юрий y.brukov at gmail.com
Fri Aug 8 03:54:48 EDT 2008


Thanks Yuri and Alan.
  But I develop cross-platform application (for Linux and Windows now)
and it would be better if directory layout for my application will be
the same on both platform. Or in this case I also should try to follow
the FHS for Linux platform?
  By the way, my application consists of some shared libraries and
executables files. And shared libraries should be placed in some
directory from the PATH. I suggest it require root privileges in
Linux. In result, `make install` command should be executed with root
access. If there any way to avoid this issue? Because in this case I
have the troubles described above.

2008/8/8 Yuri V. Timenkov <ytimenkov at parallels.com>:
> On Thursday 07 August 2008 18:01:33 Брюков Юрий wrote:
>> Hi.
>>   I try to write installation steps for my application. I need create some
>> folders and copy some files to this folders. I use next commands:
>>     install(TARGETS myApp DESTINATION . PERMISSIONS WORLD_READ WORLD_WRITE
>> WORLD_EXECUTE)
> Installing into folder "." may have strange consequences.
>>     install(FILES myFile DESTINATION myfolder)
>>
>>   I have troubles with permissions of directories which were created during
>> my application installation. Command `make install` should be executed with
>> root privileges because I need to copy some libraries to /usr/lib/.
> This depends on your packaging scheme. For example, I install CMake into
> /opt/cmake-2.[46], which is created under my user account.
>> But in this case all necessary folders
> Intermediate. Necessary folders you specified explicitly with install()
> commands.
>> also will be created with root permissions
>> and my application can't create any files in this folders if it was
>> executed without root privileges.
> Usually applications shouldn't write to any system locations. All data is
> placed on linux to /var directory (as Alan pointed to FHS standard), where
> applications' installers create folders with user accounts.
>
>> For example folder from
>> CMAKE_INSTALL_PREFIX variable also created with root privileges. And myApp
>> try to create some log files in this directory and it failed because it
>> hasn't necessary
>> privileges.
> All your logs should be in /var/log directory, but regular user can't write
> there. You can use syslog daemon to write logs. Or you can create custom
> folder which will be accessible under user account.
>
>>   Have you any advance?
> You should consider FHS standard and develop proper directory layout for your
> product. If you migrate from windows proprietary software, I (my personal
> preference) suggest put your app into (set CMAKE_INSTALL_PREFIX to)
> /opt/YourProduct/ and write logs into /var/log/YourProduct/. You can create
> these two dirs from root and next change ownership.
>
>>
>> Thanks,
>> Yuri.
>


More information about the CMake mailing list