FindSndFile.cmake 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # - Find SndFile library
  2. # Find the native SndFile includes and library
  3. # This module defines
  4. # LIBSNDFILE_INCLUDE_DIRS, where to find sndfile.h, Set when
  5. # LIBSNDFILE_INCLUDE_DIR is found.
  6. # LIBSNDFILE_LIBRARIES, libraries to link against to use SndFile.
  7. # LIBSNDFILE_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. # LIBSNDFILE_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 LIBSNDFILE_ROOT_DIR was defined in the environment, use it.
  24. IF(NOT LIBSNDFILE_ROOT_DIR AND NOT $ENV{LIBSNDFILE_ROOT_DIR} STREQUAL "")
  25. SET(LIBSNDFILE_ROOT_DIR $ENV{LIBSNDFILE_ROOT_DIR})
  26. ENDIF()
  27. SET(_sndfile_SEARCH_DIRS
  28. ${LIBSNDFILE_ROOT_DIR}
  29. /usr/local
  30. /sw # Fink
  31. /opt/local # DarwinPorts
  32. )
  33. FIND_PATH(LIBSNDFILE_INCLUDE_DIR sndfile.h
  34. HINTS
  35. ${_sndfile_SEARCH_DIRS}
  36. PATH_SUFFIXES
  37. include
  38. )
  39. FIND_LIBRARY(LIBSNDFILE_LIBRARY
  40. NAMES
  41. sndfile
  42. HINTS
  43. ${_sndfile_SEARCH_DIRS}
  44. PATH_SUFFIXES
  45. lib64 lib
  46. )
  47. # handle the QUIETLY and REQUIRED arguments and set SNDFILE_FOUND to TRUE if
  48. # all listed variables are TRUE
  49. INCLUDE(FindPackageHandleStandardArgs)
  50. FIND_PACKAGE_HANDLE_STANDARD_ARGS(SndFile DEFAULT_MSG
  51. LIBSNDFILE_LIBRARY LIBSNDFILE_INCLUDE_DIR)
  52. IF(SNDFILE_FOUND)
  53. SET(LIBSNDFILE_LIBRARIES ${LIBSNDFILE_LIBRARY})
  54. SET(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE_INCLUDE_DIR})
  55. ENDIF(SNDFILE_FOUND)
  56. MARK_AS_ADVANCED(
  57. LIBSNDFILE_INCLUDE_DIR
  58. LIBSNDFILE_LIBRARY
  59. )