mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
cmake: fix the linker type check for --whole-archive option
Checking that the host is macOS is not sufficient here, since the linker is still a GNU linker when cross-compiling for a chip. Instead, use the linker_type variable introduced in the previous commit.
This commit is contained in:
parent
b47155a70b
commit
7a298f98ae
@ -525,17 +525,17 @@ macro(project project_name)
|
|||||||
__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)
|
||||||
if(whole_archive)
|
if(whole_archive)
|
||||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
|
if(linker_type STREQUAL "GNU")
|
||||||
message(STATUS "Component ${build_component} will be linked with -Wl,-force_load")
|
|
||||||
target_link_libraries(${project_elf} PRIVATE
|
|
||||||
"-Wl,-force_load"
|
|
||||||
${build_component})
|
|
||||||
else()
|
|
||||||
message(STATUS "Component ${build_component} will be linked with -Wl,--whole-archive")
|
message(STATUS "Component ${build_component} will be linked with -Wl,--whole-archive")
|
||||||
target_link_libraries(${project_elf} PRIVATE
|
target_link_libraries(${project_elf} PRIVATE
|
||||||
"-Wl,--whole-archive"
|
"-Wl,--whole-archive"
|
||||||
${build_component}
|
${build_component}
|
||||||
"-Wl,--no-whole-archive")
|
"-Wl,--no-whole-archive")
|
||||||
|
elseif(linker_type STREQUAL "Darwin")
|
||||||
|
message(STATUS "Component ${build_component} will be linked with -Wl,-force_load")
|
||||||
|
target_link_libraries(${project_elf} PRIVATE
|
||||||
|
"-Wl,-force_load"
|
||||||
|
${build_component})
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
target_link_libraries(${project_elf} PRIVATE ${build_component})
|
target_link_libraries(${project_elf} PRIVATE ${build_component})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user