diff options
author | Stefan Andersson <tfosm@hotmail.com> | 2019-04-05 09:50:59 (GMT) |
---|---|---|
committer | Stefan Andersson <tfosm@hotmail.com> | 2019-04-12 07:10:02 (GMT) |
commit | ea83d0f8fb8fd6806c4d5f32e0392638ddc3b65e (patch) | |
tree | 1640a28ff8cc7d50d7a043decb5c948e918e563a /Modules/Compiler/IAR.cmake | |
parent | 52fb35bd69ec2fa1a5307695cb22c3f125debf4f (diff) | |
download | CMake-ea83d0f8fb8fd6806c4d5f32e0392638ddc3b65e.zip CMake-ea83d0f8fb8fd6806c4d5f32e0392638ddc3b65e.tar.gz CMake-ea83d0f8fb8fd6806c4d5f32e0392638ddc3b65e.tar.bz2 |
IAR: Generalize and add support for IAR RX compiler
Moved common ASM setup to the common macros and changed version check.
Diffstat (limited to 'Modules/Compiler/IAR.cmake')
-rw-r--r-- | Modules/Compiler/IAR.cmake | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake index bbcdea2..8e75caa 100644 --- a/Modules/Compiler/IAR.cmake +++ b/Modules/Compiler/IAR.cmake @@ -2,11 +2,16 @@ # 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: +# 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, @@ -33,15 +38,11 @@ # code and data size printouts (that can be inspected with common tools). # This module is shared by multiple languages; use include blocker. -if(_IARARM_CMAKE_LOADED) - return() -endif() -set(_IARARM_CMAKE_LOADED 1) +include_guard() -macro(__compiler_iar_ARM lang) +macro(__compiler_iar_ilink lang) set(CMAKE_EXECUTABLE_SUFFIX ".elf") 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>") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy") @@ -56,17 +57,25 @@ macro(__compiler_iar_ARM lang) string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -Oh -r -DNDEBUG") endif() - set(CMAKE_${lang}_LINK_EXECUTABLE "\"${CMAKE_IAR_LINKARM}\" --silent <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") + 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_IAR_LINKER}\" --silent <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "\"${CMAKE_IAR_ARCHIVE}\" <TARGET> --create <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_CREATE "\"${CMAKE_IAR_ARCHIVE}\" <TARGET> --create <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_APPEND "\"${CMAKE_IAR_ARCHIVE}\" <TARGET> --replace <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_FINISH "") - set(CMAKE_LINKER "${CMAKE_IAR_LINKARM}" CACHE FILEPATH "The IAR linker" FORCE) + set(CMAKE_LINKER "${CMAKE_IAR_LINKER}" CACHE FILEPATH "The IAR linker" FORCE) set(CMAKE_AR "${CMAKE_IAR_ARCHIVE}" CACHE FILEPATH "The IAR archiver" FORCE) endmacro() -macro(__compiler_iar_AVR lang) +macro(__compiler_iar_xlink lang) set(CMAKE_EXECUTABLE_SUFFIX ".bin") if (${lang} STREQUAL "C" OR ${lang} STREQUAL "CXX") @@ -84,6 +93,14 @@ macro(__compiler_iar_AVR 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_IAR_LINKER}\" -S <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "\"${CMAKE_IAR_AR}\" <TARGET> <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_CREATE "\"${CMAKE_IAR_AR}\" <TARGET> <LINK_FLAGS> <OBJECTS>") |