[CMake] Getting an RPath set in a Library
Mike Jackson
imikejackson at gmail.com
Sat Jun 30 15:23:13 EDT 2007
On Jun 30, 2007, at 3:12 PM, Alan W. Irwin wrote:
> 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
>
Yes, my library is small enough where I can start completely fresh
each time. After running make install I run "otool -L ..." on the
installed library which reports back NO rpath is set. Just the
libname, which means I have to add the path to my DYLD_LIBRARY_PATH,
which will cause a problem for other reasons.
THanks for the suggestions. I will try them later this weekend.
--
Mike Jackson Senior Research Engineer
Innovative Management & Technology Services
More information about the CMake
mailing list