summaryrefslogtreecommitdiff
path: root/Modules/Compiler/IAR-C.cmake
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2012-01-04 21:29:11 +0100
committerBrad King <brad.king@kitware.com>2013-04-15 09:11:17 -0400
commit22fb73a0d6e27f0ecaf4e10705de204742427b31 (patch)
tree23bf8fa1b489375b121b7b74f10cea95bd037f9f /Modules/Compiler/IAR-C.cmake
parentc6253fba415238bc85f4b74365a7d6ebac1735e7 (diff)
downloadcmake-22fb73a0d6e27f0ecaf4e10705de204742427b31.tar.gz
Add support files for C, C++ and ASM for the IAR toolchain.
The original feature request is at http://www.cmake.org/Bug/view.php?id=10176 Documentation can be found at http://www.iar.com/website1/1.0.1.0/675/1/ Alex
Diffstat (limited to 'Modules/Compiler/IAR-C.cmake')
-rw-r--r--Modules/Compiler/IAR-C.cmake34
1 files changed, 34 insertions, 0 deletions
diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake
new file mode 100644
index 0000000000..da29447c4c
--- /dev/null
+++ b/Modules/Compiler/IAR-C.cmake
@@ -0,0 +1,34 @@
+# This file is processed when the IAR compiler is used for a C file
+
+
+include(Compiler/IAR)
+
+set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <FLAGS> -o <OBJECT>")
+set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>")
+set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy")
+
+# The toolchains for ARM and AVR are quite different:
+if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM")
+
+ 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> <TARGET> --create <LINK_FLAGS> <OBJECTS> ")
+
+endif()
+
+
+if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "AVR")
+ set(CMAKE_C_OUTPUT_EXTENSION ".r90")
+
+ if(NOT CMAKE_C_LINK_FLAGS)
+ 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> ")
+
+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" )