File: IAR-C.cmake

package info (click to toggle)
cmake 3.13.4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 77,660 kB
  • sloc: ansic: 271,692; cpp: 195,350; yacc: 3,203; sh: 3,078; xml: 2,586; python: 1,182; lex: 1,138; asm: 370; lisp: 275; perl: 226; java: 197; f90: 175; objc: 157; cs: 124; fortran: 113; makefile: 81; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (49 lines) | stat: -rw-r--r-- 1,791 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# This file is processed when the IAR compiler is used for a C file

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()

  set(CMAKE_C_EXTENSION_COMPILE_OPTION -e)

  set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
  set(CMAKE_C90_EXTENSION_COMPILE_OPTION -e)

  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()

  __compiler_iar_ARM(C)
  __compiler_check_default_language_standard(C 1.10 90 6.10 99 8.10 11)

elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
  __compiler_iar_AVR(C)
  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> ")

  # add the target specific include directory:
  get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH)
  get_filename_component(_compilerDir "${_compilerDir}" PATH)
  include_directories("${_compilerDir}/inc" )

else()
  message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\".  This should be automatic.")
endif()