Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2017, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | #Built in compiler identification does not work for embedded targets, so |
| 9 | #override it here. |
| 10 | |
| 11 | #Stop built in CMakeDetermine<lang>.cmake scripts to run. |
| 12 | set (CMAKE_C_COMPILER_ID_RUN 1) |
| 13 | #Stop cmake run compiler tests. |
| 14 | set (CMAKE_C_COMPILER_FORCED true) |
| 15 | |
| 16 | if(NOT DEFINED CMAKE_C_COMPILER) |
| 17 | message(FATAL_ERROR "Please set CMAKE_C_COMPILER to hold the full path of \ |
| 18 | your compiler executable") |
| 19 | endif(NOT DEFINED CMAKE_C_COMPILER) |
| 20 | |
| 21 | get_filename_component(_C_COMPILER_NAME ${CMAKE_C_COMPILER} NAME) |
| 22 | |
| 23 | #Based on the name of the compiler executable select which tool we use. |
| 24 | if (_C_COMPILER_NAME MATCHES "^.*armclang(\\.exe)?$") |
| 25 | set(CMAKE_C_COMPILER_ID "ARMCLANG" CACHE INTERNAL "C compiler ID" FORCE) |
| 26 | set(ARM_TOOLCHAIN_FILE "Compiler/ARMClang-C") |
| 27 | elseif (_C_COMPILER_NAME MATCHES "^.*gcc(\\.exe)?$") |
| 28 | set(CMAKE_C_COMPILER_ID "GNU" CACHE INTERNAL "C compiler ID" FORCE) |
| 29 | set(ARM_TOOLCHAIN_FILE "Compiler/GNU-C") |
| 30 | elseif (_C_COMPILER_NAME MATCHES "^.*iccarm(\\.exe)?$") |
| 31 | set(CMAKE_C_COMPILER_ID "IAR" CACHE INTERNAL "C compiler ID" FORCE) |
| 32 | set(ARM_TOOLCHAIN_FILE "Compiler/IAR-C") |
| 33 | else() |
| 34 | message(FATAL_ERROR "C Compiler executable ${_C_COMPILER_NAME} is unknown.\ |
| 35 | Please add needed settings to ${CMAKE_CURRENT_LIST_FILE}") |
| 36 | endif () |
| 37 | |
| 38 | include(${ARM_TOOLCHAIN_FILE}) |