# INSTALL\_RPATH\_USE\_LINK\_PATH not working when CMAKE\_EXE\_LINKER\_FLAGS (LDFLAGS) is set

**URL:** https://discourse.cmake.org/t/install-rpath-use-link-path-not-working-when-cmake-exe-linker-flags-ldflags-is-set/1892
**Category:** Code
**Created:** [September 22, 2020, 6:20pm UTC](https://discourse.cmake.org/t/install-rpath-use-link-path-not-working-when-cmake-exe-linker-flags-ldflags-is-set/1892 "2020-09-22T18:20:05Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ryanofsky](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/53a042/32.png) [@ryanofsky](https://discourse.cmake.org/u/ryanofsky)
#### Post date: [September 22, 2020, 6:20pm UTC](https://discourse.cmake.org/t/install-rpath-use-link-path-not-working-when-cmake-exe-linker-flags-ldflags-is-set/1892/1 "2020-09-22T18:20:05Z")

</div>

I’m wondering if this is a bug.

I’m using `INSTALL_RPATH_USE_LINK_PATH TRUE` for a target in my project, and generally it seems to work and set the target’s RUNPATH as expected on install, except it stops working and doesn’t set any RUNPATH if an `-L` option is included in CMAKE\_EXE\_LINKER\_FLAGS.

I don’t see interactions between USE\_LINK\_PATH and LINKER\_FLAGS variables mentioned in the reference documentation or in [https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling](https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling), so I’m wondering if this behavior is expected or may be a bug.

I can vaguely see how the behavior might be useful, but not specifically, and it seems like a surprising thing that should be document. For now setting CMAKE\_INSTALL\_RPATH manually seems to function as a workaround.

I can try to come up with minimal test case if this sounds like a bug. Some more details are in

> <https://github.com/bitcoin/bitcoin/issues/19981#issuecomment-696680877>
>
> Pointed out by @ryanofsky in #19685:
> Still confirming but it seems like this PR might be causing an error on travis: "/home/travis/build/bitcoin/bitcoin/depends/x86\_64-pc-linux-gnu/share/../native/bin/mpgen:...
