1

Is this possible?

Basically, what I want to do is something like this:

#includeIfItExists "header.h"

and if header.h does not exist, the compiler simply continues on its merry way.

William Jockusch
  • 26,513
  • 49
  • 182
  • 323
  • Why would you want to do such a thing? – tc. Jun 18 '11 at 14:29
  • I could setup such a file and put debugging macro definitions (or debugging code, for that matter) into it. If I don't include it in my repository, there will be no chance that pushing it to the server, and no impact on the other people working on the project. Furthermore, it feels like by far the cleanest way to do this type of thing. – William Jockusch Jun 18 '11 at 15:16
  • By far the easiest way is to add a "Run Script" build step at the beginning that touches the file. You'll also want to list it in the build step outputs, so XCode's dependency-tracking algorithm knows about it. – tc. Jun 18 '11 at 15:30

1 Answers1

0

I'm by no means an expert C guy but I don't believe that this is possible natively. I think the recommend route would be to pass in a named macro at the compiler level using -D and if it is (or possibly is not) defined perform your include. This way the person compiling the program has to make a conscious decision to skip the include (or include it).

Chris Haas
  • 53,986
  • 12
  • 141
  • 274