I'm building a static library, MyLibrary
, for iOS in Objective-C that bundles together a dozen useful classes, each with its own .h file. I'd like to distribute MyLibrary
as a single compiled binary, libMyLibrary.a
, and a single .h header file, MyLibraryAPI.h
. MyLibraryAPI.h
has a dozen #import
statements, one for each of MyLibrary
's dozen public classes. Developers who want to include MyLibrary
in their host projects should only have to include the libMyLibrary.a
binary and the MyLibraryAPI.h
header. This is the goal.
So I have set the Role
of each public class in the MyLibrary
Xcode project to Public
and built libMyLibrary.a
successfully using Xcode command line build utils and lipo
. Then, I manually included all of the dozen MyLibrary
header files along with libMyLibrary.a
in a host project, and the host project can use the public MyLibrary
classes with no problem. Awesome!
The problem is if I remove those dozen header files and use MyLibraryAPI.h
instead (as is my goal), the host project's classes can no longer find the MyLibrary
header files referenced in MyLibraryAPI.h
. Instead, at compile time, I get errors like: MyAwesomeThingDelegate.h: No such file or directory...
for each MyLibrary
class that I try to #import
in MyLibraryAPI.h
. I have a folder in my host project root directory called lib
and in host project build settings have set the recursive header search path to lib/**
and in Library Search Path, set a recursive path to lib/**
.
I'd love to hear suggestions from the community on how to correctly set the host project's search paths so that I only need to include libMyLibrary.a
and MyLibraryAPI.h
to use the MyLibrary
classes. Or if I'm doing something wrong, I'd love to hear another suggestion to achieve my goal of distributing a single binary and a single API header file.