From c7c2580f9e96ab2e0182721dad567bd80d4a9bdc Mon Sep 17 00:00:00 2001 From: Robert Walton Date: Wed, 14 Apr 2021 11:01:05 +0100 Subject: [PATCH] CMake: Fix mbed-802.15.4-rf driver mbed-nanostack should depend on mbed-802.15.4-rf to avoid a linker error with an undefined reference to `NanostackRfPhy::get_default_instance()`. The error occurs when `device_has: 802_15_4_PHY` is defined and the consumer depends on mbed-nanostack in their CMakeLists.txt. Previously we linked mbed-nanostack to mbed-802.15.4-rf, so mbed-802.15.4-rf's usage requirements weren't forwarded to consumers who depended on mbed-nanostack. With the previous configuration, the consumer would have to depend on mbed-802.15.4-rf directly to avoid an issue. This seems like a layering violation: it appears that mbed-nanostack is "the API" and mbed-802.15.4-rf is one of several possible implementations which are selected based on configuration macros. This commit changes the flow of dependencies so that mbed-nanostack ends up with the correct symbol definitions. --- connectivity/drivers/802.15.4_RF/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/connectivity/drivers/802.15.4_RF/CMakeLists.txt b/connectivity/drivers/802.15.4_RF/CMakeLists.txt index ecce6c4d71..89dc412001 100644 --- a/connectivity/drivers/802.15.4_RF/CMakeLists.txt +++ b/connectivity/drivers/802.15.4_RF/CMakeLists.txt @@ -12,7 +12,7 @@ endif() add_subdirectory(atmel-rf-driver) -target_link_libraries(mbed-802.15.4-rf +target_link_libraries(mbed-nanostack INTERFACE - mbed-nanostack + mbed-802.15.4-rf )