FindOSS.cmake 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #[=======================================================================[.rst
  2. FindOSS
  3. -------
  4. FindModule for OSS and associated libraries
  5. .. versionchanged:: 3.0
  6. Updated FindModule to CMake standards
  7. Imported Targets
  8. ^^^^^^^^^^^^^^^^
  9. .. versionadded:: 2.0
  10. This module defines the :prop_tgt:`IMPORTED` target ``OSS::OSS``.
  11. Result Variables
  12. ^^^^^^^^^^^^^^^^
  13. This module sets the following variables:
  14. ``OSS_FOUND``
  15. True, if all required components and the core library were found.
  16. ``OSS_VERSION``
  17. Detected version of found OSS libraries.
  18. Cache variables
  19. ^^^^^^^^^^^^^^^
  20. The following cache variables may also be set:
  21. ``OSS_INCLUDE_DIR``
  22. Directory containing ``sys/soundcard.h``.
  23. #]=======================================================================]
  24. include(FindPackageHandleStandardArgs)
  25. find_path(
  26. OSS_INCLUDE_DIR
  27. NAMES sys/soundcard.h
  28. HINTS ${PC_OSS_INCLUDE_DIRS}
  29. PATHS /usr/include /usr/local/include
  30. DOC "OSS include directory"
  31. )
  32. set(OSS_VERSION ${CMAKE_HOST_SYSTEM_VERSION})
  33. find_package_handle_standard_args(
  34. OSS
  35. REQUIRED_VARS OSS_INCLUDE_DIR
  36. VERSION_VAR OSS_VERSION
  37. REASON_FAILURE_MESSAGE "Ensure that OSS is installed on the system."
  38. )
  39. mark_as_advanced(OSS_INCLUDE_DIR OSS_LIBRARY)
  40. if(OSS_FOUND)
  41. if(NOT TARGET OSS::OSS)
  42. add_library(OSS::OSS INTERFACE IMPORTED)
  43. set_target_properties(OSS::OSS PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OSS_INCLUDE_DIR}" VERSION ${OSS_VERSION})
  44. endif()
  45. endif()