From 3e199dda215f1da381994289c33cc0063afd1eb2 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Tue, 6 Feb 2024 00:29:02 -0800 Subject: [PATCH] Fix build --- .../drivers/802.15.4_RF/CMakeLists.txt | 42 ++++++++++++++----- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/connectivity/drivers/802.15.4_RF/CMakeLists.txt b/connectivity/drivers/802.15.4_RF/CMakeLists.txt index d18d3c0bb01..7f5529d6a1f 100644 --- a/connectivity/drivers/802.15.4_RF/CMakeLists.txt +++ b/connectivity/drivers/802.15.4_RF/CMakeLists.txt @@ -1,23 +1,43 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -add_library(mbed-802.15.4-rf STATIC EXCLUDE_FROM_ALL) +# The 'mbed-802.15.4-rf' target is lazily created because there might not be any subdirectories needing it at all. +macro(create_802_15_4_target) + if(NOT TARGET create_802_15_4_target) + add_library(mbed-802.15.4-rf STATIC EXCLUDE_FROM_ALL) + + # Nanostack drivers always require Mbed RTOS + target_link_libraries(mbed-802.15.4-rf PUBLIC mbed-core-flags mbed-rtos-flags) + + target_link_libraries(mbed-nanostack + INTERFACE + mbed-802.15.4-rf + ) + endif() +endmacro() -# Nanostack drivers always require Mbed RTOS -target_link_libraries(mbed-802.15.4-rf PUBLIC mbed-core-flags mbed-rtos-flags) if("Freescale" IN_LIST MBED_TARGET_LABELS) + create_802_15_4_target() add_subdirectory(TARGET_Freescale) - add_subdirectory(mcr20a-rf-driver) elseif("Silicon_Labs" IN_LIST MBED_TARGET_LABELS) + create_802_15_4_target() add_subdirectory(TARGET_Silicon_Labs) -elseif("STM" IN_LIST MBED_TARGET_LABELS) - add_subdirectory(stm-s2lp-rf-driver) endif() -add_subdirectory(atmel-rf-driver) +if("COMPONENT_MICROCHIP_AT86RF=1" IN_LIST MBED_TARGET_DEFINITIONS) + create_802_15_4_target() + add_subdirectory(COMPONENT_MICROCHIP_AT86RF) +endif() + +if("COMPONENT_NXP_MCR20A=1" IN_LIST MBED_TARGET_DEFINITIONS) + create_802_15_4_target() + add_subdirectory(COMPONENT_NXP_MCR20A) +endif() + +if("COMPONENT_STM_S2_LP=1" IN_LIST MBED_TARGET_DEFINITIONS) + create_802_15_4_target() + add_subdirectory(COMPONENT_STM_S2_LP) +endif() + -target_link_libraries(mbed-nanostack - INTERFACE - mbed-802.15.4-rf -)