FindSndio.cmake 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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(
  35. Sndio
  36. FOUND_VAR Sndio_FOUND
  37. REQUIRED_VARS Sndio_LIBRARY Sndio_INCLUDE_DIR)
  38. if(Sndio_FOUND)
  39. set(Sndio_LIBRARIES ${Sndio_LIBRARY})
  40. set(Sndio_INCLUDE_DIRS ${Sndio_INCLUDE_DIR})
  41. endif()
  42. if(Sndio_FOUND AND NOT TARGET Sndio::Sndio)
  43. add_library(Sndio::Sndio UNKNOWN IMPORTED)
  44. set_target_properties(
  45. Sndio::Sndio
  46. PROPERTIES IMPORTED_LOCATION "${Sndio_LIBRARY}"
  47. INTERFACE_INCLUDE_DIRECTORIES "${Sndio_INCLUDE_DIR}")
  48. endif()
  49. mark_as_advanced(Sndio_INCLUDE_DIR Sndio_LIBRARY)