I'ld like to autom开发者_运维百科atically detect (using #ifdef) whether I'm building using XCode or using make under Darwin. Is there a specific define to XCode or make set automatically by either tool? I'ld like to avoid setting a define in the XCode project or Makefile manually.
If you look in the XCode 'build results' window, and expand one of the "compile MyFile.m" lines (select the line, then click on the "lines of text" icon at the far right), you can see the exact command XCode is using to invoke gcc, including any "-D" options on the command line.
I don't believe make
is adding any -D defines automatically.
精彩评论