Update translations
[amule.git] / cmake / bfd.cmake
blob7889d2030ae4a5e62d0f2935618c8c609d59a2d4
1 if (NOT HAVE_BFD)
2         include (CheckIncludeFile)
3         include (CheckCSourceCompiles)
5         check_include_file (bfd.h HAVE_BFD)
7         if (HAVE_BFD)
8                 find_library (LIBBFD_TMP bfd)
10                 if (NOT LIBBFD_TMP)
11                         message (STATUS "No useable bfd-lib found, disabling support")
12                 else()
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}"
15                         )
16                                 unset (BFD_COMPILE_TEST CACHE)
17                                 check_c_source_compiles ("#include <ansidecl.h>
18                                         #include <bfd.h>
20                                         int main()
21                                         {
22                                                 const char *dummy = bfd_errmsg(bfd_get_error());
23                                         }"
24                                         BFD_COMPILE_TEST
25                                 )
27                                 if (BFD_COMPILE_TEST)
28                                         set (BFD_LIBRARY ${CMAKE_REQUIRED_LIBRARIES} CACHE STRING "Lib to use when linking to bfd")
29                                         unset (${CMAKE_REQUIRED_LIBRARIES})
30                                         break()
31                                 endif() 
32                         endforeach()
33                 endif()
35                 if (NOT BFD_LIBRARY)
36                         set (HAVE_BFD FALSE)
37                         message (STATUS "bfd.h found but can't link against it, disabling support")
38                 endif()
39         else()
40                 message (STATUS "bfd.h not found, disabling support")
41         endif()
43         unset (LIBBFD_TMP CACHE)
44 endif (NOT HAVE_BFD)