FindSamplerate.cmake 989 B

1234567891011121314151617181920212223242526272829303132333435
  1. # FindFFTW.cmake - Try to find FFTW3
  2. # Copyright (c) 2018 Lukas W <lukaswhl/at/gmail.com>
  3. # This file is MIT licensed.
  4. # See http://opensource.org/licenses/MIT
  5. find_package(PkgConfig QUIET)
  6. if(PKG_CONFIG_FOUND)
  7. pkg_check_modules(SAMPLERATE_PKG samplerate)
  8. endif()
  9. find_path(SAMPLERATE_INCLUDE_DIR
  10. NAMES samplerate.h
  11. PATHS ${SAMPLERATE_PKG_INCLUDE_DIRS}
  12. )
  13. set(SAMPLERATE_NAMES samplerate libsamplerate)
  14. if(Samplerate_FIND_VERSION_MAJOR)
  15. list(APPEND SAMPLERATE_NAMES libsamplerate-${Samplerate_FIND_VERSION_MAJOR})
  16. else()
  17. list(APPEND SAMPLERATE_NAMES libsamplerate-0)
  18. endif()
  19. find_library(SAMPLERATE_LIBRARY
  20. NAMES ${SAMPLERATE_NAMES}
  21. PATHS ${SAMPLERATE_PKG_LIBRARY_DIRS}
  22. )
  23. include(FindPackageHandleStandardArgs)
  24. find_package_handle_standard_args(SAMPLERATE DEFAULT_MSG SAMPLERATE_LIBRARY SAMPLERATE_INCLUDE_DIR)
  25. mark_as_advanced(SAMPLERATE_INCLUDE_DIR SAMPLERATE_LIBRARY )
  26. set(SAMPLERATE_LIBRARIES ${SAMPLERATE_LIBRARY} )
  27. set(SAMPLERATE_INCLUDE_DIRS ${SAMPLERATE_INCLUDE_DIR})