diff --git a/CMakeLists.txt b/CMakeLists.txt index 04857d2c..9faa9576 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,17 +136,16 @@ if (NOT LIBIBERTY) message(FATAL_ERROR "error: couldn't find libiberty") endif() -# libdwarf-devel provides /usr/lib64/libdwarf.so find_library(LIBDWARF dwarf) -# elfutils-devel provides /usr/include/dwarf.h -find_library(LIBEBL ebl) - -if ((NOT LIBDWARF) OR (NOT LIBEBL)) +if (NOT LIBDWARF) message("WARNING: libdwarf will be compiled locally") - set(LIBDWARF LIBDWARF-NOTFOUND) - set(LIBEBL LIBEBL-NOTFOUND) enable_language(CXX) +else() + # Note that libdwarf-devel provides /usr/include/libdwarf/dwarf.h + # but elfutils-devel provides /usr/include/dwarf.h + # while mcinspect.c performs "#include " + find_path(DWARF_H dwarf.h PATH_SUFFIXES libdwarf) endif() if (ENABLE_QLMPI) diff --git a/executer/user/CMakeLists.txt b/executer/user/CMakeLists.txt index 2abe4bfd..42edafed 100644 --- a/executer/user/CMakeLists.txt +++ b/executer/user/CMakeLists.txt @@ -27,6 +27,7 @@ if (NOT LIBDWARF) "${CMAKE_CURRENT_SOURCE_DIR}/lib/libdwarf/libdwarf/libdwarf/") target_link_libraries(mcinspect dwarf z elf) else() + target_include_directories(mcinspect PRIVATE ${DWARF_H}) target_link_libraries(mcinspect ${LIBDWARF}) endif() target_link_libraries(mcinspect ${LIBBFD})