execute_process(COMMAND ${SIZE_TOOL} ${ELF} OUTPUT_VARIABLE _out RESULT_VARIABLE _res) if(NOT _res EQUAL 0) message(FATAL_ERROR "avr-size failed") endif() # avr-size line 2 is " ". string(REGEX MATCH "\n[ \t]*([0-9]+)" _m "${_out}") set(_text ${CMAKE_MATCH_1}) if(_text GREATER LIMIT) message(FATAL_ERROR ".text is ${_text} bytes, over the ${LIMIT}-byte boot section") endif() message(STATUS ".text ${_text} <= ${LIMIT} (boot section budget)")