2 include (CheckIncludeFile)
3 include (CheckCSourceCompiles)
5 check_include_file (bfd.h HAVE_BFD)
8 find_library (LIBBFD_TMP bfd)
11 message (STATUS "No useable bfd-lib found, disabling support")
13 foreach (CMAKE_REQUIRED_LIBRARIES
14 "" "${LIBBFD_TMP}" "${LIBBFD_TMP};iberty" "${LIBBFD_TMP};dl" "${LIBBFD};iberty;dl" "${LIBBFD_TMP};${LIBINTL}" "${LIBBFD_TMP};iberty;${LIBINTL_TMP}" "${LIBBFD_TMP};iberty;dl;${LIBINBTL}"
16 unset (BFD_COMPILE_TEST CACHE)
17 check_c_source_compiles ("#include <ansidecl.h>
22 const char *dummy = bfd_errmsg(bfd_get_error());
28 set (BFD_LIBRARY ${CMAKE_REQUIRED_LIBRARIES} CACHE STRING "Lib to use when linking to bfd")
29 unset (${CMAKE_REQUIRED_LIBRARIES})
37 message (STATUS "bfd.h found but can't link against it, disabling support")
40 message (STATUS "bfd.h not found, disabling support")
43 unset (LIBBFD_TMP CACHE)