1
0

FindLibsrt.cmake 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Once done these will be defined:
  2. #
  3. # LIBSRT_FOUND LIBSRT_INCLUDE_DIRS LIBSRT_LIBRARIES
  4. #
  5. # For use in OBS:
  6. #
  7. # LIBSRT_INCLUDE_DIR
  8. find_package(PkgConfig QUIET)
  9. if(PKG_CONFIG_FOUND)
  10. pkg_check_modules(_LIBSRT QUIET libsrt)
  11. endif()
  12. if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  13. set(_lib_suffix 64)
  14. else()
  15. set(_lib_suffix 32)
  16. endif()
  17. find_path(
  18. LIBSRT_INCLUDE_DIR
  19. NAMES srt.h srt/srt.h
  20. HINTS ENV LIBSRT_PATH ${LIBSRT_PATH} ${CMAKE_SOURCE_DIR}/${LIBSRT_PATH}
  21. ${_LIBSRT_INCLUDE_DIRS} ${DepsPath}
  22. PATHS /usr/include /usr/local/include /opt/local/include /sw/include
  23. PATH_SUFFIXES include)
  24. find_library(
  25. LIBSRT_LIB
  26. NAMES ${_LIBSRT_LIBRARIES} srt libsrt
  27. HINTS ENV LIBSRT_PATH ${LIBSRT_PATH} ${CMAKE_SOURCE_DIR}/${LIBSRT_PATH}
  28. ${_LIBSRT_LIBRARY_DIRS} ${DepsPath}
  29. PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib
  30. PATH_SUFFIXES
  31. lib${_lib_suffix}
  32. lib
  33. libs${_lib_suffix}
  34. libs
  35. bin${_lib_suffix}
  36. bin
  37. ../lib${_lib_suffix}
  38. ../lib
  39. ../libs${_lib_suffix}
  40. ../libs
  41. ../bin${_lib_suffix}
  42. ../bin)
  43. include(FindPackageHandleStandardArgs)
  44. find_package_handle_standard_args(Libsrt DEFAULT_MSG LIBSRT_LIB
  45. LIBSRT_INCLUDE_DIR)
  46. mark_as_advanced(LIBSRT_INCLUDE_DIR LIBSRT_LIB)
  47. if(LIBSRT_FOUND)
  48. set(LIBSRT_INCLUDE_DIRS ${LIBSRT_INCLUDE_DIR})
  49. set(LIBSRT_LIBRARIES ${LIBSRT_LIB})
  50. if(NOT TARGET Libsrt::Libsrt)
  51. if(IS_ABSOLUTE "${LIBSRT_LIBRARIES}")
  52. add_library(Libsrt::Libsrt UNKNOWN IMPORTED)
  53. set_target_properties(Libsrt::Libsrt PROPERTIES IMPORTED_LOCATION
  54. "${LIBSRT_LIBRARIES}")
  55. else()
  56. add_library(Libsrt::Libsrt INTERFACE IMPORTED)
  57. set_target_properties(Libsrt::Libsrt PROPERTIES IMPORTED_LIBNAME
  58. "${LIBSRT_LIBRARIES}")
  59. endif()
  60. set_target_properties(
  61. Libsrt::Libsrt PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
  62. "${LIBSRT_INCLUDE_DIRS}")
  63. endif()
  64. else()
  65. message(STATUS "libsrt library not found")
  66. endif()