From ce552acad21cd8df853690cda0cc4565a80aecb3 Mon Sep 17 00:00:00 2001 From: Tobias Frost Date: Mon, 13 Jun 2022 10:49:36 +0200 Subject: [PATCH] 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) --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9ef038..c03d962 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,9 +125,15 @@ if (NOT DISABLE_CLIENT) message(FATAL_ERROR "libbfd not found.") 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("libiberty/demangle.h" HAVE_DEMANGLE_H) endif() 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}) if(LIB_BFD) target_compile_options(${MT} PRIVATE -DPACKAGE) - target_link_libraries(${MT} ${LIB_BFD}) + target_link_libraries(${MT} ${LIB_BFD} ${LIB_ZLIB_LIBRARIES} ${LIB_IBERTY}) endif() target_compile_options(${MT} PUBLIC ${LIB_ELF_CFLAGS_OTHER})