I have a relatively large codebase, which has within it some externally imported files that I want to compile into the codebase.
Unfortunately, one of those files, let's call it xxx.c, has a related headers file xxx.h that defines a structure that's already defined in one of the Carbon headers that the project uses. For a number of reasons, I cannot modify xxx.c/h to fix that relatively trivial problem.
xxx.c does not use Carbon at all, and if compiled alone, works fine. However, since xcode precompiles the headers, it finds a conflict in the headers and throws an error. So my question is: How can I specify for a specific .c file only certain headers and not the full precompiled header file?
I know that I can compile the externally imported files into their own static library target and then make that a prerequisite for the main target, but it's unwieldy. I also tried an object file target for only xxx.c, but that didn't work, probably because I don't know how to use the object file targets.
There is not much you can do in the general case. Occasionally you can define the guard macro for the header file to prevent the header file from being processed, but this often causes downstream issues with other files that rely on the types defined in that file.