FindSndFile.cmake 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # - Find SndFile library
  2. # Find the native SndFile includes and library
  3. # This module defines
  4. # SNDFILE_INCLUDE_DIRS, where to find sndfile.h, Set when
  5. # SNDFILE_INCLUDE_DIR is found.
  6. # SNDFILE_LIBRARIES, libraries to link against to use SndFile.
  7. # SNDFILE_ROOT_DIR, The base directory to search for SndFile.
  8. # This can also be an environment variable.
  9. # SNDFILE_FOUND, If false, do not try to use SndFile.
  10. #
  11. # also defined, but not for general use are
  12. # SNDFILE_LIBRARY, where to find the SndFile library.
  13. #=============================================================================
  14. # Copyright 2011 Blender Foundation.
  15. #
  16. # Distributed under the OSI-approved BSD License (the "License");
  17. # see accompanying file Copyright.txt for details.
  18. #
  19. # This software is distributed WITHOUT ANY WARRANTY; without even the
  20. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  21. # See the License for more information.
  22. #=============================================================================
  23. # If SNDFILE_ROOT_DIR was defined in the environment, use it.
  24. IF(NOT SNDFILE_ROOT_DIR AND NOT $ENV{SNDFILE_ROOT_DIR} STREQUAL "")
  25. SET(SNDFILE_ROOT_DIR $ENV{SNDFILE_ROOT_DIR})
  26. ENDIF()
  27. SET(_sndfile_SEARCH_DIRS
  28. ${SNDFILE_ROOT_DIR}
  29. /usr/local
  30. /sw # Fink
  31. /opt/local # DarwinPorts
  32. /opt/csw # Blastwave
  33. )
  34. FIND_PATH(SNDFILE_INCLUDE_DIR sndfile.h
  35. HINTS
  36. ${_sndfile_SEARCH_DIRS}
  37. PATH_SUFFIXES
  38. include
  39. )
  40. FIND_LIBRARY(SNDFILE_LIBRARY
  41. NAMES
  42. sndfile
  43. HINTS
  44. ${_sndfile_SEARCH_DIRS}
  45. PATH_SUFFIXES
  46. lib64 lib
  47. )
  48. # handle the QUIETLY and REQUIRED arguments and set SNDFILE_FOUND to TRUE if
  49. # all listed variables are TRUE
  50. INCLUDE(FindPackageHandleStandardArgs)
  51. FIND_PACKAGE_HANDLE_STANDARD_ARGS(SndFile DEFAULT_MSG
  52. SNDFILE_LIBRARY SNDFILE_INCLUDE_DIR)
  53. IF(SNDFILE_FOUND)
  54. SET(SNDFILE_LIBRARIES ${SNDFILE_LIBRARY})
  55. SET(SNDFILE_INCLUDE_DIRS ${SNDFILE_INCLUDE_DIR})
  56. ENDIF(SNDFILE_FOUND)
  57. MARK_AS_ADVANCED(
  58. SNDFILE_INCLUDE_DIR
  59. SNDFILE_LIBRARY
  60. )