find_library(liberty) will also take care of the demangle header

so, CHECK_INCLUDE_FILES_ERROR(libiberty/demangle.h) is not needed and
actually fails to find the header if the header is in some non-standard
location. (e.g if it comes from a conan package)
This commit is contained in:
Tobias Frost 2022-06-13 10:49:36 +02:00
parent 811a3b75e2
commit ce552acad2

View File

@ -125,9 +125,15 @@ if (NOT DISABLE_CLIENT)
message(FATAL_ERROR "libbfd not found.") message(FATAL_ERROR "libbfd not found.")
endif() endif()
find_library(LIB_IBERTY iberty)
if(NOT LIB_IBERTY)
message(FATAL_ERROR "liberty not found.")
endif()
pkg_check_modules(LIB_ZLIB REQUIRED zlib)
CHECK_INCLUDE_FILES_ERROR("termcap.h" HAVE_TERMCAP_H) CHECK_INCLUDE_FILES_ERROR("termcap.h" HAVE_TERMCAP_H)
CHECK_INCLUDE_FILES_ERROR("libiberty/demangle.h" HAVE_DEMANGLE_H)
endif() endif()
check_function_exists(process_vm_readv HAVE_PROCESS_VM_READV) check_function_exists(process_vm_readv HAVE_PROCESS_VM_READV)
@ -147,7 +153,7 @@ add_executable(${MT} ${C_SRCS})
target_link_libraries(${MT} ${LIB_ELF_LIBRARIES} ${LIB_PTHREAD} ${LIB_DL} ${LIB_RT} ${LIB_READLINE}) target_link_libraries(${MT} ${LIB_ELF_LIBRARIES} ${LIB_PTHREAD} ${LIB_DL} ${LIB_RT} ${LIB_READLINE})
if(LIB_BFD) if(LIB_BFD)
target_compile_options(${MT} PRIVATE -DPACKAGE) target_compile_options(${MT} PRIVATE -DPACKAGE)
target_link_libraries(${MT} ${LIB_BFD}) target_link_libraries(${MT} ${LIB_BFD} ${LIB_ZLIB_LIBRARIES} ${LIB_IBERTY})
endif() endif()
target_compile_options(${MT} PUBLIC ${LIB_ELF_CFLAGS_OTHER}) target_compile_options(${MT} PUBLIC ${LIB_ELF_CFLAGS_OTHER})