What was confusing to me was that OpenCV builds with CMake and I don’t have this problem (it embeds the right RUNPATH in the resulting libraries), but VTK doesn’t for some reason.
There is a CMake wiki that talks about RPATH and sort of mentions the problem that I was having. I thought that it would have been as simple as supplying -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE
.
I guess that I will have to compare the two project CMakeLists.txt
files to see if I can spot the difference.