Add @executable_path/../Frameworks to install RPATH of macOS app targets
It's a bit of a nuisance that for every macOS executable target that is an app bundle, we always end up having to add @executable_path/../Frameworks
to the install RPATH (and often to the build RPATH as well). I'd like to proposed that we add it automatically for macOS app executable targets, at least to the INSTALL_RPATH
target property. I'd be open to automatically adding it to the BUILD_RPATH
property as well. This would mean one less bit of boilerplate projects would have to add for a common case.
For apps that don't embed any frameworks, having @executable_path/../Frameworks
added to the install or build RPATH anyway shouldn't do any harm. It won't be used in that case, but it won't break anything or change behavior.
I don't know if we'd need a policy for this. While it would be an observable change, I'd question whether it is a change that could make a practical difference to existing projects. We could look at the final RPATH at generation time and only add @executable_path/../Frameworks
if it isn't already present. If we do add it, then we can add it to the end of the resolved RPATH. That way, we shouldn't create any danger of changing what gets found due to any pre-existing INSTALL_RPATH
contents. An app bundle shouldn't be looking outside of the bundle itself for anything other than in system locations. But if we want to be ultra-conservative, I wouldn't push back on using a policy.
For iOS app bundles, potentially we might want to do something similar. I think the equivalent path would be just @executable_path
in that case, but I don't have a lot of experience with shared frameworks on iOS to know if there would be any undesirable side effects from doing that.