-
Dennis Klein authored
Problem: When building libzmq with CMake, the installed libzmq.dylib has a relative install name (otool -D libzmq.dylib) on MacOS. This is a regression against building via autotools which sets an absolute install name. Effectively, the CMake built libzmq.dylib is rendered useless if installed in non-system directories and used in environments without explicit DYLD_LIBRARY_PATH mgmt. For example running any of the installed executables currently fails: $ /some_install_prefix/bin/inproc_lat dyld: Library not loaded: libzmq.5.dylib Referenced from: /some_install_prefix/bin/inproc_lat Reason: image not found Trace/BPT trap: 5 Solution: Best practice is to install relocatable dylibs. On MacOS this means setting an install name with a special prefix, e.g. @rpath/libzmq.dylib, and adding the relevant search paths to the embedded rpath list. In this patch the necessary CMake options are added to generate the desired relocatable dylibs. Find more information on: https://cmake.org/Wiki/CMake_RPATH_handling.