FindSndio.cmake 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #[=======================================================================[.rst:
  4. FindSndio
  5. -------
  6. Finds the Sndio library.
  7. Imported Targets
  8. ^^^^^^^^^^^^^^^^
  9. This module provides the following imported targets, if found:
  10. ``Sndio::Sndio``
  11. The Sndio library
  12. Result Variables
  13. ^^^^^^^^^^^^^^^^
  14. This will define the following variables:
  15. ``Sndio_FOUND``
  16. True if the system has the Sndio library.
  17. ``Sndio_VERSION``
  18. The version of the Sndio library which was found.
  19. ``Sndio_INCLUDE_DIRS``
  20. Include directories needed to use Sndio.
  21. ``Sndio_LIBRARIES``
  22. Libraries needed to link to Sndio.
  23. Cache Variables
  24. ^^^^^^^^^^^^^^^
  25. The following cache variables may also be set:
  26. ``Sndio_INCLUDE_DIR``
  27. The directory containing ``sndio.h``.
  28. ``Sndio_LIBRARY``
  29. The path to the Sndio library.
  30. #]=======================================================================]
  31. find_path(Sndio_INCLUDE_DIR sndio.h)
  32. find_library(Sndio_LIBRARY sndio)
  33. include(FindPackageHandleStandardArgs)
  34. find_package_handle_standard_args(Sndio
  35. FOUND_VAR Sndio_FOUND
  36. REQUIRED_VARS
  37. Sndio_LIBRARY
  38. Sndio_INCLUDE_DIR
  39. )
  40. if(Sndio_FOUND)
  41. set(Sndio_LIBRARIES ${Sndio_LIBRARY})
  42. set(Sndio_INCLUDE_DIRS ${Sndio_INCLUDE_DIR})
  43. endif()
  44. if(Sndio_FOUND AND NOT TARGET Sndio::Sndio)
  45. add_library(Sndio::Sndio UNKNOWN IMPORTED)
  46. set_target_properties(Sndio::Sndio PROPERTIES
  47. IMPORTED_LOCATION "${Sndio_LIBRARY}"
  48. INTERFACE_INCLUDE_DIRECTORIES "${Sndio_INCLUDE_DIR}"
  49. )
  50. endif()
  51. mark_as_advanced(
  52. Sndio_INCLUDE_DIR
  53. Sndio_LIBRARY
  54. )