Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 1 | # |
| 2 | # SPDX-License-Identifier: BSD-3-Clause |
| 3 | # SPDX-FileCopyrightText: Copyright TF-RMM Contributors. |
| 4 | # |
| 5 | |
| 6 | # |
| 7 | # Set up the toolchain logic. This is only necessary if a toolchain file hasn't |
| 8 | # been provided. Otherwise, we force this option to an empty string. |
| 9 | # |
| 10 | |
| 11 | if(DEFINED CACHE{CMAKE_TOOLCHAIN_FILE} AND NOT DEFINED RMM_TOOLCHAIN) |
| 12 | message(WARNING |
| 13 | "The RMM project does not support `CMAKE_TOOLCHAIN_FILE` directly. " |
| 14 | "Please use `RMM_TOOLCHAIN` to configure your desired toolchain.") |
| 15 | |
| 16 | unset(CMAKE_TOOLCHAIN_FILE CACHE) |
| 17 | endif() |
| 18 | |
| 19 | file(GLOB toolchains |
| 20 | RELATIVE "${CMAKE_SOURCE_DIR}/toolchains/${RMM_ARCH}" |
| 21 | "${CMAKE_SOURCE_DIR}/toolchains/${RMM_ARCH}/*.cmake") |
| 22 | string(REPLACE ".cmake" "" toolchains "${toolchains}") |
| 23 | |
| 24 | arm_config_option( |
| 25 | NAME RMM_TOOLCHAIN |
| 26 | HELP "Toolchain name." |
| 27 | STRINGS ${toolchains} |
| 28 | DEFAULT "" |
| 29 | DEPENDS (NOT RMM_TOOLCHAIN IN_LIST toolchains) |
| 30 | ELSE "${RMM_TOOLCHAIN}") |
| 31 | |
| 32 | if(NOT EXISTS CMAKE_TOOLCHAIN_FILE) |
| 33 | set(CMAKE_TOOLCHAIN_FILE |
| 34 | "${CMAKE_SOURCE_DIR}/toolchains/${RMM_ARCH}/${RMM_TOOLCHAIN}.cmake") |
| 35 | endif() |