2021-03-10 06:47:40 -05:00
|
|
|
# Check toolchain is configured properly in cmake
|
2022-11-18 07:29:39 -05:00
|
|
|
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
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
|
|
|
|
OUTPUT_VARIABLE dump_machine
|
|
|
|
)
|
|
|
|
endif()
|
2023-04-25 06:59:41 -04:00
|
|
|
message(STATUS "Compiler supported targets: ${dump_machine}")
|
2022-11-18 07:29:39 -05:00
|
|
|
|
|
|
|
if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Generic" AND ${dump_machine} MATCHES xtensa))
|
2021-03-10 06:47:40 -05:00
|
|
|
message(FATAL_ERROR "Internal error, toolchain has not been set correctly by project "
|
|
|
|
"(or an invalid CMakeCache.txt file has been generated somehow)")
|
|
|
|
endif()
|