mirror of
https://github.com/espressif/openthread.git
synced 2026-07-31 16:17:47 +00:00
[cmake] avoid recompiling common sources multiple times (#5623)
This commit is contained in:
+32
-40
@@ -26,18 +26,6 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
set(COMMON_SOURCES
|
||||
test_platform.cpp
|
||||
test_util.cpp
|
||||
)
|
||||
|
||||
set(COMMON_LIBS
|
||||
openthread-ftd
|
||||
ot-config
|
||||
${OT_MBEDTLS}
|
||||
util
|
||||
)
|
||||
|
||||
set(COMMON_INCLUDES
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/src
|
||||
@@ -50,8 +38,36 @@ set(COMMON_COMPILE_OPTIONS
|
||||
-DOPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=1
|
||||
)
|
||||
|
||||
add_library(test-platform
|
||||
test_platform.cpp
|
||||
test_util.cpp
|
||||
)
|
||||
|
||||
target_include_directories(test-platform
|
||||
PRIVATE
|
||||
${COMMON_INCLUDES}
|
||||
)
|
||||
|
||||
target_compile_options(test-platform
|
||||
PRIVATE
|
||||
${COMMON_COMPILE_OPTIONS}
|
||||
)
|
||||
|
||||
target_link_libraries(test-platform
|
||||
PRIVATE
|
||||
ot-config
|
||||
${OT_MBEDTLS}
|
||||
)
|
||||
|
||||
set(COMMON_LIBS
|
||||
test-platform
|
||||
openthread-ftd
|
||||
test-platform
|
||||
${OT_MBEDTLS}
|
||||
ot-config
|
||||
)
|
||||
|
||||
add_executable(test-aes
|
||||
${COMMON_SOURCES}
|
||||
test_aes.cpp
|
||||
)
|
||||
|
||||
@@ -73,12 +89,10 @@ target_link_libraries(test-aes
|
||||
add_test(NAME test-aes COMMAND test-aes)
|
||||
|
||||
add_executable(test-child
|
||||
${COMMON_SOURCES}
|
||||
test_child.cpp
|
||||
)
|
||||
|
||||
add_executable(test-checksum
|
||||
${COMMON_SOURCES}
|
||||
test_checksum.cpp
|
||||
)
|
||||
|
||||
@@ -118,7 +132,6 @@ target_link_libraries(test-child
|
||||
add_test(NAME test-child COMMAND test-child)
|
||||
|
||||
add_executable(test-child-table
|
||||
${COMMON_SOURCES}
|
||||
test_child_table.cpp
|
||||
)
|
||||
|
||||
@@ -140,7 +153,6 @@ target_link_libraries(test-child-table
|
||||
add_test(NAME test-child-table COMMAND test-child-table)
|
||||
|
||||
add_executable(test-cmd-line-parser
|
||||
${COMMON_SOURCES}
|
||||
test_cmd_line_parser.cpp
|
||||
)
|
||||
|
||||
@@ -162,7 +174,6 @@ target_link_libraries(test-cmd-line-parser
|
||||
add_test(NAME test-cmd-line-parser COMMAND test-cmd-line-parser)
|
||||
|
||||
add_executable(test-flash
|
||||
${COMMON_SOURCES}
|
||||
test_flash.cpp
|
||||
)
|
||||
|
||||
@@ -184,7 +195,6 @@ target_link_libraries(test-flash
|
||||
add_test(NAME test-flash COMMAND test-flash)
|
||||
|
||||
add_executable(test-heap
|
||||
${COMMON_SOURCES}
|
||||
test_heap.cpp
|
||||
)
|
||||
|
||||
@@ -206,7 +216,6 @@ target_link_libraries(test-heap
|
||||
add_test(NAME test-heap COMMAND test-heap)
|
||||
|
||||
add_executable(test-hmac-sha256
|
||||
${COMMON_SOURCES}
|
||||
test_hmac_sha256.cpp
|
||||
)
|
||||
|
||||
@@ -228,7 +237,6 @@ target_link_libraries(test-hmac-sha256
|
||||
add_test(NAME test-hmac-sha256 COMMAND test-hmac-sha256)
|
||||
|
||||
add_executable(test-ip6-address
|
||||
${COMMON_SOURCES}
|
||||
test_ip6_address.cpp
|
||||
)
|
||||
|
||||
@@ -250,7 +258,6 @@ target_link_libraries(test-ip6-address
|
||||
add_test(NAME test-ip6-address COMMAND test-ip6-address)
|
||||
|
||||
add_executable(test-link-quality
|
||||
${COMMON_SOURCES}
|
||||
test_link_quality.cpp
|
||||
)
|
||||
|
||||
@@ -272,7 +279,6 @@ target_link_libraries(test-link-quality
|
||||
add_test(NAME test-link-quality COMMAND test-link-quality)
|
||||
|
||||
add_executable(test-linked-list
|
||||
${COMMON_SOURCES}
|
||||
test_linked_list.cpp
|
||||
)
|
||||
|
||||
@@ -294,7 +300,6 @@ target_link_libraries(test-linked-list
|
||||
add_test(NAME test-linked-list COMMAND test-linked-list)
|
||||
|
||||
add_executable(test-lookup-table
|
||||
${COMMON_SOURCES}
|
||||
test_lookup_table.cpp
|
||||
)
|
||||
|
||||
@@ -316,7 +321,6 @@ target_link_libraries(test-lookup-table
|
||||
add_test(NAME test-lookup-table COMMAND test-lookup-table)
|
||||
|
||||
add_executable(test-lowpan
|
||||
${COMMON_SOURCES}
|
||||
test_lowpan.cpp
|
||||
)
|
||||
|
||||
@@ -338,7 +342,6 @@ target_link_libraries(test-lowpan
|
||||
add_test(NAME test-lowpan COMMAND test-lowpan)
|
||||
|
||||
add_executable(test-mac-frame
|
||||
${COMMON_SOURCES}
|
||||
test_mac_frame.cpp
|
||||
)
|
||||
|
||||
@@ -360,7 +363,6 @@ target_link_libraries(test-mac-frame
|
||||
add_test(NAME test-mac-frame COMMAND test-mac-frame)
|
||||
|
||||
add_executable(test-message
|
||||
${COMMON_SOURCES}
|
||||
test_message.cpp
|
||||
)
|
||||
|
||||
@@ -382,7 +384,6 @@ target_link_libraries(test-message
|
||||
add_test(NAME test-message COMMAND test-message)
|
||||
|
||||
add_executable(test-message-queue
|
||||
${COMMON_SOURCES}
|
||||
test_message_queue.cpp
|
||||
)
|
||||
|
||||
@@ -404,7 +405,6 @@ target_link_libraries(test-message-queue
|
||||
add_test(NAME test-message-queue COMMAND test-message-queue)
|
||||
|
||||
add_executable(test-multicast-listeners-table
|
||||
${COMMON_SOURCES}
|
||||
test_multicast_listeners_table.cpp
|
||||
)
|
||||
|
||||
@@ -419,14 +419,13 @@ target_compile_options(test-multicast-listeners-table
|
||||
)
|
||||
|
||||
target_link_libraries(test-multicast-listeners-table
|
||||
PRIVATE
|
||||
PRIVATE
|
||||
${COMMON_LIBS}
|
||||
)
|
||||
)
|
||||
|
||||
add_test(NAME test-multicast-listeners-table COMMAND test-multicast-listeners-table)
|
||||
|
||||
add_executable(test-ndproxy-table
|
||||
${COMMON_SOURCES}
|
||||
test_ndproxy_table.cpp
|
||||
)
|
||||
|
||||
@@ -450,7 +449,6 @@ add_test(NAME test-ndproxy-table COMMAND test-ndproxy-table)
|
||||
|
||||
|
||||
add_executable(test-netif
|
||||
${COMMON_SOURCES}
|
||||
test_netif.cpp
|
||||
)
|
||||
|
||||
@@ -472,7 +470,6 @@ target_link_libraries(test-netif
|
||||
add_test(NAME test-netif COMMAND test-netif)
|
||||
|
||||
add_executable(test-network-data
|
||||
${COMMON_SOURCES}
|
||||
test_network_data.cpp
|
||||
)
|
||||
|
||||
@@ -494,7 +491,6 @@ target_link_libraries(test-network-data
|
||||
add_test(NAME test-network-data COMMAND test-network-data)
|
||||
|
||||
add_executable(test-pool
|
||||
${COMMON_SOURCES}
|
||||
test_pool.cpp
|
||||
)
|
||||
|
||||
@@ -516,7 +512,6 @@ target_link_libraries(test-pool
|
||||
add_test(NAME test-pool COMMAND test-pool)
|
||||
|
||||
add_executable(test-priority-queue
|
||||
${COMMON_SOURCES}
|
||||
test_priority_queue.cpp
|
||||
)
|
||||
|
||||
@@ -538,7 +533,6 @@ target_link_libraries(test-priority-queue
|
||||
add_test(NAME test-priority-queue COMMAND test-priority-queue)
|
||||
|
||||
add_executable(test-pskc
|
||||
${COMMON_SOURCES}
|
||||
test_pskc.cpp
|
||||
)
|
||||
|
||||
@@ -560,7 +554,6 @@ target_link_libraries(test-pskc
|
||||
add_test(NAME test-pskc COMMAND test-pskc)
|
||||
|
||||
add_executable(test-steering-data
|
||||
${COMMON_SOURCES}
|
||||
test_steering_data.cpp
|
||||
)
|
||||
|
||||
@@ -582,7 +575,6 @@ target_link_libraries(test-steering-data
|
||||
add_test(NAME test-steering-data COMMAND test-steering-data)
|
||||
|
||||
add_executable(test-string
|
||||
${COMMON_SOURCES}
|
||||
test_string.cpp
|
||||
)
|
||||
|
||||
@@ -604,7 +596,6 @@ target_link_libraries(test-string
|
||||
add_test(NAME test-string COMMAND test-string)
|
||||
|
||||
add_executable(test-timer
|
||||
${COMMON_SOURCES}
|
||||
test_timer.cpp
|
||||
)
|
||||
|
||||
@@ -626,6 +617,7 @@ target_link_libraries(test-timer
|
||||
add_test(NAME test-timer COMMAND test-timer)
|
||||
|
||||
set_target_properties(
|
||||
test-platform
|
||||
test-aes
|
||||
test-checksum
|
||||
test-child
|
||||
|
||||
Reference in New Issue
Block a user