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.
28 lines
463 B
CMake
28 lines
463 B
CMake
cmake_minimum_required(VERSION 3.0)
|
|
project(lg_common_platform_code LANGUAGES C)
|
|
|
|
include_directories(
|
|
${PROJECT_SOURCE_DIR}/include
|
|
${PROJECT_TOP}
|
|
)
|
|
|
|
add_library(lg_common_platform_code STATIC
|
|
crash.c
|
|
sysinfo.c
|
|
thread.c
|
|
event.c
|
|
ivshmem.c
|
|
time.c
|
|
)
|
|
|
|
if(ENABLE_BACKTRACE)
|
|
find_package(BFD)
|
|
target_link_libraries(lg_common_platform_code ${BFD_LIBRARIES})
|
|
endif()
|
|
|
|
target_link_libraries(lg_common_platform_code
|
|
lg_common
|
|
pthread
|
|
rt
|
|
)
|