Skip to content

Invoking IAR binary utilities

Felipe Torrezan edited this page Apr 26, 2025 · 12 revisions

Introduction

CMake automatically detects the IAR Build Tools and provides internal variables for them, making possible to invoke its binary utilities directly from a CMake project.

Description

cmake_minimum_required() Tool CMake internal variable
3.31 IAR ELF Dumper CMAKE_IAR_ELFDUMP
3.31 IAR ELF Tool CMAKE_IAR_ELFTOOL
3.31 IAR ELF Exe to Object Tool CMAKE_IAR_EXE2OBJ
3.31 IAR Object File Manipulator CMAKE_IAR_OBJMANIP
3.31 IAR Absolute Symbol Exporter CMAKE_IAR_SYMEXPORT
4.1 IAR C-STAT Command Line Interface CMAKE_IAR_CSTAT
4.1 IAR C-STAT Checks Manifest Handler CMAKE_IAR_CHECKS
4.1 IAR C-STAT Report Generator CMAKE_IAR_REPORT

Important

Please notice that these references expect their respective tools being available in the installed toolchain.

Example

In the example below, the IAR ELF Tool is used at the post-build stage for converting the executable output from myTarget to its binary form, in the Intel Extended format (*.hex):

add_custom_command(TARGET myTarget
  POST_BUILD 
  COMMAND ${CMAKE_IAR_ELFTOOL} --silent --ihex $<TARGET_FILE:myTarget> myTarget.hex)

Related resources

Clone this wiki locally