summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/IAR-C.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/Compiler/IAR-C.cmake')
-rw-r--r--Modules/Compiler/IAR-C.cmake42
1 files changed, 22 insertions, 20 deletions
diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake
index 7b2e556..9629279 100644
--- a/Modules/Compiler/IAR-C.cmake
+++ b/Modules/Compiler/IAR-C.cmake
@@ -1,10 +1,16 @@
-# This file is processed when the IAR compiler is used for a C file
-
+# This file is processed when the IAR C Compiler is used
+#
+# C Language Specification support
+# - Newer versions of the IAR C Compiler require the --c89 flag to build a file under the C90 standard.
+# - Earlier versions of the compiler had C90 by default, not requiring the backward-compatibility flag.
+#
+# The IAR Language Extensions
+# - The IAR Language Extensions can be enabled by -e flag
+#
include(Compiler/IAR)
include(Compiler/CMakeCommonCompilerMacros)
-# Common
-if(NOT CMAKE_C_COMPILER_VERSION)
+if(NOT DEFINED CMAKE_C_COMPILER_VERSION)
message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION not detected. This should be automatic.")
endif()
@@ -13,46 +19,42 @@ set(CMAKE_C_EXTENSION_COMPILE_OPTION -e)
if(CMAKE_C_COMPILER_VERSION_INTERNAL VERSION_GREATER 7)
set(CMAKE_C90_STANDARD_COMPILE_OPTION --c89)
set(CMAKE_C90_EXTENSION_COMPILE_OPTION --c89 -e)
- set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
- set(CMAKE_C99_EXTENSION_COMPILE_OPTION -e)
else()
set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION -e)
endif()
-if(CMAKE_C_COMPILER_VERSION_INTERNAL VERSION_GREATER 8)
- set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION -e)
-endif()
+set(CMAKE_C${CMAKE_C_STANDARD_COMPUTED_DEFAULT}_STANDARD_COMPILE_OPTION "")
+set(CMAKE_C${CMAKE_C_STANDARD_COMPUTED_DEFAULT}_EXTENSION_COMPILE_OPTION -e)
# Architecture specific
if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
- if(CMAKE_C_COMPILER_VERSION_INTERNAL VERSION_LESS 7)
- # IAR ARM 4.X uses xlink.exe, detection is not implemented
- message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION = ${CMAKE_C_COMPILER_VERSION} not supported by CMake.")
+ if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5)
+ # IAR C Compiler for Arm prior version 5.xx uses XLINK. Support in CMake is not implemented.
+ message(FATAL_ERROR "IAR C Compiler for Arm version ${CMAKE_C_COMPILER_VERSION} not supported by CMake.")
endif()
__compiler_iar_ilink(C)
- __compiler_check_default_language_standard(C 1.10 90 6.10 99 8.10 11)
+ __compiler_check_default_language_standard(C 5.10 90 6.10 99 8.10 11 8.40 17)
elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX")
__compiler_iar_ilink(C)
- __compiler_check_default_language_standard(C 1.10 90 2.10 99 4.10 11)
+ __compiler_check_default_language_standard(C 1.10 90 2.10 99 4.10 11 4.20 17)
elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850")
__compiler_iar_ilink(C)
- __compiler_check_default_language_standard(C 1.10 90 1.10 99 2.10 11)
+ __compiler_check_default_language_standard(C 1.10 90 1.10 99 2.10 11 2.21 17)
elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78")
if(CMAKE_C_COMPILER_VERSION VERSION_LESS 2)
- # IAR RL78 1.X uses xlink.exe, detection is not implemented
- message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION = ${CMAKE_C_COMPILER_VERSION} not supported by CMake.")
+ # IAR C Compiler for RL78 prior version 2.xx uses XLINK. Support in CMake is not implemented.
+ message(FATAL_ERROR "IAR C Compiler for RL78 version ${CMAKE_C_COMPILER_VERSION} not supported by CMake.")
endif()
__compiler_iar_ilink(C)
- __compiler_check_default_language_standard(C 2.10 90 1.10 99 4.10 11)
+ __compiler_check_default_language_standard(C 2.10 90 2.10 99 4.10 11 4.20 17)
elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RISCV")
__compiler_iar_ilink(C)
- __compiler_check_default_language_standard(C 1.10 90 1.10 99 1.10 11)
+ __compiler_check_default_language_standard(C 1.10 90 1.10 99 1.10 11 1.21 17)
elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
__compiler_iar_xlink(C)