Runtime linking shared libs in unusual places

Hi there,

I’ve forked ofxOpenNI (experimental branch) and am trying to package linux64 binaries for OpenNI2 and NiTE2 so that linux users can easily use the addon w/ the makefile system and I’m SUPER close. I’ve got everything working with global installs of the libraries libNiTE2.so and libOpenNI2.so in /usr/lib/x86_64-linux-gnu/ and am now trying to migrate from that setup to a more friendly local install where everything is located in ofxOpenNI/lib/openni2 and ofxOpenNI/lib/nite2. I can compile an example just fine, however I’m not sure of the best practice with pointing the runtime linker towards the libraries. If I use ldd to check the shared libraries of my example build I see:

linux-vdso.so.1 =>  (0x00007ffe3199b000)
/home/brannondorsey/Documents/code/of_v0.9.0_linux64_release/addons/ofxOpenNI/libs/nite2/lib/linux64/libNiTE2.so (0x00007f443c837000)
/home/brannondorsey/Documents/code/of_v0.9.0_linux64_release/addons/ofxOpenNI/libs/openni2/lib/linux64/libOpenNI2.so (0x00007f443c5bb000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f443c37f000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f443c0dc000)
etc...

Notice no => in with my libraries. I’ve added the following in my addon_config.mk file:

ADDON_LDFLAGS = -Wl,-rpath=../../../addons/ofxOpenNI/libs/openni2/lib/linux64

Which correctly finds the libraries ONLY if I run app relative to the project root (e.g. ./bin/App). What are the best practices for how to link shared libraries that are bundled w/ addons using the Makefile system?

Thanks!