[cmake-developers] ARMCC toolchain support

Andersson, Joakim Joakim.Andersson at nordicsemi.no
Thu Oct 29 05:28:43 EDT 2015


> Currently you're detecting the compiler with:
> 
>    /* __ARMCC_VERSION = PVVbbbb */
>  # define @PREFIX at COMPILER_VERSION_MAJOR @MACRO_DEC@(__ARMCC_VERSION/1000000)
>  # define @PREFIX at COMPILER_VERSION_MINOR @MACRO_DEC@(__ARMCC_VERSION/10000 % 100)
>  # define @PREFIX at COMPILER_VERSION_PATCH @MACRO_DEC@(__ARMCC_VERSION     % 10000)")
> 
> Do all the compilers define that?  Are they different?  Is there another preprocessor definition that distinguishes them?  Do they also define __GNUC__ and/or > __clang__?
I can't test the armclang defines, so the information I have about those comes from what I can read in its documentation.

armcc defines:
* __ARMCC_VERSION (version)
* __CC_ARM (1)
* __GNUC__ (version) (only if --gnu is passed as a commad line option)

armclang defines:
* __ARMCC_VERSION (version)
* __ARMCOMPILER_VERSION (version)
* __GNUC__ (version)
* Note that it does *not* define __clang__

arm-linux-gnueabihf-gcc defines:
* __GNUC__ (version)

So if we're interested in giving support only to armcc, then we could use _CC_ARM to find out whether we are actually invoking it, and then after __ARMCC_VERSION to find out the actual compiler version.

-Joakim


More information about the cmake-developers mailing list