[CMake] RPATH questions
Brad King
brad.king at kitware.com
Mon Jul 24 16:34:14 EDT 2006
Alan W. Irwin wrote:
> On 2006-07-24 11:14-0400 Brad King wrote:
>> Summary: Just set INSTALL_RPATH on the module target to be the rpath
>> needed in the install tree. Then things will just work.
>
> I followed that advice for INSTALL_RPATH with libplplotd, and it worked,
> but
> unlike the build tree case it did not automatically propagate to
> libplplotcxxd. Here are the ldd results for the install location:
>
> ldd ~/plplot_cvs/installcmake/lib/libplplotd.so
> libm.so.6 => /lib/tls/libm.so.6 (0xb7f7b000)
> libltdl.so.3 => /home/software/autotools/install/lib/libltdl.so.3
> (0xb7f73000)
> ...
>
> ldd ~/plplot_cvs/installcmake/lib/libplplotcxxd.so
> libplplotd.so.9 =>
> /home/software/plplot_cvs/installcmake/lib/libplplotd.so.9 (0xb7fa3000)
> libltdl.so.3 => /usr/lib/libltdl.so.3 (0xb7f87000)
>
> Note, the last one is the system libltdl.so location which is out of date
> and which I therefore want to consistently avoid.
>
> Note, libplplotcxxd has no direct dependencies on libltdl so the only
> reason
> why it even knows about libltdl is through its dependency on the libplplotd
> target. So why doesn't it automatically pick up the correct INSTALL_RPATH
> information from that target? Is this a bug in CMake-2.4.2?
>
> Of course, I can presumably work around this CMake-2.4.2 limitation by
> supplying INSTALL_RPATH information to every target in my project which
> depends on the libplplot target, but there are a lot of targets in my
> project and virtually all of them depend on the libplplot core library so
> this is quite a messy workaround.
No attempt has been made in CMake to implement automatic propagation of
INSTALL_RPATH settings. This may be added in the future.
For now you'll have to set the rpath on all targets individually. You
can do this pretty cleanly by creating a macro to make a target a client
of libplplotd:
MACRO(MAKE_PLPLOTD_CLIENT target)
TARGET_LINK_LIBRARIES(${target} libplpotd)
SET_TARGET_PROPERTIES(${target} PROPERTIES INSTALL_RPATH ...)
ENDMACRO(MAKE_PLPLOTD_CLIENT)
ADD_LIBRARY(plplotcxxd SHARED ...)
MAKE_PLPLOTD_CLIENT(plplotcxxd)
-Brad
More information about the CMake
mailing list