Does anyone know a way to override the path to clang(analyzer) from
the configuration files of a XCode 5 project?

So far the only (unsatisfactory) solution I found is to modify the
global plugin file "Clang LLVM 1.0.xcspec" manually or using the tool
set-xcode-analyzer, then restart Xcode.

Surprisingly, the default value of CLANG_ANALYZER_EXEC in "Clang LLVM
1.0.xcspec" it not overridden by exporting an environment variable
before launching Xcode (from the shell). Yet in the same condition
setting the environment variable CLANG_ANALYZER_OTHER_FLAGS does work.
Deleting the default value for CLANG_ANALYZER_EXEC in the .xcspec file
then setting a global variable at launchtime works but then XCode will
crash on subsequent sessions when the global variable is not set.

Ideally I would like to set these variables in the .xcconfig file. I
tried but this does not appear to do anything. Is this supposed to
work? Should I create a custom compiler plugin?


-- Mathieu


CLANG_ANALYZER_EXEC is not an environment variable. It is a Xcode build setting.

Define this build setting in your project build settings to point to the custom clang binary and it should works.

Thanks for your answer. The .xcconfig approach finally worked for me
after being a little more careful about cleaning/relaunching the
project between experiments.