summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/IAR-C.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/Compiler/IAR-C.cmake')
-rw-r--r--Modules/Compiler/IAR-C.cmake58
1 files changed, 25 insertions, 33 deletions
diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake
index b5e61f0..cb10020 100644
--- a/Modules/Compiler/IAR-C.cmake
+++ b/Modules/Compiler/IAR-C.cmake
@@ -3,44 +3,39 @@
include(Compiler/IAR)
include(Compiler/CMakeCommonCompilerMacros)
-# The toolchains for ARM and AVR are quite different:
-if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
- if(NOT CMAKE_C_COMPILER_VERSION)
- message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION not detected. This should be automatic.")
- endif()
+# Common
+if(NOT CMAKE_C_COMPILER_VERSION)
+ message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION not detected. This should be automatic.")
+endif()
- set(CMAKE_C_EXTENSION_COMPILE_OPTION -e)
+set(CMAKE_C_EXTENSION_COMPILE_OPTION -e)
+if(CMAKE_CXX_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)
+elseif()
set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION -e)
+endif()
- if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.10)
- 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)
- endif()
- if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.10)
- set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION -e)
- endif()
+if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 8)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION -e)
+endif()
- __compiler_iar_ARM(C)
+# Architecture specific
+if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
+ __compiler_iar_ilink(C)
__compiler_check_default_language_standard(C 1.10 90 6.10 99 8.10 11)
-elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
- if(NOT CMAKE_C_COMPILER_VERSION)
- message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION not detected. This should be automatic.")
- endif()
-
- set(CMAKE_C_EXTENSION_COMPILE_OPTION -e)
-
- set(CMAKE_C90_STANDARD_COMPILE_OPTION --c89)
- set(CMAKE_C90_EXTENSION_COMPILE_OPTION -e)
- set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
- set(CMAKE_C99_EXTENSION_COMPILE_OPTION -e)
+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_iar_AVR(C)
+elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
+ __compiler_iar_xlink(C)
__compiler_check_default_language_standard(C 7.10 99)
set(CMAKE_C_OUTPUT_EXTENSION ".r90")
@@ -48,9 +43,6 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
set(CMAKE_C_LINK_FLAGS "-Fmotorola")
endif()
- set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <OBJECTS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>")
- set(CMAKE_C_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)
@@ -58,5 +50,5 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
include_directories("${_compilerDir}/inc/Atmel" )
else()
- message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic.")
+ message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected. This should be automatic.")
endif()