I want to link a static library (.a
file) into my code with some restrictions
- The condition should be an environment variable instead of build type (Debug, Release) or architecture.
- If the static library is not used (not imported, not used in the code), then the final binary shouldn't contain any references to it at all.
The code should look like:
#ifdef CRASH_LOGGING
[Crittercism enableWithAppID:@"abc"]
#endif
And the environment variable should have a similar name.
I played with OTHER_LINKER_FLAGS = -weak_library
, removing the .a
from the target, setting it as optional, but I can't get it to work. Either the library is not linked, I get a compile error, or part the .a
belongs to the final executable.
How can I achieve this?