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()