[CMake] Adding to rpath through cmake
Michael Hertling
mhertling at online.de
Mon Apr 26 14:08:03 EDT 2010
On 04/26/2010 08:35 AM, Michael Darling wrote:
> Hi,
>
> I've been trying to figure out how to append another directory to the -rpath
> sent to the linker through cmake.
>
> I have a yum-installed version of stdlibs in /usr/lib64, and a svn source
> built one in /usr/local/lib64. I need the newer version for software that
> I'm developing, but would like to have everything else on the system run the
> version in /usr/lib64 because it's the version everything's expecting, and
> it's an actual release version rather than an svn build.
>
> The /usr/lib64 and /usr/local/lib64 versions are both .so.6, so ldconfig
> shouldn't be able to help me out.
>
> I'm using export ld_library_path=/usr/local/lib64 as a workaround when
> running my applications at the moment, but don't want that to be
> automatically set because it will impact other programs.
>
>
> I've looked at add_library_path, cmake_skip_build_rpath,
> cmake_build_with_install_rpath, cmake_install_rpath,
> cmake_install_rpath_use_link_path, and cmake_system_library_path, none of
> which seem to work or be what I need.
Does CMAKE_INSTALL_RPATH really fail? For me, saying
cmake -DCMAKE_INSTALL_RPATH=xyz ...
results in "xyz" appearing as the RPATH in the final binaries *after*
the installation, i.e. during "make install", executables and shared
libraries are relinked, so the CMAKE_INSTALL_RPATH is finally included
in the installed binaries. If you want to have the CMAKE_INSTALL_RPATH
already available right after building, e.g. to test your software from
within CMAKE_BINARY_DIR, you should set CMAKE_BUILD_WITH_INSTALL_RPATH
to TRUE. For a quite exhaustive presentation of CMake's RPATH handling,
refer to <http://www.cmake.org/Wiki/CMake_RPATH_handling>.
> So, whether adding to -rpath is what I need to do or not, is there a way
> with cmake that I can specify which stdlibs my applications are being
> statically linked against?
For excellent information about linking statically or dynamically,
in particular w.r.t. standard system libraries, refer to:
<http://www.cmake.org/Wiki/CMake_2.6_Notes#Link_Line_Generation>
'hope this helps a little bit.
Regards,
Michael
More information about the CMake
mailing list