FindLibTermkey.cmake 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # - Try to find libtermkey
  2. # Once done this will define
  3. # LIBTERMKEY_FOUND - System has libtermkey
  4. # LIBTERMKEY_INCLUDE_DIRS - The libtermkey include directories
  5. # LIBTERMKEY_LIBRARIES - The libraries needed to use libtermkey
  6. if(NOT USE_BUNDLED_LIBTERMKEY)
  7. find_package(PkgConfig)
  8. if (PKG_CONFIG_FOUND)
  9. pkg_check_modules(PC_LIBTERMKEY QUIET termkey)
  10. endif()
  11. else()
  12. set(PC_LIBTERMKEY_INCLUDEDIR)
  13. set(PC_LIBTERMKEY_INCLUDE_DIRS)
  14. set(PC_LIBTERMKEY_LIBDIR)
  15. set(PC_LIBTERMKEY_LIBRARY_DIRS)
  16. set(LIMIT_SEARCH NO_DEFAULT_PATH)
  17. endif()
  18. set(LIBTERMKEY_DEFINITIONS ${PC_LIBTERMKEY_CFLAGS_OTHER})
  19. find_path(LIBTERMKEY_INCLUDE_DIR termkey.h
  20. PATHS ${PC_LIBTERMKEY_INCLUDEDIR} ${PC_LIBTERMKEY_INCLUDE_DIRS}
  21. ${LIMIT_SEARCH})
  22. # If we're asked to use static linkage, add libuv.a as a preferred library name.
  23. if(LIBTERMKEY_USE_STATIC)
  24. list(APPEND LIBTERMKEY_NAMES
  25. "${CMAKE_STATIC_LIBRARY_PREFIX}termkey${CMAKE_STATIC_LIBRARY_SUFFIX}")
  26. endif()
  27. list(APPEND LIBTERMKEY_NAMES termkey)
  28. find_library(LIBTERMKEY_LIBRARY NAMES ${LIBTERMKEY_NAMES}
  29. HINTS ${PC_LIBTERMKEY_LIBDIR} ${PC_LIBTERMKEY_LIBRARY_DIRS}
  30. ${LIMIT_SEARCH})
  31. set(LIBTERMKEY_LIBRARIES ${LIBTERMKEY_LIBRARY})
  32. set(LIBTERMKEY_INCLUDE_DIRS ${LIBTERMKEY_INCLUDE_DIR})
  33. include(FindPackageHandleStandardArgs)
  34. # handle the QUIETLY and REQUIRED arguments and set LIBTERMKEY_FOUND to TRUE
  35. # if all listed variables are TRUE
  36. find_package_handle_standard_args(LibTermkey DEFAULT_MSG
  37. LIBTERMKEY_LIBRARY LIBTERMKEY_INCLUDE_DIR)
  38. mark_as_advanced(LIBTERMKEY_INCLUDE_DIR LIBTERMKEY_LIBRARY)