More reliable detection of libbfd.
This commit is contained in:
parent
a2f1db27db
commit
4126a53406
|
@ -23,59 +23,61 @@
|
||||||
OUTPUT_VARIABLE LD_MESSAGE
|
OUTPUT_VARIABLE LD_MESSAGE
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
string(REGEX REPLACE "GNU ld version ([^ ]+) .*" "\\1" BINUTILS_VERSION ${LD_MESSAGE} )
|
if(RETURN_CODE EQUAL 0)
|
||||||
message("-- Using system specific BFD library: " ${BINUTILS_VERSION})
|
string(REGEX REPLACE "GNU ld version ([^ ]+) .*" "\\1" BINUTILS_VERSION ${LD_MESSAGE} )
|
||||||
|
message("-- Using system specific BFD library: " ${BINUTILS_VERSION})
|
||||||
|
|
||||||
find_path(LIBBFD_INCLUDE_DIRS NAMES bfd.h
|
find_path(LIBBFD_INCLUDE_DIRS NAMES bfd.h
|
||||||
dis-asm.h
|
dis-asm.h
|
||||||
PATHS /usr/include
|
PATHS /usr/include
|
||||||
/usr/local/include
|
/usr/local/include
|
||||||
/opt/local/include
|
/opt/local/include
|
||||||
/opt/include
|
/opt/include
|
||||||
ENV CPATH)
|
ENV CPATH)
|
||||||
|
|
||||||
# Ugly, yes ugly...
|
# Ugly, yes ugly...
|
||||||
find_library(LIBBFD_BFD_LIBRARY NAMES bfd-${BINUTILS_VERSION} bfd
|
find_library(LIBBFD_BFD_LIBRARY NAMES bfd-${BINUTILS_VERSION} bfd
|
||||||
PATHS /usr/lib
|
PATHS /usr/lib
|
||||||
/usr/lib64
|
/usr/lib64
|
||||||
/usr/local/lib
|
/usr/local/lib
|
||||||
/usr/local/lib64
|
/usr/local/lib64
|
||||||
/usr/include
|
/usr/include
|
||||||
/opt/local/lib
|
/opt/local/lib
|
||||||
/opt/usr/lib64
|
/opt/usr/lib64
|
||||||
ENV LIBRARY_PATH
|
ENV LIBRARY_PATH
|
||||||
ENV LD_LIBRARY_PATH)
|
ENV LD_LIBRARY_PATH)
|
||||||
|
|
||||||
#find_library (LIBBFD_IBERTY_LIBRARY NAMES iberty
|
#find_library (LIBBFD_IBERTY_LIBRARY NAMES iberty
|
||||||
# PATHS /usr/lib
|
# PATHS /usr/lib
|
||||||
# /usr/lib64
|
# /usr/lib64
|
||||||
# /usr/local/lib
|
# /usr/local/lib
|
||||||
# /usr/local/lib64
|
# /usr/local/lib64
|
||||||
# /usr/include
|
# /usr/include
|
||||||
# /opt/local/lib
|
# /opt/local/lib
|
||||||
# /opt/usr/lib64
|
# /opt/usr/lib64
|
||||||
# ENV LIBRARY_PATH
|
# ENV LIBRARY_PATH
|
||||||
# ENV LD_LIBRARY_PATH)
|
# ENV LD_LIBRARY_PATH)
|
||||||
|
|
||||||
#find_library (LIBBFD_OPCODES_LIBRARY NAMES opcodes
|
#find_library (LIBBFD_OPCODES_LIBRARY NAMES opcodes
|
||||||
# PATHS /usr/lib
|
# PATHS /usr/lib
|
||||||
# /usr/lib64
|
# /usr/lib64
|
||||||
# /usr/local/lib
|
# /usr/local/lib
|
||||||
# /usr/local/lib64
|
# /usr/local/lib64
|
||||||
# /usr/include
|
# /usr/include
|
||||||
# /opt/local/lib
|
# /opt/local/lib
|
||||||
# /opt/usr/lib64
|
# /opt/usr/lib64
|
||||||
# ENV LIBRARY_PATH
|
# ENV LIBRARY_PATH
|
||||||
# ENV LD_LIBRARY_PATH)
|
# ENV LD_LIBRARY_PATH)
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
find_package_handle_standard_args(LIBBFD DEFAULT_MSG
|
find_package_handle_standard_args(LIBBFD DEFAULT_MSG
|
||||||
LIBBFD_BFD_LIBRARY
|
LIBBFD_BFD_LIBRARY
|
||||||
# LIBBFD_IBERTY_LIBRARY
|
# LIBBFD_IBERTY_LIBRARY
|
||||||
# LIBBFD_OPCODES_LIBRARY
|
# LIBBFD_OPCODES_LIBRARY
|
||||||
LIBBFD_INCLUDE_DIRS)
|
LIBBFD_INCLUDE_DIRS)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(LIBBFD_FOUND)
|
if(LIBBFD_FOUND)
|
||||||
add_definitions(-DHAVE_LIBBFD)
|
add_definitions(-DHAVE_LIBBFD)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -82,6 +82,8 @@
|
||||||
#if (defined __linux__ || defined __FreeBSD__ || defined __APPLE__)
|
#if (defined __linux__ || defined __FreeBSD__ || defined __APPLE__)
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#ifdef HAVE_LIBBFD
|
#ifdef HAVE_LIBBFD
|
||||||
|
#define PACKAGE "Hurricane"
|
||||||
|
#define PACKAGE_VERSION "no_version"
|
||||||
#include <bfd.h>
|
#include <bfd.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue