How to set multiple RPATH directories on target in CMake on macOS? On Linux, we can simply use a colon-separated list:
set_target_properties(mytarget PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/../thirdparty/lib" )
On MacOS, we can technically add a colon-separated list, and otool -l should show it, but these directories are not executed:
set_target_properties(mytarget PROPERTIES INSTALL_RPATH "@loader_path/../lib:@loader_path/../thirdparty/lib" )
Normally, if I have several RPATH directories on MacOS, I would send several linker flags, and these flags would be displayed separately with otool -l . Sort of:
g++-mp-4.7 mytarget.cpp -o mytarget -Wl,-rpath,@loader_path/../lib,-rpath,@loader_path/../thirdparty/lib
What gives:
Load command 15 cmd LC_RPATH cmdsize 32 path @loader_path/../lib (offset 12) Load command 16 cmd LC_RPATH cmdsize 48 path @loader_path/../thirdparty/lib (offset 12)
How do I recreate this behavior with CMake?
source share