带包装的CMAKE RPATH [英] CMAKE RPATH with packaging

查看:138
本文介绍了带包装的CMAKE RPATH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用cmake创建软件包

我具有以下结构

bin/
    bin1
lib/

    lib1
    lib2

其中lib1和lib2是外部动态库.如何设置RPATH,使其自动与lib1和lib2链接?

解决方案

我也一直在忙于cmake. Cmake在构建时使用CMAKE_SKIP_BUILD_RPATH进行链接,并使用CMAKE_INSTALL_RPATH设置在构建安装目标时使用的rpath. cmake在使用其rpath机制方面有一些不错的信息: http://www.cmake.org/Wiki/CMake_RPATH_handling

另一种方法是使用ldconfig.我注意到,当您构建svn(1.6.17)时,make install目标会调用ldconfig来设置rpath.

看看$ ORIGIN,因为您需要在rpath中将其保持为相对于二进制文件而不是相对于$ PWD.

构建简单(hello-world-esque)将ld选项-rpath与$ ORIGIN一起使用的示例

I am creating package using cmake

I am having following structure

bin/
    bin1
lib/

    lib1
    lib2

Where lib1 and lib2 are external dynamic library. How can I set RPATH so it will automatically link with lib1 and lib2 ?

解决方案

I've been fussing with cmake on this as well. Cmake uses CMAKE_SKIP_BUILD_RPATH for linking at build time and CMAKE_INSTALL_RPATH to set the rpath used when the install target is built. cmake has some good info on using its rpath mechanism: http://www.cmake.org/Wiki/CMake_RPATH_handling

An alternative method is to use ldconfig. I notice that when you build svn(1.6.17), it's make install target invokes ldconfig to set rpath.

take a look at $ORIGIN as you'll need that in your rpath to keep it relative to the binary rather than relative to $PWD.

Building a simple (hello-world-esque) example of using ld's option -rpath with $ORIGIN

这篇关于带包装的CMAKE RPATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆