Apple: Embedding frameworks
This is a discussion issue split out of !2089 (closed). The initial scope of the proposed change is to support the automatic embedding of frameworks through Xcode project file changes. Discussion may need to broaden to whether other generator types should eventually support whatever mechanism is chosen here by simulating it (e.g. through adding custom post-build commands).
Also in scope is including code signing as part of the embedding. This is likely just a simple option for Xcode project files, but would be much more involved for other generators since there isn't much in the way of code signing support yet for them.
Questions to be answered/discussed in this issue:
How should a project specify that a particular framework should be embedded in given target? Need to consider the cases where the framework is a CMake target, a full path to a framework on the file system or just a name like
- How should code signing on copy be enabled or disabled individually for each embedded framework?
- How should projects indicate whether or not headers should be removed when embedding a framework?
- If a bundle links to a framework, should it automatically embed that framework, at least on platforms where it won't work without it (e.g. iOS non-simulator)? Would then need to identify if such frameworks are system-provided or not though.
- What other mechanisms already exist for copying content into a bundle? We should try to be consistent with those and not duplicate functionality that already exists.
- Features should work for both macOS and iOS, which have different bundle structures (watchOS and tvOS are the same structure as iOS).
- For the mechanisms proposed for the Xcode generator, do they allow support to be added for other generators as well in the future (i.e. are the mechanisms general enough that they could be applied to all relevant generators eventually, even if we only implement them for Xcode initially)?
- Would/should how targets link to a framework change? For example, CMake currently adds a linker flag to link to the framework, but can this be expressed in Xcode project files in other better ways?
- Are there backward compatibility limitations, or put another way, what is the minimum Xcode version required for the changes that are needed to implement these features?