Findmp3lame.cmake 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # - Find lame
  2. # Find the native lame includes and libraries
  3. #
  4. # MP3LAME_INCLUDE_DIRS - where to find lame.h, etc.
  5. # MP3LAME_LIBRARIES - List of libraries when using lame.
  6. # MP3LAME_FOUND - True if Lame found.
  7. if (MP3LAME_INCLUDE_DIR)
  8. # Already in cache, be silent
  9. set(MP3LAME_FIND_QUIETLY TRUE)
  10. endif ()
  11. find_path (MP3LAME_INCLUDE_DIR lame/lame.h
  12. HINTS
  13. ${LAME_ROOT}
  14. )
  15. # MSVC built lame may be named mp3lame_static.
  16. # The provided project files name the library with the lib prefix.
  17. find_library (MP3LAME_LIBRARY
  18. NAMES
  19. mp3lame
  20. mp3lame_static
  21. libmp3lame
  22. libmp3lame_static
  23. libmp3lame-static
  24. HINTS
  25. ${MP3LAME_ROOT}
  26. )
  27. find_library (MP3LAME_HIP_LIBRARY
  28. NAMES
  29. mpghip-static
  30. libmpghip-static
  31. HINTS
  32. ${MP3LAME_ROOT}
  33. )
  34. # Handle the QUIETLY and REQUIRED arguments and set LAME_FOUND
  35. # to TRUE if all listed variables are TRUE.
  36. include(FindPackageHandleStandardArgs)
  37. find_package_handle_standard_args (mp3lame
  38. REQUIRED_VARS
  39. MP3LAME_LIBRARY
  40. MP3LAME_INCLUDE_DIR
  41. )
  42. if (MP3LAME_FOUND)
  43. set (MP3LAME_LIBRARIES ${MP3LAME_LIBRARY} ${MP3LAME_HIP_LIBRARY})
  44. set (MP3LAME_INCLUDE_DIRS ${MP3LAME_INCLUDE_DIR})
  45. if (NOT TARGET mp3lame::mp3lame)
  46. add_library (mp3lame::mp3lame UNKNOWN IMPORTED)
  47. set_target_properties (mp3lame::mp3lame PROPERTIES
  48. INTERFACE_INCLUDE_DIRECTORIES "${MP3LAME_INCLUDE_DIRS}"
  49. IMPORTED_LOCATION "${MP3LAME_LIBRARY}"
  50. )
  51. if (MP3LAME_HIP_LIBRARY AND (NOT TARGET mp3lame::mpghip))
  52. add_library (mp3lame::mpghip STATIC IMPORTED)
  53. set_property (mp3lame::mpghip PROPERTY IMPORTED_LOCATION "${MP3LAME_HIP_LIBRARY}")
  54. set_property (TARGET mp3lame::mp3lame PROPERTY INTERFACE_LINK_LIBRARIES "mp3lame::mpghip")
  55. endif ()
  56. endif ()
  57. endif ()
  58. mark_as_advanced(MP3LAME_INCLUDE_DIR MP3LAME_LIBRARY MP3LAME_HIP_LIBRARY)