summaryrefslogtreecommitdiffstats
path: root/cmake/modules/Findmp3lame.cmake
blob: e7afe497742c7324990250065fc744befaeb815d (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
# This file is part of Mixxx, Digital DJ'ing software.
# Copyright (C) 2001-2020 Mixxx Development Team
# Distributed under the GNU General Public Licence (GPL) version 2 or any later
# later version. See the LICENSE file for details.

#[=======================================================================[.rst:
Findmp3lame
-----------

Finds the LAME library.

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if found:

``mp3lame::mp3lame``
  The LAME library

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

``mp3lame_FOUND``
  True if the system has the LAME library.
``mp3lame_INCLUDE_DIRS``
  Include directories needed to use LAME.
``mp3lame_LIBRARIES``
  Libraries needed to link to LAME.

Cache Variables
^^^^^^^^^^^^^^^

The following cache variables may also be set:

``mp3lame_INCLUDE_DIR``
  The directory containing ``lame/lame.h``.
``mp3lame_LIBRARY``
  The path to the LAME library.

#]=======================================================================]

find_path(mp3lame_INCLUDE_DIR
  NAMES lame/lame.h
  DOC "LAME include directory")
mark_as_advanced(mp3lame_INCLUDE_DIR)

find_library(mp3lame_LIBRARY
  NAMES mp3lame mp3lame-static
  DOC "LAME library"
)
mark_as_advanced(mp3lame_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
  mp3lame
  DEFAULT_MSG
  mp3lame_LIBRARY
  mp3lame_INCLUDE_DIR
)

if(mp3lame_FOUND)
  set(mp3lame_LIBRARIES "${mp3lame_LIBRARY}")
  set(mp3lame_INCLUDE_DIRS "${mp3lame_INCLUDE_DIR}")

  if(NOT TARGET mp3lame::mp3lame)
    add_library(mp3lame::mp3lame UNKNOWN IMPORTED)
    set_target_properties(mp3lame::mp3lame
      PROPERTIES
        IMPORTED_LOCATION "${mp3lame_LIBRARY}"
        INTERFACE_INCLUDE_DIRECTORIES "${mp3lame_INCLUDE_DIR}"
    )
  endif()
endif()