From dbd05d8986526a3044ea359dd06e5e87ef43a8e5 Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Fri, 9 Aug 2019 15:18:06 +0800 Subject: [PATCH] cmake: link test components to executable directly --- tools/cmake/components.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/cmake/components.cmake b/tools/cmake/components.cmake index 4abc5990a..2a3ca960a 100644 --- a/tools/cmake/components.cmake +++ b/tools/cmake/components.cmake @@ -108,8 +108,11 @@ function(register_component) endforeach() if(${COMPONENT_NAME} IN_LIST BUILD_TEST_COMPONENTS) - target_link_libraries(${COMPONENT_TARGET} "-L${CMAKE_CURRENT_BINARY_DIR}") - target_link_libraries(${COMPONENT_TARGET} "-Wl,--whole-archive -l${COMPONENT_NAME} -Wl,--no-whole-archive") + set_property(TARGET ${IDF_PROJECT_EXECUTABLE} APPEND PROPERTY + LINK_LIBRARIES "-L${CMAKE_CURRENT_BINARY_DIR}") + + set_property(TARGET ${IDF_PROJECT_EXECUTABLE} APPEND PROPERTY + LINK_LIBRARIES "-Wl,--whole-archive -l${COMPONENT_NAME} -Wl,--no-whole-archive") endif() if(COMPONENT_SRCS OR embed_binaries)