blob: 9deefd5573c4b2bd6ccd81272b96efea21881ae0 [file] [log] [blame]
David Hu7042a262023-10-14 23:47:29 +08001#-------------------------------------------------------------------------------
2# Copyright (c) 2023, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8# Select toolchain file if it is not specified via command line or the absolutate path
9# is unavailable.
10
11if (NOT DEFINED TFM_TOOLCHAIN_FILE)
12 set(TFM_TOOLCHAIN_FILE ${CONFIG_SPE_PATH}/cmake/toolchain_ns_GNUARM.cmake)
13endif()
14
15if(NOT IS_ABSOLUTE ${TFM_TOOLCHAIN_FILE})
16 get_filename_component(RELATIVE_DIR ${TFM_TOOLCHAIN_FILE} DIRECTORY)
17 if("${RELATIVE_DIR}" STREQUAL "")
18 # Assume the toolchain is put in ${CONFIG_SPE_PATH}/cmake
19 set(TFM_TOOLCHAIN_FILE "${CONFIG_SPE_PATH}/cmake/${TFM_TOOLCHAIN_FILE}")
20 else()
21 # Assume the relative path is based on ${CONFIG_SPE_PATH}
22 set(TFM_TOOLCHAIN_FILE "${CONFIG_SPE_PATH}/${TFM_TOOLCHAIN_FILE}")
23 endif()
24endif()
25
26if(NOT EXISTS ${TFM_TOOLCHAIN_FILE})
27 message(FATAL_ERROR "TFM_TOOLCHAIN_FILE ${TFM_TOOLCHAIN_FILE} doesn't exist")
28endif()