Can't link shared library in cmake due to image not found

I’ve already posted my question on stackoverflow but it seems that it’s not getting a lot of attention. Nevertheless, I am trying to include a bazel built shared library in my cmake project. I was able to find the library, as you can see in the terminal output, but as soon as I want to link it, I get the image not found error. I know that it should be related to a rpath and OSX in general, but I can’t figure out my problem. I hope someone can help me out! Thanks!

The library ID of needs updated to use @rpath/ or some other @loader_path/-like prefix. As it is, the library is expected to be in that path relative to…something (the loader docs aren’t very clear on this front IIRC, but it may be DYLD_LIBRARY_PATH entries or getcwd()). I don’t know how to convince Bazel to make such IDs (and add rpath entries if necessary), but there’s probably some way (it may require an install of some kind).