diff options
author | Norbert Lange <nolange79@gmail.com> | 2017-06-15 12:50:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-06-29 17:25:58 (GMT) |
commit | d8e6cd9ed8bfee9073cff26cb654bc01e653b0b9 (patch) | |
tree | 97832d5147c8ea16bf64e3ca53a9a927dd3f40c6 /Modules/Compiler/IAR-CXX.cmake | |
parent | 0b1a2876c817a00daf7027570b1976a9e15ff654 (diff) | |
download | CMake-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-CXX.cmake')
-rw-r--r-- | Modules/Compiler/IAR-CXX.cmake | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake index f49968e..7a6ba2b 100644 --- a/Modules/Compiler/IAR-CXX.cmake +++ b/Modules/Compiler/IAR-CXX.cmake @@ -1,24 +1,39 @@ # This file is processed when the IAR compiler is used for a C++ file include(Compiler/IAR) +include(Compiler/CMakeCommonCompilerMacros) + +if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") + # "(extended) embedded C++" Mode + # old version: --ec++ or --eec++ + # since 8.10: --c++ --no_exceptions --no_rtti + # + # --c++ is full C++ and supported since 6.10 + if(NOT CMAKE_IAR_CXX_FLAG) + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.10) + set(CMAKE_IAR_CXX_FLAG --c++) + else() + set(CMAKE_IAR_CXX_FLAG --eec++) + endif() + endif() -set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") - -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy") - -set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "-f ") -set(CMAKE_DEPFILE_FLAGS_CXX "--dependencies=ns <DEPFILE>") - -if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM") + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -e) - set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_LINKER> <OBJECTS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") - set(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_AR> <TARGET> --create <LINK_FLAGS> <OBJECTS> ") - -endif() + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.10) + set(CMAKE_CXX03_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX03_EXTENSION_COMPILE_OPTION -e) + 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() + __compiler_iar_ARM(CXX) + __compiler_check_default_language_standard(CXX 6.10 98 8.10 14) -if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "AVR") +elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") + __compiler_iar_AVR(CXX) set(CMAKE_CXX_OUTPUT_EXTENSION ".r90") if(NOT CMAKE_CXX_LINK_FLAGS) set(CMAKE_CXX_LINK_FLAGS "-Fmotorola") @@ -27,9 +42,8 @@ if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "AVR") set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_LINKER> <OBJECTS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>") set(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_AR> -o <TARGET> <OBJECTS> ") + # add the target specific include directory: + get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) + get_filename_component(_compilerDir "${_compilerDir}" PATH) + include_directories("${_compilerDir}/inc") endif() - -# add the target specific include directory: -get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) -get_filename_component(_compilerDir "${_compilerDir}" PATH) -include_directories("${_compilerDir}/inc") |