summaryrefslogtreecommitdiff
path: root/Modules/Compiler/IAR-DetermineCompiler.cmake
diff options
context:
space:
mode:
authorEthan Slattery <theslat@gmail.com>2019-01-10 17:26:37 -0800
committerBrad King <brad.king@kitware.com>2019-01-15 13:59:01 -0500
commit270965e0c7dadccc3564f7ab825cd4e618a15e42 (patch)
tree4efc9ab5a28f6554a9b8fe037a0861cd1a976676 /Modules/Compiler/IAR-DetermineCompiler.cmake
parent7414d422b267718e737637fefa01b94502febb0e (diff)
downloadcmake-270965e0c7dadccc3564f7ab825cd4e618a15e42.tar.gz
IAR: Update compiler modules to support AVR systems
Fixes: #18557
Diffstat (limited to 'Modules/Compiler/IAR-DetermineCompiler.cmake')
-rw-r--r--Modules/Compiler/IAR-DetermineCompiler.cmake22
1 files changed, 20 insertions, 2 deletions
diff --git a/Modules/Compiler/IAR-DetermineCompiler.cmake b/Modules/Compiler/IAR-DetermineCompiler.cmake
index a1bffebdb2..43477acb1e 100644
--- a/Modules/Compiler/IAR-DetermineCompiler.cmake
+++ b/Modules/Compiler/IAR-DetermineCompiler.cmake
@@ -1,4 +1,4 @@
-# IAR Systems compiler for embedded systems.
+# IAR Systems compiler for ARM embedded systems.
# http://www.iar.com
# http://supp.iar.com/FilesPublic/UPDINFO/004916/arm/doc/EWARM_DevelopmentGuide.ENU.pdf
#
@@ -9,13 +9,31 @@
# __ICCARM__ An integer that is set to 1 when the code is compiled with the IAR C/C++ Compiler for ARM
# __VER__ An integer that identifies the version number of the IAR compiler in use. For example,
# version 5.11.3 is returned as 5011003.
+#
+# IAR Systems Compiler for AVR embedded systems
+# http://supp.iar.com/FilesPublic/UPDINFO/007051/ew/doc/EWAVR_CompilerReference.pdf
+#
+# __IAR_SYSTEMS_ICC__ An integer that identifies the IAR compiler platform.
+# __ICCAVR__ An integer that is set to 1 when the code is compiled with the IAR C/C++ Compiler for AVR
+# __VER__ An integer that identifies the version number of the IAR compiler in use.
+# The value is calculated by (100 * VERSION_MAJOR + VERSION_MINOR). For example the version
+# 3.34 is given as 334
+# __SUBVERSION__ An integer that identifies the subversion number of the compiler version number
+# for example 3 in 1.2.3.4. THis is used as the patch version, as seen when running iccavr
+# from the command line
+#
set(_compiler_id_pp_test "defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)")
set(_compiler_id_version_compute "
-# if defined(__VER__)
+# if defined(__VER__) && defined(__ICCARM__)
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__VER__) / 1000000)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(((__VER__) / 1000) % 1000)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@((__VER__) % 1000)
# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__IAR_SYSTEMS_ICC__)
+# elif defined(__VER__) && defined(__ICCAVR__)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__VER__) / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__VER__) - (((__VER__) / 100)*100))
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__SUBVERSION__)
+# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__IAR_SYSTEMS_ICC__)
# endif")