esp-idf/components/xtensa/project_include.cmake
Ivan Grokhotkov 9d82d6bf7f
xtensa: don't print debug messages to stderr
By default, CMake message() commands prints to stderr.
IDEs like Eclipse show stderr output in red, which looks as if this is
some kind of error.

Use message(STATUS) instead.
2023-04-25 12:59:41 +02:00

21 lines
798 B
CMake

# Check toolchain is configured properly in cmake
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()
message(STATUS "Compiler supported targets: ${dump_machine}")
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()