How can I specify a custom compiler in Xcode 8?

I have a custom toolchain that I want to use to compile a console C++ project for a different architecture.


I've tried modifying the "GCC_VERSION" property in the Build Settings of the project, but if I do that then Xcode just informs me that I'm using an "Unsupported Compiler".


How should I go about doing this?


I found the following link on Google but now it 404s:

https://developer.apple.com/library/content/documentation/ToolsLanguages/Conceptual/Xcode_Overview/AlternativeToolchains.html

This is a late answer but anyway.


People say it is possible with custom toolchains. I didn't make a research on them because easier solution worked well for me:


"

It is also possible to run frontend plugins directly by setting appropriate "build settings" of xcode. (Several ways to do this, you can set them on the command line for instance: xcodebuild build FOO=bla.) Here are a few build settings that I found useful to inject C flags: OTHER_CFLAGS OTHER_CPLUSPLUSFLAGS or to replace the compiler(s) and linker(s): CC CPLUSPLUS LD LDPLUSPLUS LIBTOOL The same approach works to control the "analyze" action: CLANG_ANALYZER_EXEC CLANG_ANALYZER_OTHER_FLAGS Disclaimer: some of those build settings are undocumented (afaik). Use at your own risk.

"


(taken from [cfe-dev] Compile/refactor iOS Xcode projects http://lists.llvm.org/pipermail/cfe-dev/2014-March/035816.html)


For me it was enough to define the following User-Defined Settings in Build Settings of Xcode projects:


CC=my-c-compiler

CXX=my-cxx-compiler

LIBTOOL=my-linker-for-static-libraries


Hope this helps.

How can I specify a custom compiler in Xcode 8?
 
 
Q