[common] cmake: correctly link static libbfd.a

When linking against libbfd.so, just passing libbfd.so to the compiler is
sufficient. When linking against the static version libbfd.a, however,
we must additionally link against libiberty.a and libz.a.

This commit adds a CMake helper to find the correct libraries that need
to be passed to link against libbfd correctly.
This commit is contained in:
Quantum authored and Geoffrey McRae committed 2021-03-03 16:37:34 +11:00
1 parent b00c25a822
commit fc7dd7dbb7
4 files changed
+45 -2

No files matched your search

+2 -1
View File
@@ -16,7 +16,8 @@ add_library(lg_common_platform_code STATIC
)
if(ENABLE_BACKTRACE)
target_link_libraries(lg_common_platform_code bfd)
find_package(BFD)
target_link_libraries(lg_common_platform_code ${BFD_LIBRARIES})
endif()
target_link_libraries(lg_common_platform_code