IAR-DetermineCompiler.cmake 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # IAR Systems compiler for ARM embedded systems.
  2. # http://www.iar.com
  3. # http://supp.iar.com/FilesPublic/UPDINFO/004916/arm/doc/EWARM_DevelopmentGuide.ENU.pdf
  4. #
  5. # __IAR_SYSTEMS_ICC__ An integer that identifies the IAR compiler platform:
  6. # 9 and higher means C11 and C++14 as language default
  7. # 8 means C99 and C++03 as language default
  8. # 7 and lower means C89 and EC++ as language default.
  9. # __ICCARM__ An integer that is set to 1 when the code is compiled with the IAR C/C++ Compiler for ARM
  10. # __VER__ An integer that identifies the version number of the IAR compiler in use. For example,
  11. # version 5.11.3 is returned as 5011003.
  12. #
  13. # IAR Systems Compiler for AVR embedded systems
  14. # http://supp.iar.com/FilesPublic/UPDINFO/007051/ew/doc/EWAVR_CompilerReference.pdf
  15. #
  16. # __IAR_SYSTEMS_ICC__ An integer that identifies the IAR compiler platform.
  17. # __ICCAVR__ An integer that is set to 1 when the code is compiled with the IAR C/C++ Compiler for AVR
  18. # __VER__ An integer that identifies the version number of the IAR compiler in use.
  19. # The value is calculated by (100 * VERSION_MAJOR + VERSION_MINOR). For example the version
  20. # 3.34 is given as 334
  21. # __SUBVERSION__ An integer that identifies the subversion number of the compiler version number
  22. # for example 3 in 1.2.3.4. THis is used as the patch version, as seen when running iccavr
  23. # from the command line
  24. #
  25. set(_compiler_id_pp_test "defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)")
  26. set(_compiler_id_version_compute "
  27. # if defined(__VER__) && defined(__ICCARM__)
  28. # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__VER__) / 1000000)
  29. # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(((__VER__) / 1000) % 1000)
  30. # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@((__VER__) % 1000)
  31. # define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__IAR_SYSTEMS_ICC__)
  32. # elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__))
  33. # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__VER__) / 100)
  34. # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__VER__) - (((__VER__) / 100)*100))
  35. # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__SUBVERSION__)
  36. # define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__IAR_SYSTEMS_ICC__)
  37. # endif")