IAR-C.cmake 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # This file is processed when the IAR compiler is used for a C file
  2. include(Compiler/IAR)
  3. include(Compiler/CMakeCommonCompilerMacros)
  4. # Common
  5. if(NOT CMAKE_C_COMPILER_VERSION)
  6. message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION not detected. This should be automatic.")
  7. endif()
  8. set(CMAKE_C_EXTENSION_COMPILE_OPTION -e)
  9. if(CMAKE_C_COMPILER_VERSION_INTERNAL VERSION_GREATER 7)
  10. set(CMAKE_C90_STANDARD_COMPILE_OPTION --c89)
  11. set(CMAKE_C90_EXTENSION_COMPILE_OPTION --c89 -e)
  12. set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
  13. set(CMAKE_C99_EXTENSION_COMPILE_OPTION -e)
  14. else()
  15. set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
  16. set(CMAKE_C90_EXTENSION_COMPILE_OPTION -e)
  17. endif()
  18. if(CMAKE_C_COMPILER_VERSION_INTERNAL VERSION_GREATER 8)
  19. set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
  20. set(CMAKE_C11_EXTENSION_COMPILE_OPTION -e)
  21. endif()
  22. # Architecture specific
  23. if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
  24. if(CMAKE_C_COMPILER_VERSION_INTERNAL VERSION_LESS 7)
  25. # IAR ARM 4.X uses xlink.exe, detection is not yet implemented
  26. message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION = ${CMAKE_C_COMPILER_VERSION} not supported by CMake.")
  27. endif()
  28. __compiler_iar_ilink(C)
  29. __compiler_check_default_language_standard(C 1.10 90 6.10 99 8.10 11)
  30. elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX")
  31. __compiler_iar_ilink(C)
  32. __compiler_check_default_language_standard(C 1.10 90 2.10 99 4.10 11)
  33. elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850")
  34. __compiler_iar_ilink(C)
  35. __compiler_check_default_language_standard(C 1.10 90 1.10 99 2.10 11)
  36. elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78")
  37. __compiler_iar_ilink(C)
  38. __compiler_check_default_language_standard(C 1.10 90 1.10 99 4.10 11)
  39. elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RISCV")
  40. __compiler_iar_ilink(C)
  41. __compiler_check_default_language_standard(C 1.10 90 1.10 99 1.10 11)
  42. elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
  43. __compiler_iar_xlink(C)
  44. __compiler_check_default_language_standard(C 7.10 99)
  45. set(CMAKE_C_OUTPUT_EXTENSION ".r90")
  46. elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430")
  47. __compiler_iar_xlink(C)
  48. __compiler_check_default_language_standard(C 1.10 90 5.10 99)
  49. set(CMAKE_C_OUTPUT_EXTENSION ".r43")
  50. elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "V850")
  51. __compiler_iar_xlink(C)
  52. __compiler_check_default_language_standard(C 1.10 90 4.10 99)
  53. set(CMAKE_C_OUTPUT_EXTENSION ".r85")
  54. elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051")
  55. __compiler_iar_xlink(C)
  56. __compiler_check_default_language_standard(C 6.10 90 8.10 99)
  57. set(CMAKE_C_OUTPUT_EXTENSION ".r51")
  58. else()
  59. message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected. This should be automatic.")
  60. endif()