IAR: display linker resource consumption summary for higher verbosity levels
Problem
There is a common request in which IAR users would like to have the possibility to show the resource consumption of an executable target when a higher verbosity level is set in CMake.
Currently
The IAR linkers are currently being invoked with the:
-
--silent
flag, for linkers using ELF (*ILINK) and, -
-S
, for linkers using UBROF (*XLINK)
Those flags are hard-coded to their respective CMAKE_${lang}_LINK_EXECUTABLE
variables and both suppress the linker-provided resource consumption summary.
Expectation
When a higher verbosity level is requested, a summary would be shown at the linking stage for the supported generators:
$ 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.1.338/LNX for ARM
Copyright 2007-2022 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
This outcome is achievable by removing the linker silencer flags from their respective CMAKE_${lang}_LINK_EXECUTABLE
variables.
Discussion
A merge request with such ambition has been started (!8421 (merged)). It needs, however, further discussion regarding the appropriate delivery method. As explained in the MR, infering the verbosity level for this based on cmake_language(GET_MESSAGE_LOG_LEVEL <VAR>)
might not be the best approach, as such option should only be used for setting the verbosity level of messages()
at configure-time.