file(GET_RUNTIME_DEPENDENCIES): does not repsect parent RPATH, LIBRARY_PATH and LD_LIBRARY_PATH
I have written a question at stackoverflow.
Suppose, on Linux, we have executable A and shared library B and shared library C, where the dependency relation is
A -> B -> C
\-> C
Now, if C is contained in A's rpath but not B's. When solving the dependency for B, cmake will issue an error or a warning depending whether C is provided in the DIRECTORIES.
Notice that B can be built out of tree, so user may not have control of its rpath information. Hence, a better solution can be:
- collect rpaths along the DFS chain and use also parents rpaths to locate children's dependency
- also examine environmental LIBRARY_PATH and LD_LIBRARY_PATH. (For real world loaders, LD_LIBRARY_PATH will have a higher priority than rpath. Examining LD_LIBRARY_PATH will provide chances for user to override system-wise ldconfig in dependency solving.)
Edited by Brad King