🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
3.2 KiB

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