-
Notifications
You must be signed in to change notification settings - Fork 265
/
Copy pathFindmp3lame.cmake
63 lines (49 loc) · 1.86 KB
/
Findmp3lame.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#[=======================================================================[.rst:
Findmp3lame
-------
Finds the mp3lame library.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``mp3lame::mp3lame``
The mp3lame library.
``mp3lame::mpghip``
The mpghip library.
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``mp3lame_FOUND``
True if the mp3lame library was found.
``mp3lame_mpghip_FOUND``
True if the mpghip library was found.
#]=======================================================================]
# Find the headers and libraries
find_path(mp3lame_INCLUDE_DIR NAMES "lame/lame.h")
find_library(mp3lame_mp3lame_LIBRARY NAMES "mp3lame" "libmp3lame"
"libmp3lame-static")
find_library(mp3lame_mpghip_LIBRARY NAMES "mpghip" "libmpghip"
"libmpghip-static")
# Forward the result to CMake
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
mp3lame REQUIRED_VARS "mp3lame_mp3lame_LIBRARY"
"mp3lame_INCLUDE_DIR")
# Create the targets
if(mp3lame_FOUND AND NOT TARGET mp3lame::mp3lame)
add_library(mp3lame::mp3lame UNKNOWN IMPORTED)
set_target_properties(
mp3lame::mp3lame
PROPERTIES IMPORTED_LOCATION "${mp3lame_mp3lame_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${mp3lame_INCLUDE_DIR}")
set(mp3lame_mp3lame_FOUND TRUE)
endif()
if(mp3lame_mpghip_LIBRARY AND NOT TARGET mp3lame::mpghip)
add_library(mp3lame::mpghip UNKNOWN IMPORTED)
set_target_properties(
mp3lame::mpghip
PROPERTIES IMPORTED_LOCATION "${mp3lame_mpghip_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${mp3lame_INCLUDE_DIR}")
set(mp3lame_mpghip_FOUND)
endif()
mark_as_advanced(mp3lame_INCLUDE_DIR mp3lame_mp3lame_LIBRARY
mp3lame_mpghip_LIBRARY)