From c00c9afa456312f15fe782cc595eb914cdebee5b Mon Sep 17 00:00:00 2001 From: Sam Kumar Date: Mon, 16 Aug 2021 18:28:11 -0700 Subject: [PATCH] [tcp] link third_party TCPlp module in CMake build (#6925) This commit changes the Makefiles so that the TCPlp module is linked in to the code when building OpenThread using CMake. This is necessary when script/build or script/cmake-build is used to build OpenThread. --- src/core/ftd.cmake | 1 + src/core/mtd.cmake | 1 + third_party/tcplp/CMakeLists.txt | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/src/core/ftd.cmake b/src/core/ftd.cmake index 179f82641..e0c692bcf 100644 --- a/src/core/ftd.cmake +++ b/src/core/ftd.cmake @@ -43,5 +43,6 @@ target_sources(openthread-ftd PRIVATE ${COMMON_SOURCES}) target_link_libraries(openthread-ftd PRIVATE ${OT_MBEDTLS} + tcplp ot-config ) diff --git a/src/core/mtd.cmake b/src/core/mtd.cmake index b8f2533ca..7526f1870 100644 --- a/src/core/mtd.cmake +++ b/src/core/mtd.cmake @@ -43,5 +43,6 @@ target_sources(openthread-mtd PRIVATE ${COMMON_SOURCES}) target_link_libraries(openthread-mtd PRIVATE ${OT_MBEDTLS} + tcplp ot-config ) diff --git a/third_party/tcplp/CMakeLists.txt b/third_party/tcplp/CMakeLists.txt index ad34b1184..eafe93aa1 100644 --- a/third_party/tcplp/CMakeLists.txt +++ b/third_party/tcplp/CMakeLists.txt @@ -44,3 +44,21 @@ target_include_directories(${tcplp_static_target} ${OT_PUBLIC_INCLUDES} $ ) + +# TCPlp calls functions that are defined by the core OpenThread (like +# "otMessageWrite()"), so we need to add the core library (FTD or MTD, as +# appropriate) as a link dependency. + +if(OT_FTD) + target_link_libraries(${tcplp_static_target} + PRIVATE + openthread-ftd + ) +endif() + +if(OT_MTD) + target_link_libraries(${tcplp_static_target} + PRIVATE + openthread-mtd + ) +endif()