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-CXX.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-CXX.cmake')
-rw-r--r-- | Modules/Compiler/IAR-CXX.cmake | 72 |
1 files changed, 27 insertions, 45 deletions
diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake index b7076f5..eb27e3c 100644 --- a/Modules/Compiler/IAR-CXX.cmake +++ b/Modules/Compiler/IAR-CXX.cmake @@ -3,60 +3,45 @@ 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) - message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.") - endif() - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.10) - set(CMAKE_IAR_CXX_FLAG --c++) - else() - set(CMAKE_IAR_CXX_FLAG --eec++) - endif() +# Common +if(NOT CMAKE_IAR_CXX_FLAG) + if(NOT CMAKE_CXX_COMPILER_VERSION) + message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.") + endif() + if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 8) + set(CMAKE_IAR_CXX_FLAG --c++) + else() + set(CMAKE_IAR_CXX_FLAG --eec++) endif() +endif() - set(CMAKE_CXX_EXTENSION_COMPILE_OPTION -e) +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) - - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.10) 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() +endif() - __compiler_iar_ARM(CXX) +# Architecture specific +if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") + __compiler_iar_ilink(CXX) __compiler_check_default_language_standard(CXX 6.10 98 8.10 14) -elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") - # "embedded C++" --EC++ is probably closest to CXX98 but with no support for: - # Templates, multiple inheritance, virtual inheritance, exceptions, RTTI, C++ style casts, - # Namespaces, the mutable attribute, no STL, any library features related to the above features. - # - # "(extended) embedded C++" --EEC++ Mode but DOES NOT support any normal C++ standard - # probably closest to CXX98 but with no RTTI and no exceptions, and the library - # provided is not in the standard namespace - if(NOT CMAKE_IAR_CXX_FLAG) - if(NOT CMAKE_CXX_COMPILER_VERSION) - message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.") - endif() - set(CMAKE_IAR_CXX_FLAG --eec++) - endif() +elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX") + __compiler_iar_ilink(CXX) + __compiler_check_default_language_standard(CXX 2.10 98 4.10 14) - set(CMAKE_CXX_EXTENSION_COMPILE_OPTION -e) - set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") - set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -e) - - __compiler_iar_AVR(CXX) +elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") + __compiler_iar_xlink(CXX) __compiler_check_default_language_standard(CXX 7.10 98) set(CMAKE_CXX_OUTPUT_EXTENSION ".r90") @@ -64,15 +49,12 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") set(CMAKE_CXX_LINK_FLAGS "-Fmotorola") endif() - 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") - include_directories("${_compilerDir}/inc/Atmel") + include_directories("${_compilerDir}/inc" ) + include_directories("${_compilerDir}/inc/Atmel" ) else() - message(FATAL_ERROR "CMAKE_CXX_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic." ) + message(FATAL_ERROR "CMAKE_CXX_COMPILER_ARCHITECTURE_ID not detected. This should be automatic." ) endif() |