FindUnibilium.cmake 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # - Try to find unibilium
  2. # Once done this will define
  3. # UNIBILIUM_FOUND - System has unibilium
  4. # UNIBILIUM_INCLUDE_DIRS - The unibilium include directories
  5. # UNIBILIUM_LIBRARIES - The libraries needed to use unibilium
  6. if(NOT USE_BUNDLED_UNIBILIUM)
  7. find_package(PkgConfig)
  8. if (PKG_CONFIG_FOUND)
  9. pkg_check_modules(PC_UNIBILIUM QUIET unibilium)
  10. endif()
  11. else()
  12. set(PC_UNIBILIUM_INCLUDEDIR)
  13. set(PC_UNIBILIUM_INCLUDE_DIRS)
  14. set(PC_UNIBILIUM_LIBDIR)
  15. set(PC_UNIBILIUM_LIBRARY_DIRS)
  16. set(LIMIT_SEARCH NO_DEFAULT_PATH)
  17. endif()
  18. set(UNIBILIUM_DEFINITIONS ${PC_UNIBILIUM_CFLAGS_OTHER})
  19. find_path(UNIBILIUM_INCLUDE_DIR unibilium.h
  20. PATHS ${PC_UNIBILIUM_INCLUDEDIR} ${PC_UNIBILIUM_INCLUDE_DIRS}
  21. ${LIMIT_SEARCH})
  22. # If we're asked to use static linkage, add libunibilium.a as a preferred library name.
  23. if(UNIBILIUM_USE_STATIC)
  24. list(APPEND UNIBILIUM_NAMES
  25. "${CMAKE_STATIC_LIBRARY_PREFIX}unibilium${CMAKE_STATIC_LIBRARY_SUFFIX}")
  26. endif()
  27. list(APPEND UNIBILIUM_NAMES unibilium)
  28. find_library(UNIBILIUM_LIBRARY NAMES ${UNIBILIUM_NAMES}
  29. HINTS ${PC_UNIBILIUM_LIBDIR} ${PC_UNIBILIUM_LIBRARY_DIRS}
  30. ${LIMIT_SEARCH})
  31. set(UNIBILIUM_LIBRARIES ${UNIBILIUM_LIBRARY})
  32. set(UNIBILIUM_INCLUDE_DIRS ${UNIBILIUM_INCLUDE_DIR})
  33. include(FindPackageHandleStandardArgs)
  34. # handle the QUIETLY and REQUIRED arguments and set UNIBILIUM_FOUND to TRUE
  35. # if all listed variables are TRUE
  36. find_package_handle_standard_args(unibilium DEFAULT_MSG
  37. UNIBILIUM_LIBRARY UNIBILIUM_INCLUDE_DIR)
  38. mark_as_advanced(UNIBILIUM_INCLUDE_DIR UNIBILIUM_LIBRARY)