File: AllegroFindOSS.cmake

package info (click to toggle)
allegro4.4 2:4.4.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 20,744 kB
  • sloc: ansic: 164,458; asm: 17,620; cpp: 3,848; objc: 1,687; sh: 1,107; python: 676; pascal: 179; makefile: 55; perl: 29; lisp: 1
file content (73 lines) | stat: -rw-r--r-- 2,263 bytes parent folder | download | duplicates (6)
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
# - Find Open Sound System
#
#  OSS_FOUND       - True if OSS headers found.

# This file is Allegro-specific and requires the following variables to be
# set elsewhere:
#   ALLEGRO_HAVE_MACHINE_SOUNDCARD_H
#   ALLEGRO_HAVE_LINUX_SOUNDCARD_H
#   ALLEGRO_HAVE_SYS_SOUNDCARD_H
#   ALLEGRO_HAVE_SOUNDCARD_H


if(OSS_INCLUDE_DIR)
    # Already in cache, be silent
    set(OSS_FIND_QUIETLY TRUE)
endif(OSS_INCLUDE_DIR)

set(CMAKE_REQUIRED_DEFINITIONS)

if(ALLEGRO_HAVE_SOUNDCARD_H OR ALLEGRO_HAVE_SYS_SOUNDCARD_H OR
        ALLEGRO_HAVE_MACHINE_SOUNDCARD_H OR ALLEGRO_LINUX_SYS_SOUNDCARD_H)

    if(ALLEGRO_HAVE_MACHINE_SOUNDCARD_H)
        set(CMAKE_REQUIRED_DEFINITIONS -DALLEGRO_HAVE_MACHINE_SOUNDCARD_H)
    endif(ALLEGRO_HAVE_MACHINE_SOUNDCARD_H)

    if(ALLEGRO_HAVE_LINUX_SOUNDCARD_H)
        set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
            -DALLEGRO_HAVE_LINUX_SOUNDCARD_H)
    endif(ALLEGRO_HAVE_LINUX_SOUNDCARD_H)

    if(ALLEGRO_HAVE_SYS_SOUNDCARD_H)
        set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
            -DALLEGRO_HAVE_SYS_SOUNDCARD_H)
    endif(ALLEGRO_HAVE_SYS_SOUNDCARD_H)

    if(ALLEGRO_HAVE_SOUNDCARD_H)
        set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
            -DALLEGRO_HAVE_SOUNDCARD_H)
    endif(ALLEGRO_HAVE_SOUNDCARD_H)

    check_c_source_compiles("
        #ifdef ALLEGRO_HAVE_SOUNDCARD_H
        #include <soundcard.h>
        #endif
        #ifdef ALLEGRO_HAVE_SYS_SOUNDCARD_H
        #include <sys/soundcard.h>
        #endif
        #ifdef ALLEGRO_HAVE_LINUX_SOUNDCARD_H
        #include <linux/soundcard.h>
        #endif
        #ifdef ALLEGRO_HAVE_MACHINE_SOUNDCARD_H
        #include <machine/soundcard.h>
        #endif
        int main(void) {
            audio_buf_info abi;
            return 0;
        }"
        OSS_COMPILES
    )

    set(CMAKE_REQUIRED_DEFINITIONS)

endif(ALLEGRO_HAVE_SOUNDCARD_H OR ALLEGRO_HAVE_SYS_SOUNDCARD_H OR
    ALLEGRO_HAVE_MACHINE_SOUNDCARD_H OR ALLEGRO_LINUX_SYS_SOUNDCARD_H)

# Handle the QUIETLY and REQUIRED arguments and set OSS_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OSS DEFAULT_MSG
    OSS_COMPILES)

mark_as_advanced(OSS_COMPILES)