julhal01 | ffa98d8 | 2021-01-20 13:51:58 +0000 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | #[===[.rst: |
| 9 | Add platform provided components to a build |
| 10 | ------------------------------------------- |
| 11 | |
| 12 | #]===] |
| 13 | |
| 14 | |
| 15 | #[===[.rst: |
| 16 | .. cmake:command:: add_platform |
| 17 | |
| 18 | .. code:: cmake |
| 19 | |
| 20 | add_platform(TARGET <target name>) |
| 21 | |
| 22 | INPUTS: |
| 23 | |
| 24 | ``TARGET`` |
| 25 | The name of an already defined target to add platform components to. |
| 26 | |
| 27 | #]===] |
| 28 | function(add_platform) |
| 29 | set(options ) |
| 30 | set(oneValueArgs TARGET) |
| 31 | cmake_parse_arguments(MY_PARAMS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) |
| 32 | |
| 33 | if(NOT DEFINED MY_PARAMS_TARGET) |
| 34 | message(FATAL_ERROR "add_platform: mandatory parameter TARGET not defined!") |
| 35 | endif() |
| 36 | |
| 37 | set(TGT ${MY_PARAMS_TARGET} CACHE STRING "") |
| 38 | |
| 39 | # Ensure file path conforms to lowercase project convention |
| 40 | string(TOLOWER "${TS_PLATFORM_ROOT}/${TS_PLATFORM}/platform.cmake" _platdef) |
| 41 | include(${_platdef}) |
| 42 | set(CMAKE_CONFIGURE_DEPENDS ${_platdef}) |
| 43 | |
| 44 | unset(TGT CACHE) |
| 45 | endfunction() |