[CMake] Getting an RPath set in a Library

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sat Jun 30 15:12:30 EDT 2007


On 2007-06-30 11:50-0400 Mike Jackson wrote:

> So I tried various incantations of SET_TARGET_PROPERTIES and all had no 
> effect:
>
> IF ( APPLE )
>  SET_TARGET_PROPERTIES (${MXADATAMODEL_LIB_NAME}
>    PROPERTIES
> 	INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib
>    )
>
> ENDIF ( APPLE )
>
> So I am obviously not seeing the forest for the trees..

Hmm.  I have no access to Mac OS X, but the PLplot developer who has access
to that platform dealt with this issue to his own satisfaction. To follow
what we do, please look at
http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/.

cmake/modules/rpath.cmake leaves USE_RPATH undefined in the Darwin case
because we found that setting anything to do with RPATH on Mac OS X caused
problems (at least according to the note in that file).

LIB_DIR is defined in cmake/modules/instdirs.cmake.  Bydefault it
is equivalent to ${CMAKE_INSTALL_PREFIX}/lib

src/CMakeLists.txt invokes  SET_TARGET_PROPERTIES (for the USE_RPATH
undefined case) as follows:

set_target_properties(
plplot${LIB_TAG}
PROPERTIES 
SOVERSION ${plplot_SOVERSION}
VERSION ${plplot_VERSION}
INSTALL_NAME_DIR "${LIB_DIR}"
)

So that is not essentially different from what you did aside from the quotes
on ${LIB_DIR}.  You might want to try the quotes to see if they matter.

Other considerations that come to mind are did you try the test starting
from an empty build tree and actually run "make install" in the build tree
before testing run-time access to the library in the install tree?

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