CMAKE RPATH with packaging

I create a package using cmake

I have the following structure

bin/ bin1 lib/ lib1 lib2 

Where lib1 and lib2 are an external dynamic library. How to install RPATH so that it automatically binds to lib1 and lib2?

+4
source share
2 answers

I also fussed with cmake. Cmake uses CMAKE_SKIP_BUILD_RPATH for binding during assembly and CMAKE_INSTALL_RPATH for setting the path used to create the installation target. cmake has some good information 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 create svn (1.6.17), make make target calls ldconfig to install rpath.

take a look at $ ORIGIN, as you will need what's in your Rpath to keep it relative to binary, not relative to $ PWD.

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

+5
source

AFAIK, CMake automatically adds paths to all goals that you associate with target_link_libraries ().

To disable it, there is an option CMAKE_SKIP_RPATH .

0
source

Source: https://habr.com/ru/post/1384922/


All Articles