1
0

FindLibrist.cmake 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Once done these will be defined:
  2. #
  3. # LIBRIST_FOUND LIBRIST_INCLUDE_DIRS LIBRIST_LIBRARIES
  4. #
  5. # For use in OBS:
  6. #
  7. # LIBRIST_INCLUDE_DIR
  8. find_package(PkgConfig QUIET)
  9. if(PKG_CONFIG_FOUND)
  10. pkg_check_modules(_LIBRIST QUIET librist)
  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. LIBRIST_INCLUDE_DIR
  19. NAMES librist.h librist/librist.h
  20. HINTS ENV LIBRIST_PATH ${LIBRIST_PATH} ${CMAKE_SOURCE_DIR}/${LIBRIST_PATH}
  21. ${_LIBRIST_INCLUDE_DIRS} ${DepsPath}
  22. PATHS /usr/include /usr/local/include /opt/local/include /sw/include
  23. PATH_SUFFIXES include)
  24. find_library(
  25. LIBRIST_LIB
  26. NAMES ${_LIBRIST_LIBRARIES} librist rist
  27. HINTS ENV LIBRIST_PATH ${LIBRIST_PATH} ${CMAKE_SOURCE_DIR}/${LIBRIST_PATH}
  28. ${_LIBRIST_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(Librist DEFAULT_MSG LIBRIST_LIB
  45. LIBRIST_INCLUDE_DIR)
  46. mark_as_advanced(LIBRIST_INCLUDE_DIR LIBRIST_LIB)
  47. if(LIBRIST_FOUND)
  48. set(LIBRIST_INCLUDE_DIRS ${LIBRIST_INCLUDE_DIR})
  49. set(LIBRIST_LIBRARIES ${LIBRIST_LIB})
  50. if(NOT TARGET Librist::Librist)
  51. if(IS_ABSOLUTE "${LIBRIST_LIBRARIES}")
  52. add_library(Librist::Librist UNKNOWN IMPORTED)
  53. set_target_properties(Librist::Librist PROPERTIES IMPORTED_LOCATION
  54. "${LIBRIST_LIBRARIES}")
  55. else()
  56. add_library(Librist::Librist INTERFACE IMPORTED)
  57. set_target_properties(Librist::Librist PROPERTIES IMPORTED_LIBNAME
  58. "${LIBRIST_LIBRARIES}")
  59. endif()
  60. set_target_properties(
  61. Librist::Librist PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
  62. "${LIBRIST_INCLUDE_DIRS}")
  63. endif()
  64. else()
  65. message(STATUS "librist library not found")
  66. endif()