Merge branch 'bugfix/link_test_components_to_executable_directly' into 'release/v3.3'

cmake: link test components to executable directly

See merge request espressif/esp-idf!5739
This commit is contained in:
Angus Gratton 2019-08-15 14:59:56 +08:00
commit ebfa74310c

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