Reputation: 239
I'm developing a static library where i need to use the open source SBJson class.
what is the best way to include the SBJson class to my library without needing to include all its header files(.h) when distributing my static library ??
Upvotes: 3
Views: 633
Reputation: 104698
The best way is not to (attempt to) hide the dependency, and then tell the clients they will need to build and link to the SBJson library.
The safe alternative would be a fork of SBJson with all symbols redeclared as different names (e.g. a unique prefix). This will ensure your client has zero hassle linking your library with their dependencies.
Upvotes: 1
Reputation: 1247
If your creating a static library, any application that uses that static library will need to know of all the public methods avaliable to said library.
If SBJson is an internal part of your library then you don't have to include its headers files when distributing the application. You only have to include the .h files of the public facing methods.
When compiling your static library, just don't include the header files for SBJson under the copy files stage.
Upvotes: 1