diff options
Diffstat (limited to 'Modules/Compiler')
-rw-r--r-- | Modules/Compiler/CMakeCommonCompilerMacros.cmake | 18 | ||||
-rw-r--r-- | Modules/Compiler/IAR-ASM.cmake | 74 | ||||
-rw-r--r-- | Modules/Compiler/IAR-C.cmake | 43 | ||||
-rw-r--r-- | Modules/Compiler/IAR-CXX.cmake | 64 | ||||
-rw-r--r-- | Modules/Compiler/IAR-DetermineCompiler.cmake | 42 | ||||
-rw-r--r-- | Modules/Compiler/IAR.cmake | 60 |
6 files changed, 127 insertions, 174 deletions
diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake index c86af98..2f220d4 100644 --- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake +++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake @@ -38,20 +38,26 @@ macro(__compiler_check_default_language_standard lang stdver1 std1) # support for language standards, then don't bother. if (CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL "${stdver1}") if (NOT CMAKE_${lang}_COMPILER_FORCED) - if (NOT CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT) - message(FATAL_ERROR "CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_${lang}_COMPILER_ID} (${CMAKE_${lang}_COMPILER}) version ${CMAKE_${lang}_COMPILER_VERSION}") + if (NOT CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT OR NOT DEFINED CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT) + message(FATAL_ERROR "CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT and CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT should be set for ${CMAKE_${lang}_COMPILER_ID} (${CMAKE_${lang}_COMPILER}) version ${CMAKE_${lang}_COMPILER_VERSION}") endif () set(CMAKE_${lang}_STANDARD_DEFAULT ${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}) + set(CMAKE_${lang}_EXTENSIONS_DEFAULT ${CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT}) else () list(REVERSE __std_ver_pairs) foreach (__std_ver_pair IN LISTS __std_ver_pairs) string(REGEX MATCH "([^ ]+) (.+)" __std_ver_pair "${__std_ver_pair}") set(__stdver ${CMAKE_MATCH_1}) set(__std ${CMAKE_MATCH_2}) - if (CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL __stdver AND - NOT DEFINED CMAKE_${lang}_STANDARD_DEFAULT) - # Compiler id was forced so just guess the default standard level. - set(CMAKE_${lang}_STANDARD_DEFAULT ${__std}) + # Compiler id was forced so just guess the defaults. + if (CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL __stdver) + if(NOT DEFINED CMAKE_${lang}_EXTENSIONS_DEFAULT) + # Currently known compilers default to enabling extensions. + set(CMAKE_${lang}_EXTENSIONS_DEFAULT ON) + endif() + if(NOT DEFINED CMAKE_${lang}_STANDARD_DEFAULT) + set(CMAKE_${lang}_STANDARD_DEFAULT ${__std}) + endif() endif () unset(__std) unset(__stdver) diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake index e3ca16e..bae0fbd 100644 --- a/Modules/Compiler/IAR-ASM.cmake +++ b/Modules/Compiler/IAR-ASM.cmake @@ -1,57 +1,45 @@ -# This file is processed when the IAR compiler is used for an assembler file +# This file is processed when the IAR Assembler is used include(Compiler/IAR) -if("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") - set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") - __compiler_iar_ilink(ASM) - set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) +cmake_policy(PUSH) +cmake_policy(SET CMP0057 NEW) # if IN_LIST -elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX") - set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") - __compiler_iar_ilink(ASM) - set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) +set(_CMAKE_IAR_ITOOLS "ARM" "RH850" "RL78" "RX" "RISC-V" "STM8") +set(_CMAKE_IAR_XTOOLS "AVR" "MSP430" "V850" "8051") -elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850") - set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") - __compiler_iar_ilink(ASM) - set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) - -elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78") - set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") - __compiler_iar_ilink(ASM) - set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) - -elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RISC-V") - set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") - __compiler_iar_ilink(ASM) - set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) +set(_CMAKE_IAR_ASM_SILENT "RH850" "RL78" "RX" "RISC-V" "STM8") +if("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_ASM_SILENT) + set(_CMAKE_IAR_SILENCER_FLAG " --silent") +else() + set(_CMAKE_IAR_SILENCER_FLAG " -S") +endif() -elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") - set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") - __compiler_iar_xlink(ASM) - set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;asm;msa) +string(APPEND CMAKE_ASM_FLAGS_INIT " ") +string(APPEND CMAKE_ASM_FLAGS_DEBUG_INIT " -r") +string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -DNDEBUG") +string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -DNDEBUG") +string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -r -DNDEBUG") -elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") - set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") - __compiler_iar_xlink(ASM) - set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s43;asm;msa) +set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${_CMAKE_IAR_SILENCER_FLAG} <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") -elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "V850") - set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") - __compiler_iar_xlink(ASM) - set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s85;asm;msa) +if("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_ITOOLS) + __compiler_iar_ilink(ASM) + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S) -elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051") - set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_XTOOLS) __compiler_iar_xlink(ASM) - set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s51;asm;msa) - -elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "STM8") - set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") - __compiler_iar_ilink(ASM) - set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) + # AVR=s90, MSP430=s43, V850=s85, 8051=s51 + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;s43;s85;s51;asm;msa) else() message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID not detected. This should be automatic.") + endif() + +unset(_CMAKE_IAR_ITOOLS) +unset(_CMAKE_IAR_XTOOLS) +unset(_CMAKE_IAR_ASM_SILENT) +unset(_CMAKE_IAR_SILENCER_FLAG) + +cmake_policy(POP) diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake index 054ee74..0ef1a2a 100644 --- a/Modules/Compiler/IAR-C.cmake +++ b/Modules/Compiler/IAR-C.cmake @@ -1,54 +1,61 @@ -# 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() +# Unused after CMP0128 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 yet 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 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 1.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) diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake index d93b272..a3f1dbc 100644 --- a/Modules/Compiler/IAR-CXX.cmake +++ b/Modules/Compiler/IAR-CXX.cmake @@ -1,63 +1,65 @@ -# 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 --c++ flag to build a C++ file. +# Earlier versions for non-ARM architectures provided Embedded C++, enabled with the --eec++ 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_CXX_COMPILER_VERSION) +if(NOT DEFINED CMAKE_CXX_COMPILER_VERSION) message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.") endif() +# Whenever needed, override this default behavior using CMAKE_IAR_CXX_FLAG in your toolchain file. if(NOT CMAKE_IAR_CXX_FLAG) - # The --c++ flag was introduced in platform version 9 for all architectures except ARM where it was introduced already in version 7 - if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 8 OR - (CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 6 AND "${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") ) - set(CMAKE_IAR_CXX_FLAG --c++) + set(_CMAKE_IAR_MODERNCXX_LIST 14 17) + if(${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT} IN_LIST _CMAKE_IAR_MODERNCXX_LIST OR + ("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM" AND ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT} EQUAL 98)) + string(PREPEND CMAKE_CXX_FLAGS "--c++ ") else() - set(CMAKE_IAR_CXX_FLAG --eec++) + string(PREPEND CMAKE_CXX_FLAGS "--eec++ ") endif() + unset(_CMAKE_IAR_MODERNCXX_LIST) endif() -set(CMAKE_CXX_EXTENSION_COMPILE_OPTION -e) +set(CMAKE_CXX_STANDARD_COMPILE_OPTION "") +set(CMAKE_CXX_EXTENSION_COMPILE_OPTION -e) # Unused after CMP0128 -if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 7) - set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") - set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -e) - set(CMAKE_CXX03_STANDARD_COMPILE_OPTION "") - set(CMAKE_CXX03_EXTENSION_COMPILE_OPTION -e) -endif() - -if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 8) - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -e) - set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "") - set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -e) -endif() +set(CMAKE_CXX${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}_STANDARD_COMPILE_OPTION "") +set(CMAKE_CXX${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}_EXTENSION_COMPILE_OPTION -e) # Architecture specific if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") - if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_LESS 7) - # IAR ARM 4.X uses xlink.exe, detection is not yet implemented - message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION = ${CMAKE_C_COMPILER_VERSION} not supported by CMake.") + if (CMAKE_CXX_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_CXX_COMPILER_VERSION} not supported by CMake.") endif() __compiler_iar_ilink(CXX) - __compiler_check_default_language_standard(CXX 6.10 98 8.10 14) + __compiler_check_default_language_standard(CXX 5.10 98 8.10 14 8.40 17) elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX") __compiler_iar_ilink(CXX) - __compiler_check_default_language_standard(CXX 2.10 98 4.10 14) + __compiler_check_default_language_standard(CXX 2.10 98 4.10 14 4.20 17) elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850") __compiler_iar_ilink(CXX) - __compiler_check_default_language_standard(CXX 1.10 98 2.10 14) + __compiler_check_default_language_standard(CXX 1.10 98 2.10 14 2.21 17) elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2) + # # 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_CXX_COMPILER_VERSION} not supported by CMake.") + endif() __compiler_iar_ilink(CXX) - __compiler_check_default_language_standard(CXX 1.10 98 4.10 14) + __compiler_check_default_language_standard(CXX 2.10 98 4.10 14 4.20 17) elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RISCV") __compiler_iar_ilink(CXX) - __compiler_check_default_language_standard(CXX 1.10 98 1.10 14) + __compiler_check_default_language_standard(CXX 1.10 98 1.10 14 1.21 17) elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") __compiler_iar_xlink(CXX) diff --git a/Modules/Compiler/IAR-DetermineCompiler.cmake b/Modules/Compiler/IAR-DetermineCompiler.cmake index 443b09c..b03fd1f 100644 --- a/Modules/Compiler/IAR-DetermineCompiler.cmake +++ b/Modules/Compiler/IAR-DetermineCompiler.cmake @@ -1,28 +1,26 @@ -# IAR Systems compiler for ARM embedded systems. -# http://www.iar.com -# http://supp.iar.com/FilesPublic/UPDINFO/004916/arm/doc/EWARM_DevelopmentGuide.ENU.pdf +# IAR C/C++ Compiler (https://www.iar.com) +# CPU <arch> supported in CMake: 8051, Arm, AVR, MSP430, RH850, RISC-V, RL78, RX and V850 # -# __IAR_SYSTEMS_ICC__ An integer that identifies the IAR compiler platform: -# 9 and higher means C11 and C++14 as language default -# 8 means C99 and C++03 as language default -# 7 and lower means C89 and EC++ as language default. -# __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 C/C++ Compiler for <arch> internal integer symbols used in CMake: # -# IAR Systems Compiler for AVR embedded systems -# http://supp.iar.com/FilesPublic/UPDINFO/007051/ew/doc/EWAVR_CompilerReference.pdf +# __IAR_SYSTEMS_ICC__ +# Provides the compiler internal platform version +# __ICC<arch>__ +# Provides 1 for the current <arch> in use +# __VER__ +# Provides the current version in use +# The semantic version of the compiler is architecture-dependent +# When <arch> is ARM: +# CMAKE_<LANG>_COMPILER_VERSION_MAJOR = (__VER__ / 1E6) +# CMAKE_<LANG>_COMPILER_VERSION_MINOR = (__VER__ / 1E3) % 1E3 +# CMAKE_<LANG>_COMPILER_VERSION_PATCH = (__VER__ % 1E3) +# When <arch> is non-ARM: +# CMAKE_<LANG>_COMPILER_VERSION_MAJOR = (__VER__ / 1E2) +# CMAKE_<LANG>_COMPILER_VERSION_MINOR = (__VER__ - ((__VER__/ 1E2) * 1E2)) +# CMAKE_<LANG>_COMPILER_VERSION_PATCH = (__SUBVERSION__) +# __SUBVERSION__ +# Provides the version's patch level for non-ARM <arch> # -# __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 " diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake index 2200a21..53456f5 100644 --- a/Modules/Compiler/IAR.cmake +++ b/Modules/Compiler/IAR.cmake @@ -1,47 +1,15 @@ -# This file is processed when the IAR compiler is used for a C or C++ file -# Documentation can be downloaded here: http://www.iar.com/website1/1.0.1.0/675/1/ -# The initial feature request is here: https://gitlab.kitware.com/cmake/cmake/-/issues/10176 -# It also contains additional links and information. -# See USER GUIDES -> C/C++ Development Guide and ReleaseNotes for EWARM: -# version 6.30.8: http://supp.iar.com/FilesPublic/UPDINFO/006607/arm/doc/infocenter/index.ENU.html -# version 7.60.1: http://supp.iar.com/FilesPublic/UPDINFO/011006/arm/doc/infocenter/index.ENU.html -# version 8.10.1: http://netstorage.iar.com/SuppDB/Public/UPDINFO/011854/arm/doc/infocenter/index.ENU.html - -# The IAR internal compiler platform generations (Predefined symbol __IAR_SYSTEMS_ICC__): -# 9 and higher means C11 and C++14 as language default (EWARM v8.x, EWRX v4.x and higher) -# 8 means C99 and C++03 as language default (EWARM v6.x, v7.x. EWRX v2.x, 3.x) -# 7 and lower means C89 and EC++ as language default. (EWARM v5.x and lower) - -# C/C++ Standard versions -# -# IAR typically only supports one C and C++ Standard version, -# the exception is C89 which is always supported and can be selected -# if its not the default -# -# C++ is trickier, there were historically 3 switches, -# and some IAR versions support multiple of those. -# they are --eec++, --ec++ and --c++ and where used to -# enable various language features like exceptions -# -# recent versions only have --c++ for full support -# but can choose to disable features with further arguments +# This file is processed when the IAR C/C++ Compiler is used # -# C/C++ Standard compliance +# CPU <arch> supported in CMake: 8051, Arm, AVR, MSP430, RH850, RISC-V, RL78, RX and V850 # -# IAR has 3 modes: default, strict and extended -# the extended mode is needed for popular libraries like CMSIS +# The compiler user documentation is architecture-dependent +# and it can found with the product installation under <arch>/doc/{EW,BX}<arch>_DevelopmentGuide.ENU.pdf # -# "Silent" Operation # -# this really is different to most programs I know. -# nothing meaningful from the operation is lost, just some redundant -# code and data size printouts (that can be inspected with common tools). - -# This module is shared by multiple languages; use include blocker. include_guard() macro(__compiler_iar_ilink lang) - set(CMAKE_EXECUTABLE_SUFFIX_${lang} ".elf") + set(CMAKE_EXECUTABLE_SUFFIX ".elf") set(CMAKE_${lang}_OUTPUT_EXTENSION ".o") if (${lang} STREQUAL "C" OR ${lang} STREQUAL "CXX") set(CMAKE_${lang}_COMPILE_OBJECT "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") @@ -58,14 +26,6 @@ macro(__compiler_iar_ilink lang) string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -Oh -r -DNDEBUG") endif() - if (${lang} STREQUAL "ASM") - string(APPEND CMAKE_ASM_FLAGS_INIT " ") - string(APPEND CMAKE_ASM_FLAGS_DEBUG_INIT " -r") - string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -DNDEBUG") - string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -DNDEBUG") - string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -r -DNDEBUG") - endif() - set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> --silent <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> <TARGET> --create <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> <TARGET> --create <LINK_FLAGS> <OBJECTS>") @@ -74,7 +34,7 @@ macro(__compiler_iar_ilink lang) endmacro() macro(__compiler_iar_xlink lang) - set(CMAKE_EXECUTABLE_SUFFIX_${lang} ".bin") + set(CMAKE_EXECUTABLE_SUFFIX ".bin") if (${lang} STREQUAL "C" OR ${lang} STREQUAL "CXX") set(CMAKE_${lang}_COMPILE_OBJECT "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") @@ -91,14 +51,6 @@ macro(__compiler_iar_xlink lang) string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -Oh -r -DNDEBUG") endif() - if (${lang} STREQUAL "ASM") - string(APPEND CMAKE_ASM_FLAGS_INIT " ") - string(APPEND CMAKE_ASM_FLAGS_DEBUG_INIT " -r") - string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -DNDEBUG") - string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -DNDEBUG") - string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -r -DNDEBUG") - endif() - set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> -S <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> <TARGET> <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> <TARGET> <LINK_FLAGS> <OBJECTS>") |