mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 09:09:10 -04:00
fix(linux_target): fixed TEST_COMPONENTS not working on macOS for linux target
Closes https://github.com/espressif/esp-idf/issues/15490
This commit is contained in:
parent
7e00ea43f0
commit
d46b4fbfcf
@ -785,21 +785,6 @@ macro(project project_name)
|
|||||||
target_link_libraries(${project_elf} PRIVATE "-Wl,--start-group")
|
target_link_libraries(${project_elf} PRIVATE "-Wl,--start-group")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(test_components)
|
|
||||||
target_link_libraries(${project_elf} PRIVATE "-Wl,--whole-archive")
|
|
||||||
foreach(test_component ${test_components})
|
|
||||||
if(TARGET ${test_component})
|
|
||||||
target_link_libraries(${project_elf} PRIVATE ${test_component})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
target_link_libraries(${project_elf} PRIVATE "-Wl,--no-whole-archive")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
idf_build_get_property(build_components BUILD_COMPONENT_ALIASES)
|
|
||||||
if(test_components)
|
|
||||||
list(REMOVE_ITEM build_components ${test_components})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CONFIG_IDF_TARGET_LINUX AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
|
if(CONFIG_IDF_TARGET_LINUX AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
# Compiling for the host, and the host is macOS, so the linker is Darwin LD.
|
# Compiling for the host, and the host is macOS, so the linker is Darwin LD.
|
||||||
# Note, when adding support for Clang and LLD based toolchain this check will
|
# Note, when adding support for Clang and LLD based toolchain this check will
|
||||||
@ -809,6 +794,29 @@ macro(project project_name)
|
|||||||
set(linker_type "GNU")
|
set(linker_type "GNU")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(test_components)
|
||||||
|
if(linker_type STREQUAL "GNU")
|
||||||
|
target_link_libraries(${project_elf} PRIVATE "-Wl,--whole-archive")
|
||||||
|
foreach(test_component ${test_components})
|
||||||
|
if(TARGET ${test_component})
|
||||||
|
target_link_libraries(${project_elf} PRIVATE ${test_component})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
target_link_libraries(${project_elf} PRIVATE "-Wl,--no-whole-archive")
|
||||||
|
elseif(linker_type STREQUAL "Darwin")
|
||||||
|
foreach(test_component ${test_components})
|
||||||
|
if(TARGET ${test_component})
|
||||||
|
target_link_libraries(${project_elf} PRIVATE "-Wl,-force_load" ${test_component})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
idf_build_get_property(build_components BUILD_COMPONENT_ALIASES)
|
||||||
|
if(test_components)
|
||||||
|
list(REMOVE_ITEM build_components ${test_components})
|
||||||
|
endif()
|
||||||
|
|
||||||
foreach(build_component ${build_components})
|
foreach(build_component ${build_components})
|
||||||
__component_get_target(build_component_target ${build_component})
|
__component_get_target(build_component_target ${build_component})
|
||||||
__component_get_property(whole_archive ${build_component_target} WHOLE_ARCHIVE)
|
__component_get_property(whole_archive ${build_component_target} WHOLE_ARCHIVE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user