FindLibbfd.cmake 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # - Try to find libbfd
  2. # Once done this will define
  3. #
  4. # LIBBFD_FOUND - system has libbfd
  5. # LIBBFD_INCLUDE_DIRS - the libbfd include directory
  6. # LIBBFD_LIBRARIES - Link these to use libbfd
  7. # LIBBFD_DEFINITIONS - Compiler switches required for using libbfd
  8. #
  9. # Based on:
  10. #
  11. # Copyright (c) 2008 Bernhard Walle <bernhard.walle@gmx.de>
  12. #
  13. # Redistribution and use is allowed according to the terms of the New
  14. # BSD license.
  15. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  16. #
  17. if (LIBBFD_LIBRARIES AND LIBBFD_INCLUDE_DIRS)
  18. set (LIBBFD_FIND_QUIETLY TRUE)
  19. endif ()
  20. find_path (LIBBFD_INCLUDE_DIRS
  21. NAMES
  22. bfd.h
  23. dis-asm.h
  24. PATHS
  25. /usr/include
  26. /usr/local/include
  27. /opt/local/include
  28. /opt/include
  29. ENV CPATH)
  30. # Ugly, yes ugly...
  31. find_library (LIBBFD_BFD_LIBRARY
  32. NAMES
  33. bfd
  34. PATHS
  35. /usr/lib
  36. /usr/lib64
  37. /usr/local/lib
  38. /usr/local/lib64
  39. /usr/include
  40. /opt/local/lib
  41. /opt/usr/lib64
  42. ENV LIBRARY_PATH
  43. ENV LD_LIBRARY_PATH)
  44. #find_library (LIBBFD_IBERTY_LIBRARY
  45. # NAMES
  46. # iberty
  47. # PATHS
  48. # /usr/lib
  49. # /usr/lib64
  50. # /usr/local/lib
  51. # /usr/local/lib64
  52. # /usr/include
  53. # /opt/local/lib
  54. # /opt/usr/lib64
  55. # ENV LIBRARY_PATH
  56. # ENV LD_LIBRARY_PATH)
  57. #find_library (LIBBFD_OPCODES_LIBRARY
  58. # NAMES
  59. # opcodes
  60. # PATHS
  61. # /usr/lib
  62. # /usr/lib64
  63. # /usr/local/lib
  64. # /usr/local/lib64
  65. # /usr/include
  66. # /opt/local/lib
  67. # /opt/usr/lib64
  68. # ENV LIBRARY_PATH
  69. # ENV LD_LIBRARY_PATH)
  70. include (FindPackageHandleStandardArgs)
  71. # handle the QUIETLY and REQUIRED arguments and set LIBBFD_FOUND to TRUE if all listed variables are TRUE
  72. FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBBFD DEFAULT_MSG
  73. LIBBFD_BFD_LIBRARY
  74. # LIBBFD_IBERTY_LIBRARY
  75. # LIBBFD_OPCODES_LIBRARY
  76. LIBBFD_INCLUDE_DIRS)
  77. set(LIBBFD_LIBRARIES "${LIBBFD_BFD_LIBRARY}")
  78. mark_as_advanced(LIBBFD_INCLUDE_DIRS LIBBFD_LIBRARIES LIBBFD_BFD_LIBRARY)