Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).

like image 846
dcow Avatar asked Jul 05 '26 23:07

dcow


1 Answers

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/

like image 109
dcow Avatar answered Jul 08 '26 03:07

dcow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!