c++ - How to detect Cross GCC compiler using Macros -
i found interesting article: c/c++ tip: how detect compiler name , version using compiler predefined macros
is possible detect using macro if current compiler cross gcc (the 1 used default eclipse cdt)?
it easy detect, if compiling e.g. arm, not possible detect macro, if compiling arm on arm or cros-compiling on x86.
you need support in build system , pass variable compiler
gcc -dis_crosscompiling=1
using gcc dump preprocessor defines check output of cross compiler , system compiler. there lot of defines nothing cross compilation.
according http://www.gnu.org/software/automake/manual/html_node/cross_002dcompilation.html autotools performing check
checking whether cross compiling... yes
and hope result can made visible gcc.
you can run ugly command check sort of cross compilation
gcc -march=native -e - < /dev/null
this command fail, if cross compiler different architecture, not fail, if different operating system.
Comments
Post a Comment