diff options
| author | manuel <manuel@mausz.at> | 2017-06-04 16:57:49 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2017-06-04 16:57:49 +0200 |
| commit | f44ecaa4f27e7538ddcad66d40e543bffa2d2d86 (patch) | |
| tree | d8de60fc7e17edeb6f0921726c038ee54b281445 /cmake/modules/FindAlsa.cmake | |
| parent | ae08c8b7221bc965ac40d70e53fc8fcddb050c46 (diff) | |
| download | kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.tar.gz kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.tar.bz2 kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.zip | |
sync with upstream
Diffstat (limited to 'cmake/modules/FindAlsa.cmake')
| -rw-r--r-- | cmake/modules/FindAlsa.cmake | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/cmake/modules/FindAlsa.cmake b/cmake/modules/FindAlsa.cmake new file mode 100644 index 0000000..c99f509 --- /dev/null +++ b/cmake/modules/FindAlsa.cmake | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindAlsa | ||
| 3 | # -------- | ||
| 4 | # Finds the Alsa library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # ALSA_FOUND - system has Alsa | ||
| 9 | # ALSA_INCLUDE_DIRS - the Alsa include directory | ||
| 10 | # ALSA_LIBRARIES - the Alsa libraries | ||
| 11 | # ALSA_DEFINITIONS - the Alsa compile definitions | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # ALSA::ALSA - The Alsa library | ||
| 16 | |||
| 17 | if(PKG_CONFIG_FOUND) | ||
| 18 | pkg_check_modules(PC_ALSA alsa QUIET) | ||
| 19 | endif() | ||
| 20 | |||
| 21 | find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h | ||
| 22 | PATHS ${PC_ALSA_INCLUDEDIR}) | ||
| 23 | find_library(ALSA_LIBRARY NAMES asound | ||
| 24 | PATHS ${PC_ALSA_LIBDIR}) | ||
| 25 | |||
| 26 | set(ALSA_VERSION ${PC_ALSA_VERSION}) | ||
| 27 | |||
| 28 | include(FindPackageHandleStandardArgs) | ||
| 29 | find_package_handle_standard_args(Alsa | ||
| 30 | REQUIRED_VARS ALSA_LIBRARY ALSA_INCLUDE_DIR | ||
| 31 | VERSION_VAR ALSA_VERSION) | ||
| 32 | |||
| 33 | if(ALSA_FOUND) | ||
| 34 | set(ALSA_INCLUDE_DIRS "") # Don't want these added as 'timer.h' is a dangerous file | ||
| 35 | set(ALSA_LIBRARIES ${ALSA_LIBRARY}) | ||
| 36 | set(ALSA_DEFINITIONS -DHAVE_ALSA=1 -DUSE_ALSA=1) | ||
| 37 | |||
| 38 | if(NOT TARGET ALSA::ALSA) | ||
| 39 | add_library(ALSA::ALSA UNKNOWN IMPORTED) | ||
| 40 | set_target_properties(ALSA::ALSA PROPERTIES | ||
| 41 | IMPORTED_LOCATION "${ALSA_LIBRARY}" | ||
| 42 | INTERFACE_COMPILE_DEFINITIONS "${ALSA_DEFINITIONS}") | ||
| 43 | endif() | ||
| 44 | endif() | ||
| 45 | |||
| 46 | mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY) | ||
