[iOS] MACOSX_RPATH has no effect on whether @rpath is included in the target's install name.
According to the CMake documentation for MACOSX_RPATH:
Whether this target on macOS or iOS is located at runtime using rpaths. ... When this property is set to TRUE, the directory portion of the install_name field of this shared library will be @rpath unless overridden by INSTALL_NAME_DIR
While toggling MACOSX_RPATH on macOS has the intended effect, it has no effect on iOS. INSTALL_NAME_DIR must be set manually to @rpath instead.
CMakeLists.txt to reproduce:
cmake_minimum_required(VERSION 3.14) project(testing) set(CMAKE_MACOSX_RPATH ON) add_library(test_library SHARED hello.cpp) install(TARGETS test_library DESTINATION lib)
cmake -DCMAKE_SYSTEM_NAME=iOS .