IAR-CXX.cmake 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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_CXX_COMPILER_VERSION)
  6. message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.")
  7. endif()
  8. if(NOT CMAKE_IAR_CXX_FLAG)
  9. # The --c++ flag was introduced in platform version 9 for all architectures except ARM where it was introduced already in version 7
  10. if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 8 OR
  11. (CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 6 AND "${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") )
  12. set(CMAKE_IAR_CXX_FLAG --c++)
  13. else()
  14. set(CMAKE_IAR_CXX_FLAG --eec++)
  15. endif()
  16. endif()
  17. set(CMAKE_CXX_EXTENSION_COMPILE_OPTION -e)
  18. if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 7)
  19. set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
  20. set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -e)
  21. set(CMAKE_CXX03_STANDARD_COMPILE_OPTION "")
  22. set(CMAKE_CXX03_EXTENSION_COMPILE_OPTION -e)
  23. endif()
  24. if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 8)
  25. set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "")
  26. set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -e)
  27. set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "")
  28. set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -e)
  29. endif()
  30. # Architecture specific
  31. if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
  32. if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_LESS 7)
  33. # IAR ARM 4.X uses xlink.exe, detection is not yet implemented
  34. message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION = ${CMAKE_C_COMPILER_VERSION} not supported by CMake.")
  35. endif()
  36. __compiler_iar_ilink(CXX)
  37. __compiler_check_default_language_standard(CXX 6.10 98 8.10 14)
  38. elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX")
  39. __compiler_iar_ilink(CXX)
  40. __compiler_check_default_language_standard(CXX 2.10 98 4.10 14)
  41. elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850")
  42. __compiler_iar_ilink(CXX)
  43. __compiler_check_default_language_standard(CXX 1.10 98 2.10 14)
  44. elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78")
  45. __compiler_iar_ilink(CXX)
  46. __compiler_check_default_language_standard(CXX 1.10 98 4.10 14)
  47. elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RISCV")
  48. __compiler_iar_ilink(CXX)
  49. __compiler_check_default_language_standard(CXX 1.10 98 1.10 14)
  50. elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
  51. __compiler_iar_xlink(CXX)
  52. __compiler_check_default_language_standard(CXX 7.10 98)
  53. elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430")
  54. __compiler_iar_xlink(CXX)
  55. __compiler_check_default_language_standard(CXX 5.10 98)
  56. set(CMAKE_CXX_OUTPUT_EXTENSION ".r43")
  57. elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "V850")
  58. __compiler_iar_xlink(CXX)
  59. __compiler_check_default_language_standard(CXX 1.10 98)
  60. set(CMAKE_C_OUTPUT_EXTENSION ".r85")
  61. elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051")
  62. __compiler_iar_xlink(CXX)
  63. __compiler_check_default_language_standard(CXX 6.10 98)
  64. set(CMAKE_C_OUTPUT_EXTENSION ".r51")
  65. else()
  66. message(FATAL_ERROR "CMAKE_CXX_COMPILER_ARCHITECTURE_ID not detected. This should be automatic." )
  67. endif()