Merge branch 'fix/harden_empty_toolchain_output_v5.5' into 'release/v5.5'

fix: harden build against empty toolchain output (v5.5)

See merge request espressif/esp-idf!51645
This commit is contained in:
Roland Dobai
2026-08-24 13:27:43 +02:00
7 changed files with 161 additions and 77 deletions
+1 -5
View File
@@ -2,11 +2,7 @@
# Warn if the toolchain version doesn't match
#
if(NOT (${target} STREQUAL "linux" OR CMAKE_C_COMPILER_ID MATCHES "Clang"))
execute_process(
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
OUTPUT_VARIABLE toolchain_name
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
__compiler_query(toolchain_name ${CMAKE_C_COMPILER} -dumpmachine)
check_expected_tool_version(${toolchain_name} ${CMAKE_C_COMPILER})
endif()
+3 -10
View File
@@ -2,20 +2,13 @@
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
# without '--target' option 'clang -dumpmachine' prints default target arch and it might be not Xtensa
# so use `-print-targets` option
execute_process(
COMMAND ${CMAKE_C_COMPILER} -print-targets
OUTPUT_VARIABLE dump_machine
)
__compiler_query(dump_machine ${CMAKE_C_COMPILER} -print-targets)
else()
execute_process(
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
OUTPUT_VARIABLE dump_machine
OUTPUT_STRIP_TRAILING_WHITESPACE
)
__compiler_query(dump_machine ${CMAKE_C_COMPILER} -dumpmachine)
endif()
message(STATUS "Compiler supported targets: ${dump_machine}")
if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Generic" AND ${dump_machine} MATCHES xtensa))
if(NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Generic" AND "${dump_machine}" MATCHES "xtensa"))
message(FATAL_ERROR "Internal error, toolchain has not been set correctly by project "
"(or an invalid CMakeCache.txt file has been generated somehow)")
endif()