summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/IAR-DetermineCompiler.cmake
diff options
context:
space:
mode:
authorNorbert Lange <nolange79@gmail.com>2017-06-15 12:50:22 (GMT)
committerBrad King <brad.king@kitware.com>2017-06-29 17:25:58 (GMT)
commitd8e6cd9ed8bfee9073cff26cb654bc01e653b0b9 (patch)
tree97832d5147c8ea16bf64e3ca53a9a927dd3f40c6 /Modules/Compiler/IAR-DetermineCompiler.cmake
parent0b1a2876c817a00daf7027570b1976a9e15ff654 (diff)
downloadCMake-d8e6cd9ed8bfee9073cff26cb654bc01e653b0b9.zip
CMake-d8e6cd9ed8bfee9073cff26cb654bc01e653b0b9.tar.gz
CMake-d8e6cd9ed8bfee9073cff26cb654bc01e653b0b9.tar.bz2
IAR: Improve support for IAR ARM Compiler
Make the implementation for this compiler more complete. IAR has multiple C++ modes, historically they were reduced c++ versions for embedded that gradually improved to the full standard (which can be reduced again by e.g. disabling rtti and exceptions). The new implementation picks the best available, but the c++ mode can also be overridden by defining `CMAKE_IAR_CXX_FLAG`. Add C/C++ standard flags so that all modes up to and including the last supported standard are defined. Fixes: #16826
Diffstat (limited to 'Modules/Compiler/IAR-DetermineCompiler.cmake')
-rw-r--r--Modules/Compiler/IAR-DetermineCompiler.cmake18
1 files changed, 16 insertions, 2 deletions
diff --git a/Modules/Compiler/IAR-DetermineCompiler.cmake b/Modules/Compiler/IAR-DetermineCompiler.cmake
index c39810a..4ef587b 100644
--- a/Modules/Compiler/IAR-DetermineCompiler.cmake
+++ b/Modules/Compiler/IAR-DetermineCompiler.cmake
@@ -1,4 +1,18 @@
-
# IAR Systems compiler for embedded systems.
# http://www.iar.com
-set(_compiler_id_pp_test "defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)")
+# http://supp.iar.com/FilesPublic/UPDINFO/004916/arm/doc/EWARM_DevelopmentGuide.ENU.pdf
+#
+# __IAR_SYSTEMS_ICC__ An integer that identifies the IAR compiler platform. The current value is 8. Note that
+# the number could be higher in a future version of the product
+# __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.
+
+set(_compiler_id_pp_test "defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)")
+
+set(_compiler_id_version_compute "
+# if defined(__VER__)
+# 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)
+# endif")