1# SPDX-License-Identifier: Apache-2.0 2 3# Configures CMake for using ccac 4 5find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}armclang PATHS ${TOOLCHAIN_HOME}/bin NO_DEFAULT_PATH) 6 7set(triple arm-arm-none-eabi) 8 9find_package(armclang 6.17 REQUIRED) 10 11set(CMAKE_DTS_PREPROCESSOR 12 ${CMAKE_C_COMPILER} 13 "--target=${triple}" 14 # -march=armv6-m is added to silence the warnings: 15 # 'armv4t' and 'arm7tdmi' is unsupported. 16 # We only do preprocessing so the actual arch is not important. 17 "-march=armv6-m" 18) 19 20set(CMAKE_C_COMPILER_TARGET ${triple}) 21set(CMAKE_ASM_COMPILER_TARGET ${triple}) 22set(CMAKE_CXX_COMPILER_TARGET ${triple}) 23 24if(CMAKE_C_COMPILER STREQUAL CMAKE_C_COMPILER-NOTFOUND) 25 message(FATAL_ERROR "Zephyr was unable to find the armclang compiler") 26endif() 27 28execute_process( 29 COMMAND ${CMAKE_C_COMPILER} --version 30 RESULT_VARIABLE ret 31 OUTPUT_VARIABLE stdoutput 32 ) 33 34if(ret) 35 message(FATAL_ERROR "Executing the below command failed. " 36 "Are permissions set correctly? '${CMAKE_C_COMPILER} --version' " 37 "${stdoutput}" 38 "And is the license setup correctly ?" 39 ) 40endif() 41