2 # Find the alsa libraries (asound)
4 # This module defines the following variables:
5 # ALSA_FOUND - True if ALSA_INCLUDE_DIR & ALSA_LIBRARY are found
6 # ALSA_LIBRARIES - Set when ALSA_LIBRARY is found
7 # ALSA_INCLUDE_DIRS - Set when ALSA_INCLUDE_DIR is found
9 # ALSA_INCLUDE_DIR - where to find asoundlib.h, etc.
10 # ALSA_LIBRARY - the asound library
11 # ALSA_VERSION_STRING - the version of alsa found (since CMake 2.8.8)
14 #=============================================================================
15 # Copyright 2009-2011 Kitware, Inc.
16 # Copyright 2009-2011 Philip Lowman <philip@yhbt.com>
18 # Distributed under the OSI-approved BSD License (the "License");
19 # see accompanying file Copyright.txt for details.
21 # This software is distributed WITHOUT ANY WARRANTY; without even the
22 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 # See the License for more information.
24 #=============================================================================
25 # (To distribute this file outside of CMake, substitute the full
26 # License text for the above reference.)
28 find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h
29 DOC "The ALSA (asound) include directory"
32 find_library(ALSA_LIBRARY NAMES asound
33 DOC "The ALSA (asound) library"
36 if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/alsa/version.h")
37 file(STRINGS "${ALSA_INCLUDE_DIR}/alsa/version.h" alsa_version_str REGEX "^#define[\t ]+SND_LIB_VERSION_STR[\t ]+\".*\"")
39 string(REGEX REPLACE "^.*SND_LIB_VERSION_STR[\t ]+\"([^\"]*)\".*$" "\\1" ALSA_VERSION_STRING "${alsa_version_str}")
40 unset(alsa_version_str)
43 # handle the QUIETLY and REQUIRED arguments and set ALSA_FOUND to TRUE if
44 # all listed variables are TRUE
45 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
46 FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA
47 REQUIRED_VARS ALSA_LIBRARY ALSA_INCLUDE_DIR
48 VERSION_VAR ALSA_VERSION_STRING)
51 set( ALSA_LIBRARIES ${ALSA_LIBRARY} )
52 set( ALSA_INCLUDE_DIRS ${ALSA_INCLUDE_DIR} )
55 mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY)