mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 10:50:16 -06:00
IAR: update language specification detection
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -1,67 +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_STANDARD_COMPILE_OPTION "")
|
||||
set(CMAKE_CXX_EXTENSION_COMPILE_OPTION -e)
|
||||
|
||||
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 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 RL78 1.X uses xlink.exe, detection is not implemented
|
||||
message(FATAL_ERROR "CMAKE_CXX_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_CXX_COMPILER_VERSION} not supported by CMake.")
|
||||
endif()
|
||||
__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 "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)
|
||||
|
||||
@@ -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 "
|
||||
|
||||
@@ -1,43 +1,11 @@
|
||||
# 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
|
||||
# This file is processed when the IAR C/C++ Compiler is used
|
||||
#
|
||||
# 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
|
||||
# CPU <arch> supported in CMake: 8051, Arm, AVR, MSP430, RH850, RISC-V, RL78, RX and V850
|
||||
#
|
||||
# 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
|
||||
# The compiler user documentation is architecture-dependent
|
||||
# and it can found with the product installation under <arch>/doc/{EW,BX}<arch>_DevelopmentGuide.ENU.pdf
|
||||
#
|
||||
# recent versions only have --c++ for full support
|
||||
# but can choose to disable features with further arguments
|
||||
#
|
||||
# C/C++ Standard compliance
|
||||
#
|
||||
# IAR has 3 modes: default, strict and extended
|
||||
# the extended mode is needed for popular libraries like CMSIS
|
||||
#
|
||||
# "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)
|
||||
|
||||
Reference in New Issue
Block a user