FindSndio.cmake 1.7 KB

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