dcow
dcow

Reputation: 7975

Xcode: use a static library in a framework?

I have a framework that links against two static libraries. Each static library is a target and the framework is a target. The framework wraps the static libraries and clients of the framework only care about calling framework code (which in turn may call code from each static library). Is is possible to have the framework include the required headers and object files? When I build I get the infamous Include of non-module header inside framework module error. Each static library exports its headers and I've added the headers as public headers in the framework. Still no luck (and I would think there's a solution that doesn't require this).

Upvotes: 3

Views: 8743

Answers (1)

dcow
dcow

Reputation: 7975

Each static library must export a module.modulemap file with its headers. Contrary to popular wisdom, once this is complete, you need not add a bunch of headers to the Public section of the framework's Headers build phase in order to alleviate the error. The process is described in detail here: https://bjhomer.com/2015/05/03/defining-modules-for-static-libraries/

Upvotes: 6

Related Questions