Unexpected behavior of the target property INSTALL_RPATH_USE_LINK_PATH
If the install prefix of a dependency is inside the source directory of the dependent project, the target property INSTALL_RPATH_USE_LINK_PATH shows unexpected behavior (at least to me). In this case, CMake does not add the path of the dependency as RPATH, even though it is not part of the build tree and cannot be auto-discovered. An MWE can be found here: GitHub: INSTALL_RPATH_USE_LINK_PATH Demo.
From the docs (emphasis mine):
INSTALL_RPATH_USE_LINK_PATH
is a boolean that if set toTRUE
will append to the runtime search path (rpath) of installed binaries any directories outside the project that are in the linker search path or contain linked library files.
What exactly does "outside of the project" mean? Apparently, it means: Outside of the source directory of the dependent project. Wouldn't it be better to add the path, if the dependency is not part of the build tree? This is, what RPATH-handling suggests, at least:
If this option is enabled, all these directories except those which are also in the build tree will be added to the install RPATH automatically.
But this is not, what happens.
Which one is intended? Is this a bug or just inconsistent documentation?