[CMake] Re: Howto create an empty directory during 'make install'?
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Sat Nov 25 19:51:41 EST 2006
Enrico said:
> | INSTALL(CODE "EXECUTE_PROCESS(COMMAND mkdir -p /var/lib/foo)")
>
> and 'make install' works perfectly.
>
> But 'make install DESTDIR=/var/tmp/foo-root' still fails with
>
> | mkdir: cannot create directory /var/lib/foo': Permission denied
Hi Enrico:
I think the above will always create /var/lib/foo regardless of install
prefix. It would be better to use ${CMAKE_INSTALL_DATADIR}/foo (or wherever
you really want to install foo underneath the installation prefix).
An even better possibility is to use the FILE(MAKE_DIRECTORY ...) to create
an empty directory in the build tree, then use INSTALL(DIRECTORY ...)
to install it. I suspect your DESTDIR issue should go away then.
I worked on your other issue (creating a symlink in the install
directory) since PLplot has an example.
Here is essentially what we did (which follows the style of what you
did although with a specific prefixed installation directory):
set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/share/plplot5.7.0)
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
../c/lena.pgm lena.pgm WORKING_DIRECTORY ${DATA_DIR}/examples/c++)")
and that worked fine for the usual "make install" regardless of the prefix
we chose with the cmake -DCMAKE_INSTALL_DATADIR="..." option.
However, prompted by your remarks I just discovered it fails silently (at
least for cmake-2.4.4) for the case of
make install DESTDIR=whatever
I have temporarily changed PLplot to install a copy of the file rather than
a symlink until this issue is resolved.
To recap, I think FILE(MAKE_DIRECTORY ...) then INSTALL(DIRECTORY ...)
should work for the empty directory case. However, there appears to be no
similar solution available for installed symlinks. For example, it is easy
to create a symlink in the build tree using cmake -E create_symlink, but I
can find no INSTALL signature that will install it properly. Thus, the only
recourse seems to be INSTALL(CODE ...) tricks, but then DESTDIR appears not
to be supported by such low-level code.
Does anybody know how to make a symlink in the install tree with DESTDIR
supported? In the above case lena.pgm is a relatively large image so I
much prefer a symlink to the (current) file copy I am using to work around
the problem.
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 Yorick front-end to PLplot (yplot.sf.net); 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