Skip to content

Apple: Set CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG on non-macOS too

Craig Scott requested to merge craig.scott/cmake:ios-rpath-linker-flag into master

Since CMake 3.19, we no longer support macOS SDKs older than 10.5, which corresponds to Xcode 3. Supporting older Xcode versions for device platforms is also not realistic. We therefore expect the -rpath linker option should always be supported now.

When targeting iOS, tvOS or watchOS, the previous disabling of -rpath support meant that the install_name_dir of shared libraries and frameworks was unable to use @rpath. This resulted in embedding absolute paths for their install_name. When they were embedded in an app bundle, this would cause the app to fail at runtime. By enabling the -rpath linker option, the default install_name_dir is now @rpath for these platforms, which results in binaries that do work at runtime.

Fixes: #20036 (closed)
Backport: release

Edited by Craig Scott

Merge request reports