]> granicus.if.org Git - esp-idf/commitdiff
cmake: link test components to executable directly
authorRenz Christian Bagaporo <renz@espressif.com>
Fri, 9 Aug 2019 07:18:06 +0000 (15:18 +0800)
committerRenz Christian Bagaporo <renz@espressif.com>
Fri, 9 Aug 2019 07:18:06 +0000 (15:18 +0800)
tools/cmake/components.cmake

index 4abc5990a6db89718e3aae9400d3690307f10efb..2a3ca960a7261e2dfb986fd916ef86290eed1597 100644 (file)
@@ -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)