[CMake] install and rpath question
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Mon Apr 23 11:26:09 EDT 2007
On 2007-04-23 16:46+0200 Mathieu Malaterre wrote:
> Hello,
>
> I cannot figure out how to install a library so that the installed
> version use the install_rpath.
>
> # By default rpath works in built tree:
> ADD_LIBRARY(foo SHARED foo.c)
> ADD_LIBRARY(bla SHARED bla.c)
> TARGET_LINK_LIBRARIES(bla foo)
> INSTALL(
> TARGETS bla foo
> LIBRARY DESTINATION lib
> )
>
> SET_TARGET_PROPERTIES( bla
> PROPERTIES INSTALL_RPATH ???
> )
>
> In the end the rpath should be working in the build tree and in the
> installed tree.
Yes, I agree rpath works automatically in the build tree (if you use the
full path name for libraries that are returned by find commands), but you
have to do something special for the install tree.
It appears that you are on the right track. SET_TARGET_PROPERTIES with
PROPERTIES INSTALL_RPATH ??? is what I use with the ??? replaced by a list
of the desired installation rpath's for the particular target in question.
That works fine for the install-tree rpaths, but it takes a bit of effort to
collect all the required rpath's for a given target for those users who are
using a lot of libraries from non-standard locations. However, I have just
noticed INSTALL_RPATH_USE_LINK_PATH in the documentation. I believe that is
something new since I got my rpaths working properly for PLplot half a year
ago, and it seems to me it might be a much easier solution (although I
haven't tried it yet).
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