[CMake] RPATH for external library

Pawel Veselov pawel.veselov at gmail.com
Mon May 15 16:32:15 EDT 2017


Hello.

I'm trying to make CMake add to the linker RPATH automatically.
There is a library that is installed in a non-default location.
I'm discovering the library using PkgConfig (custom CMAKE_APPBUNDLE_PATH)
and add the library build options to the LINK_FLAGS (using set_property).

I then set INSTALL_RPATH_USE_LINK_PATH and BUILD_WITH_INSTALL_RPATH to TRUE.

The BUILD_WITH_INSTALL_RPATH supposedly should add any -R that are for
installation to the built binary. The INSTALL_RPATH_USE_LINK_PATH should
find any -L options and copy them as -R options (AFAIU). Changing RPATH
flags happens before the target is created, or link flags are added to the
target.

The linker executed consistently lacks any -R options at all.

Any advice on what I may be doing wrong, or am I misunderstanding the RPATH
properties? One thing I believe may be a problem is that I treat LINK_FLAGS
as a string, and not a set...

cmake available : https://pastebin.com/Y67FerMd

Thank you,
  Pawel.


More information about the CMake mailing list