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 # Redistribution and use in source and binary forms, with or without
19 # modification, are permitted provided that the following conditions are
22 # * Redistributions of source code must retain the above copyright notice,
23 # this list of conditions and the following disclaimer.
25 # * Redistributions in binary form must reproduce the above copyright notice,
26 # this list of conditions and the following disclaimer in the documentation
27 # and/or other materials provided with the distribution.
29 # * The names of Kitware, Inc., the Insight Consortium, or the names of
30 # any consortium members, or of any contributors, may not be used to
31 # endorse or promote products derived from this software without
32 # specific prior written permission.
34 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
35 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
38 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
39 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
40 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
41 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
42 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
43 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 #=============================================================================
46 find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h
47 DOC "The ALSA (asound) include directory"
50 find_library(ALSA_LIBRARY NAMES asound
51 DOC "The ALSA (asound) library"
54 if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/alsa/version.h")
55 file(STRINGS "${ALSA_INCLUDE_DIR}/alsa/version.h" alsa_version_str REGEX "^#define[\t ]+SND_LIB_VERSION_STR[\t ]+\".*\"")
57 string(REGEX REPLACE "^.*SND_LIB_VERSION_STR[\t ]+\"([^\"]*)\".*$" "\\1" ALSA_VERSION_STRING "${alsa_version_str}")
58 unset(alsa_version_str)
61 # handle the QUIETLY and REQUIRED arguments and set ALSA_FOUND to TRUE if
62 # all listed variables are TRUE
63 include(FindPackageHandleStandardArgs)
64 find_package_handle_standard_args(ALSA
65 REQUIRED_VARS ALSA_LIBRARY ALSA_INCLUDE_DIR
66 VERSION_VAR ALSA_VERSION_STRING)
69 set( ALSA_LIBRARIES ${ALSA_LIBRARY} )
70 set( ALSA_INCLUDE_DIRS ${ALSA_INCLUDE_DIR} )
73 mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY)