Debian Codegraph @

cmake/Findmp3lame.cmake

raw
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
8 if (MP3LAME_INCLUDE_DIR)
9 # Already in cache, be silent
10 set(MP3LAME_FIND_QUIETLY TRUE)
11 endif ()
12
13 find_path (MP3LAME_INCLUDE_DIR lame/lame.h
14 HINTS
15 ${LAME_ROOT}
16 )
17
18 # MSVC built lame may be named mp3lame_static.
19 # The provided project files name the library with the lib prefix.
20
21 find_library (MP3LAME_LIBRARY
22 NAMES
23 mp3lame
24 mp3lame_static
25 libmp3lame
26 libmp3lame_static
27 libmp3lame-static
28 HINTS
29 ${MP3LAME_ROOT}
30 )
31
32 find_library (MP3LAME_HIP_LIBRARY
33 NAMES
34 mpghip-static
35 libmpghip-static
36 HINTS
37 ${MP3LAME_ROOT}
38 )
39
40 # Handle the QUIETLY and REQUIRED arguments and set LAME_FOUND
41 # to TRUE if all listed variables are TRUE.
42 include(FindPackageHandleStandardArgs)
43 find_package_handle_standard_args (mp3lame
44 REQUIRED_VARS
45 MP3LAME_LIBRARY
46 MP3LAME_INCLUDE_DIR
47 )
48
49 if (MP3LAME_FOUND)
50 set (MP3LAME_LIBRARIES ${MP3LAME_LIBRARY} ${MP3LAME_HIP_LIBRARY})
51 set (MP3LAME_INCLUDE_DIRS ${MP3LAME_INCLUDE_DIR})
52
53 if (NOT TARGET mp3lame::mp3lame)
54 add_library (mp3lame::mp3lame UNKNOWN IMPORTED)
55 set_target_properties (mp3lame::mp3lame PROPERTIES
56 INTERFACE_INCLUDE_DIRECTORIES "${MP3LAME_INCLUDE_DIRS}"
57 IMPORTED_LOCATION "${MP3LAME_LIBRARY}"
58 )
59 if (MP3LAME_HIP_LIBRARY AND (NOT TARGET mp3lame::mpghip))
60 add_library (mp3lame::mpghip STATIC IMPORTED)
61 set_property (mp3lame::mpghip PROPERTY IMPORTED_LOCATION "${MP3LAME_HIP_LIBRARY}")
62 set_property (TARGET mp3lame::mp3lame PROPERTY INTERFACE_LINK_LIBRARIES "mp3lame::mpghip")
63 endif ()
64 endif ()
65 endif ()
66
67 mark_as_advanced(MP3LAME_INCLUDE_DIR MP3LAME_LIBRARY MP3LAME_HIP_LIBRARY)