File: FindPortMidi.cmake

package info (click to toggle)
darktable 4.2.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 52,960 kB
  • sloc: ansic: 329,632; cpp: 90,717; xml: 18,803; lisp: 12,673; sh: 3,478; javascript: 3,264; perl: 1,888; python: 1,082; ruby: 972; makefile: 536; asm: 46; sql: 38; awk: 21
file content (62 lines) | stat: -rw-r--r-- 1,821 bytes parent folder | download | duplicates (3)
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
#.rst:
# FindPortMidi
# -------
#
# Try to find PortMidi on a Unix system.
#
# This will define the following variables:
#
# ``PortMidi_FOUND``
#     True if PortMidi is available
# ``PortMidi_LIBRARIES``
#     This should be passed to target_compile_options() if the target is not
#     used for linking
# ``PortMidi_INCLUDE_DIRS``
#     This should be passed to target_include_directories() if the target is not
#     used for linking

# SPDX-FileCopyrightText: 2022 Simon Raffeiner <info@simonraffeiner.de>
#
# SPDX-License-Identifier: MIT

find_package(PkgConfig)

set_package_properties(PortMidi PROPERTIES
                       TYPE OPTIONAL
                       URL https://github.com/PortMidi/portmidi
                       DESCRIPTION "Portable MIDI library"
                       PURPOSE "Used for hardware MIDI input devices")

# Use pkg-config to get hints about paths
libfind_pkg_check_modules(PortMidi_PKGCONF portmidi)

find_path(PortMidi_INCLUDE_DIR
    NAMES portmidi.h
    HINTS ${PortMidi_PKGCONF_INCLUDE_DIRS}
        /usr/include/
    DOC "The PortMidi include directory"
)
mark_as_advanced(PortMidi_INCLUDE_DIR)

set(PortMidi_NAMES ${PortMidi_NAMES} portmidi libportmidi)
find_library(PortMidi_LIBRARY
    NAMES ${PortMidi_NAMES}
    HINTS /usr/lib/
          /usr/lib/x86_64-linux-gnu/
    DOC "The Portmidi library"
)
mark_as_advanced(PortMidi_LIBRARY)

# handle the QUIETLY and REQUIRED arguments and set PORTMIDI_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PortMidi
    FOUND_VAR PortMidi_FOUND
    REQUIRED_VARS PortMidi_LIBRARY
                  PortMidi_INCLUDE_DIR
)

IF(PortMidi_FOUND)
  SET(PortMidi_LIBRARIES ${PortMidi_LIBRARY})
  SET(PortMidi_INCLUDE_DIRS ${PortMidi_INCLUDE_DIR})
ENDIF(PortMidi_FOUND)