1# SPDX-License-Identifier: Apache-2.0 2 3set_ifndef(CC gcc) 4 5find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}${CC} PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 6find_program(CMAKE_GCOV ${CROSS_COMPILE}gcov PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 7 8if(CMAKE_C_COMPILER STREQUAL CMAKE_C_COMPILER-NOTFOUND) 9 message(FATAL_ERROR "Zephyr was unable to find ${CROSS_COMPILE}${CC}. Is the environment misconfigured? 10User-configuration: 11ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT} 12Internal variables: 13CROSS_COMPILE: ${CROSS_COMPILE} 14TOOLCHAIN_HOME: ${TOOLCHAIN_HOME} 15TOOLCHAIN_VER: ${TOOLCHAIN_VER} 16") 17endif() 18 19execute_process( 20 COMMAND ${CMAKE_C_COMPILER} --version ${XTENSA_CORE_LOCAL_C_FLAG} 21 RESULT_VARIABLE ret 22 OUTPUT_VARIABLE stdoutput 23 ) 24if(ret) 25 message(FATAL_ERROR "Executing the below command failed. Are permissions set correctly? 26 ${CMAKE_C_COMPILER} --version ${XTENSA_CORE_LOCAL_C_FLAG} 27 ${stdoutput} 28" 29 ) 30endif() 31