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 the toolchain. Is the environment misconfigured? 10User-configuration: 11ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT} 12Internal variables: 13CROSS_COMPILE: ${CROSS_COMPILE} 14TOOLCHAIN_HOME: ${TOOLCHAIN_HOME} 15") 16endif() 17 18execute_process( 19 COMMAND ${CMAKE_C_COMPILER} --version 20 RESULT_VARIABLE ret 21 OUTPUT_QUIET 22 ERROR_QUIET 23 ) 24if(ret) 25 message(FATAL_ERROR "Executing the below command failed. Are permissions set correctly? 26'${CMAKE_C_COMPILER} --version' 27" 28 ) 29endif() 30