[cmake] allow set extension sources in cmake (#5419)

This commit is contained in:
Jiacheng Guo
2020-08-21 01:11:23 +08:00
committed by GitHub
parent 6886ff1e4c
commit 00d88427d3
2 changed files with 11 additions and 0 deletions
+2
View File
@@ -44,6 +44,8 @@ build_all_features()
"$(dirname "$0")"/cmake-build simulation -DOT_OTNS=ON -DOT_SIMULATION_VIRTUAL_TIME=ON
reset_source
"$(dirname "$0")"/cmake-build simulation -DOT_OTNS=ON -DOT_SIMULATION_VIRTUAL_TIME=ON -DOT_ASSERT=OFF
reset_source
"$(dirname "$0")"/cmake-build simulation -DOT_VENDOR_EXTENSION=../../src/core/common/extension_example.cpp
}
build_toranj()
+9
View File
@@ -217,6 +217,11 @@ target_include_directories(openthread-ftd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE $
target_include_directories(openthread-mtd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_include_directories(openthread-radio PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
set(OT_VENDOR_EXTENSION "" CACHE STRING "specify a C++ source file built as part of OpenThread core library")
if(OT_VENDOR_EXTENSION)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_ENABLE_VENDOR_EXTENSION=1")
list(APPEND COMMON_SOURCES ${OT_VENDOR_EXTENSION})
endif()
target_sources(openthread-ftd PRIVATE ${COMMON_SOURCES})
target_sources(openthread-mtd PRIVATE ${COMMON_SOURCES})
@@ -248,6 +253,10 @@ target_sources(openthread-radio PRIVATE
utils/parse_cmdline.cpp
)
if(OT_VENDOR_EXTENSION)
target_sources(openthread-radio PRIVATE ${OT_VENDOR_EXTENSION})
endif()
target_link_libraries(openthread-ftd
PRIVATE
${OT_MBEDTLS}