mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
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:
@@ -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()
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user