File: FindShairplay.cmake

package info (click to toggle)
kodi 2%3A20.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 143,820 kB
  • sloc: cpp: 664,925; xml: 68,398; ansic: 37,223; python: 6,903; sh: 4,209; javascript: 2,325; makefile: 1,754; perl: 969; java: 513; cs: 390; objc: 340
file content (57 lines) | stat: -rw-r--r-- 2,063 bytes parent folder | download | duplicates (2)
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
#.rst:
# FindShairplay
# -------------
# Finds the Shairplay library
#
# This will define the following variables::
#
# SHAIRPLAY_FOUND - system has Shairplay
# SHAIRPLAY_INCLUDE_DIRS - the Shairplay include directory
# SHAIRPLAY_LIBRARIES - the Shairplay libraries
# SHAIRPLAY_DEFINITIONS - the Shairplay compile definitions
#
# and the following imported targets::
#
#   Shairplay::Shairplay   - The Shairplay library

find_path(SHAIRPLAY_INCLUDE_DIR shairplay/raop.h)

include(FindPackageHandleStandardArgs)
find_library(SHAIRPLAY_LIBRARY NAMES shairplay libshairplay)

if(SHAIRPLAY_INCLUDE_DIR AND SHAIRPLAY_LIBRARY)
  include(CheckCSourceCompiles)
  set(CMAKE_REQUIRED_INCLUDES ${SHAIRPLAY_INCLUDE_DIR})
  set(CMAKE_REQUIRED_LIBRARIES ${SHAIRPLAY_LIBRARIES})
  check_c_source_compiles("#include <shairplay/raop.h>

                           int main()
                           {
                             struct raop_callbacks_s foo;
                             foo.cls;
                             return 0;
                           }
                          " HAVE_SHAIRPLAY_CALLBACK_CLS)
endif()

find_package_handle_standard_args(Shairplay
                                  REQUIRED_VARS SHAIRPLAY_LIBRARY SHAIRPLAY_INCLUDE_DIR HAVE_SHAIRPLAY_CALLBACK_CLS)

if(SHAIRPLAY_FOUND)
  set(SHAIRPLAY_LIBRARIES ${SHAIRPLAY_LIBRARY})
  set(SHAIRPLAY_INCLUDE_DIRS ${SHAIRPLAY_INCLUDE_DIR})
  set(SHAIRPLAY_DEFINITIONS -DHAS_AIRTUNES=1)

  if(NOT TARGET Shairplay::Shairplay)
    add_library(Shairplay::Shairplay UNKNOWN IMPORTED)
    if(SHAIRPLAY_LIBRARY)
      set_target_properties(Shairplay::Shairplay PROPERTIES
                                                 IMPORTED_LOCATION "${SHAIRPLAY_LIBRARY}")
    endif()
    set_target_properties(Shairplay::Shairplay PROPERTIES
                                               INTERFACE_INCLUDE_DIRECTORIES "${SHAIRPLAY_INCLUDE_DIR}"
                                               INTERFACE_COMPILE_DEFINITIONS HAS_AIRTUNES=1)
  endif()
endif()

mark_as_advanced(SHAIRPLAY_INCLUDE_DIR SHAIRPLAY_LIBRARY)