diff options
Diffstat (limited to 'project/cmake/modules/FindAlsa.cmake')
| -rw-r--r-- | project/cmake/modules/FindAlsa.cmake | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/project/cmake/modules/FindAlsa.cmake b/project/cmake/modules/FindAlsa.cmake index b15a0cf..a282243 100644 --- a/project/cmake/modules/FindAlsa.cmake +++ b/project/cmake/modules/FindAlsa.cmake | |||
| @@ -1,20 +1,46 @@ | |||
| 1 | # - Try to find ALSA | 1 | #.rst: |
| 2 | # Once done this will define | 2 | # FindAlsa |
| 3 | # -------- | ||
| 4 | # Finds the Alsa library | ||
| 3 | # | 5 | # |
| 4 | # ALSA_FOUND - system has libALSA | 6 | # This will will define the following variables:: |
| 5 | # ALSA_INCLUDE_DIRS - the libALSA include directory | 7 | # |
| 6 | # ALSA_LIBRARIES - The libALSA libraries | 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 | ||
| 7 | 16 | ||
| 8 | if(PKG_CONFIG_FOUND) | 17 | if(PKG_CONFIG_FOUND) |
| 9 | pkg_check_modules (ALSA alsa) | 18 | pkg_check_modules(PC_ALSA alsa QUIET) |
| 10 | else() | ||
| 11 | find_path(ALSA_INCLUDE_DIRS asoundlib.h PATH_SUFFIXES alsa) | ||
| 12 | find_library(ALSA_LIBRARIES asound) | ||
| 13 | endif() | 19 | endif() |
| 14 | 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 | |||
| 15 | include(FindPackageHandleStandardArgs) | 28 | include(FindPackageHandleStandardArgs) |
| 16 | find_package_handle_standard_args(Alsa DEFAULT_MSG ALSA_INCLUDE_DIRS ALSA_LIBRARIES) | 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() | ||
| 17 | 45 | ||
| 18 | set(ALSA_INCLUDE_DIRS "") # Dont want these added as 'timer.h' is a dangerous file | 46 | mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY) |
| 19 | mark_as_advanced(ALSA_INCLUDE_DIRS ALSA_LIBRARIES) | ||
| 20 | list(APPEND ALSA_DEFINITIONS -DHAVE_ALSA=1 -DUSE_ALSA=1) | ||
