summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindPortMidi.cmake
blob: 564af026323ed54cf09776f302a9ac967ff49b27 (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
76
77
78
79
80
81
# This file is part of Mixxx, Digital DJ'ing software.
# Copyright (C) 2001-2023 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:
FindPortMidi
---------------

Finds the PortMidi library.

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

This will define the following variables:

``PortMidi_FOUND``
  True if the system has the PortMidi library.
``PortMidi_INCLUDE_DIRS``
  Include directories needed to use PortMidi.
``PortMidi_LIBRARIES``
  Libraries needed to link to PortMidi.

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

The following cache variables may also be set:

``PortMidi_INCLUDE_DIR``
  The directory containing ``portmidi.h``.
``PortTime_INCLUDE_DIR``
  The directory containing ``porttime.h``.
``PortMidi_LIBRARY``
  The path to the PortMidi library.
``PortTime_LIBRARY``
  The path to the PortTime library.

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

find_path(PortMidi_INCLUDE_DIR
  NAMES portmidi.h
  PATH_SUFFIXES portmidi
  DOC "PortMidi include directory")
mark_as_advanced(PortMidi_INCLUDE_DIR)

find_path(PortTime_INCLUDE_DIR
  NAMES porttime.h
  PATH_SUFFIXES portmidi porttime
  DOC "PortTime include directory")
mark_as_advanced(PortTime_INCLUDE_DIR)

find_library(PortMidi_LIBRARY
  NAMES portmidi portmidi_s
  DOC "PortMidi library"
)
mark_as_advanced(PortMidi_LIBRARY)

find_library(PortTime_LIBRARY
  NAMES porttime
  DOC "PortTime library"
)
mark_as_advanced(PortTime_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
  PortMidi
  DEFAULT_MSG
  PortMidi_LIBRARY
  PortMidi_INCLUDE_DIR
  PortTime_INCLUDE_DIR
)

if(PortMidi_FOUND)
  set(PortMidi_LIBRARIES ${PortMidi_LIBRARY})
  # Depending on the library configuration PortTime might be statically
  # linked with PortMidi.
  if(PortTime_LIBRARY)
    list(APPEND PortMidi_LIBRARIES ${PortTime_LIBRARY})
  endif()
  set(PortMidi_INCLUDE_DIRS ${PortMidi_INCLUDE_DIR} ${PortTime_INCLUDE_DIR})
endif()