Skip to content

IAR: Move linker silencing flag to CMAKE_EXE_LINKER_FLAGS

The IAR linker silencer flag was previously hardcoded in CMAKE_${lang}_LINKER_EXECUTABLE. Move the flag to a place that is under the end user's control. The default behavior (silenced linker) is not changed.

Motivation

There is a common request in which IAR users would like to have the possibility to show the resource consumption when a higher verbosity level is set in CMake.

Proposed solution

As discussed in #24828 (closed), this change will empower end users to override the linker silencer flag for displaying the IAR linker-provided resource consumption summary.

The default behavior stands, with the IAR linkers' summary being suppressed by their respective silencer flags.

Output example

$ cmake -B _build --toolchain iar-toolchain.cmake
-- The C compiler identification is IAR ARM 9.32.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/iarsystems/bxarm/arm/bin/iccarm - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (0.6s)
-- Generating done (0.0s)
-- Build files have been written to: /github.com/iarsystems/cmake-tutorial/examples/arm/using-libs/_build
$ cmake --build _build
[ 16%] Building C object lib/CMakeFiles/myMath.dir/add.c.o
[ 33%] Building C object lib/CMakeFiles/myMath.dir/sub.c.o
[ 50%] Building C object lib/CMakeFiles/myMath.dir/mul.c.o
[ 66%] Linking C static library libmyMath.a
[ 66%] Built target myMath
[ 83%] Building C object app/CMakeFiles/myProgram.dir/main.c.o
[100%] Linking C executable myProgram.elf

   IAR ELF Linker V9.32.2.340/LNX for ARM
   Copyright 2007-2023 IAR Systems AB.

  1'150 bytes of readonly  code memory
    158 bytes of readonly  data memory
  8'220 bytes of readwrite data memory

Errors: none
Warnings: none

Link time:   0.01 (CPU)   0.01 (elapsed)
[100%] Built target myProgram

Fixes: #24828 (closed)
Topic-rename: iar-silent-flag

Edited by Brad King

Merge request reports