user712850
user712850

Reputation:

How to ignore -Objc flag for specific library

In my project I have a high number of static libraries. I currently use the -ObjC linker flag which will include all members of static libraries that implement any objective-c class.

I have 1 particularly large static library where I specifically want only classes which are used to be included in the binary (I am aware of the dynamic nature of objective-c and the caveats of doing this). This is what would happen if the -ObjC were not used.

Is it possible to specify to the linker that I want this specific library to not fall under the -ObjC flag?

It would be unfortunate if the only way to accomplish this would be to add the force_load flag for every other library that I somehow figure out contains objc.

Upvotes: 6

Views: 356

Answers (1)

paiv
paiv

Reputation: 5601

Linker's -ObjC flag doesn't take arguments, and applies to all libraries. Thus your only option is to use -force_load per every other library.

You might be able to automate this with xcodeproj or generated xcconfigs

Upvotes: 5

Related Questions