aspyct aspyct - 1 year ago 262
iOS Question

Passing compiler flags through xcodebuild

I'm currently using

to automate testing for iOS.

Right now, I'm stuck on trying to pass compiler flags through Xcode directly to the compiler. These flags are:
-fprofile-arcs -ftest-coverage

I don't have the liberty of modifying the xcodeproj, that's why I want to inject these flags via the xcodebuild command.

It would be something like:

xcodebuild -project path/to/my.xcodeproj -scheme MyApp -fprofile-arcs -ftest-coverage

Is that feasible? How?

Answer Source

Apparently most compiler flags can be expressed as constants, and these can be passed to the compiler via xcodebuild easily.

To get them, simply select the option in the xcode build settings view, and hit command-C (copy). In my case, they were GCC_GENERATE_TEST_COVERAGE_FILES and GCC_INSTRUMENT_PROGRAM_FLOW_ARCS.

My command roughly looks like this:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download