Specific compiler flags for specific files in Xcode

前端 未结 3 1001
别跟我提以往
别跟我提以往 2020-12-16 21:00

I\'ve been tasked to work on a project that has some confusing attributes.

The project is of the nature that it won\'t compile for the iPhone Simulator And the iPhon

相关标签:
3条回答
  • 2020-12-16 21:04

    This blog post by Joshua Nozzi explains how to do this in Xcode 4, where he says:

    ... select your project in the Project Navigator, select the relevant target (you may have only one), then select the Build Phases tab. Expand the Compile Sources phase and viola! A Compiler Flags column lets you set each file’s flags for that target.

    0 讨论(0)
  • 2020-12-16 21:10

    You can define additional compiler flags for individual source files as follows:

    • first select the target you are going to build
    • right click on the source file
    • select "Get Info"
    • click on the "Build" tab
    • define your additional compiler flags

    However it sounds like a better solution in your case is just to duplicate the target and have two targets - one for an actual device and one for the simulator. Inherit common build settings from the project level and just tweak the per-target build settings as necessary.

    0 讨论(0)
  • 2020-12-16 21:17

    Call GetInfo for the specific file, you can set the Build settings there for this file. See also the XCode Project Management Guide about this.

    0 讨论(0)
提交回复
热议问题