[CMake] Permissions for new folders and files

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Aug 7 12:44:47 EDT 2008


On 2008-08-07 17:01+0300 âÒÀËÏ× àÒÉÊ 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)
>    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/. But in
> this case all necessary folders 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. 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.
>  Have you any advance?

It appears from your comments above that you are trying to install some
files in the system hierarchy (/usr/lib) and some files in some directory
(probably in /home/SomeUserName) which is normally writeable by a user
account.  The mixture of root and user account file installs is not
recommended since it violates the FHS standards (see
http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard and links from
there).  Most Linux distributions follow the FHS so often you can figure out
where files should be installed by looking at what your distribution does
for similar files.

Once your installation conforms to the FHS, then all you have to do to make
it completely installable in a user account (with no root access needed) is
to change the -DCMAKE_INSTALL_PREFIX option for cmake.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list